> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Orq.ai is the control plane for model and MCP traffic: one key reaches the workspace's enabled models, MCP servers, and resources. The setup depends on where the agent runs.
> Hosted assistant (ChatGPT, claude.ai, a hosted sandbox): install nothing. Tell the human to add https://my.orq.ai/v2/mcp as a remote MCP connector and finish the Orq.ai sign-in. With OAuth, send no Authorization header; otherwise send an API key as a bearer token.
> Local coding agent (Claude Code, Codex, Cursor, OpenCode): run `curl -fsSL https://cli.orq.ai/install.sh | sh`. It installs the CLI and runs `orq setup`, which signs in, writes a project-scoped key to `~/.orq/env`, and wires the detected agents through the AI Gateway. It can also add the Orq MCP server and Orq Skills, the workflows for agents, evaluations, and traces: https://docs.orq.ai/ai-studio/integrations/code-assistants/orq-skills.md. Verify with `orq status`.
> Headless or CI: read `ORQ_API_KEY` from the environment; a human creates the key at https://docs.orq.ai/ai-studio/organization/api-keys.md.
> Send model traffic to https://my.orq.ai/v3/router with `Authorization: Bearer $ORQ_API_KEY`; the Anthropic SDK uses https://my.orq.ai/v3/anthropic. New integrations go on `/v3/router`: `/v2/router` stays published for backward compatibility, and `orq.prompt` works only on `/v2/router/chat/completions`.
> Enable a model for the workspace and use its exact `provider/model` id. `POST /v2/workspace-models` enables a model, and a call fails while the workspace has neither credits nor a provider key.
> On `/chat/completions`, a reasoning model rejects `tools` with a `reasoning_effort` other than `none`; `/responses` keeps reasoning.
> On a failure, branch on `error.code` and follow `error.doc_url`; a budget rejection answers 429.

# Agent Deployments

> Publish an agent version with a trigger, reusable input, execution limits, and a run history.

## Overview

An **Agent Deployment** combines an **Agent** version, reusable input, and an execution trigger. Open an **Agent** and select **Deployments** to manage its published configurations and inspect their runs. Each **Deployment** has a key, unique within its **Agent**, that works as an invocation target in the [Responses API](https://docs.orq.ai/ai-studio/ai-engineering/run-agents.md): `agent/{agent_key}@{deployment_key}`. The **Deployment** ID works there too.

> [!NOTE]
>
> **Agent Deployments** replace **Agent Schedules**. Existing `/v3/agents/{agent_key}/schedules` routes remain deprecated aliases for schedule-based **Deployments**. Use `/v2/agents/{agent_key}/deployments` for new integrations.

## Create a Deployment

Create a schedule-based **Deployment** that runs at 09:00 in the configured timezone. Cron expressions use six fields: second, minute, hour, day of month, month, and day of week. The minimum interval is one hour.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST https://my.orq.ai/v2/agents/ops_digest/deployments \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "Morning briefing",
    "key": "morning-briefing",
    "trigger": {
      "schedule": {
        "expression": "0 0 9 * * *",
        "timezone": "Europe/Amsterdam"
      }
    },
    "payload": {
      "input": "Generate the morning briefing for {{region}}",
      "variables": { "region": "EMEA" }
    }
  }'
```

```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const response = await fetch('https://my.orq.ai/v2/agents/ops_digest/deployments', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.ORQ_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    display_name: 'Morning briefing',
    key: 'morning-briefing',
    trigger: {
      schedule: { expression: '0 0 9 * * *', timezone: 'Europe/Amsterdam' },
    },
    payload: {
      input: 'Generate the morning briefing for {{region}}',
      variables: { region: 'EMEA' },
    },
  }),
});
const { agent_deployment } = await response.json();
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import json
import os
from urllib.request import Request, urlopen

request = Request(
    "https://my.orq.ai/v2/agents/ops_digest/deployments",
    method="POST",
    headers={
        "Authorization": f"Bearer {os.environ['ORQ_API_KEY']}",
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "display_name": "Morning briefing",
        "key": "morning-briefing",
        "trigger": {
            "schedule": {
                "expression": "0 0 9 * * *",
                "timezone": "Europe/Amsterdam",
            },
        },
        "payload": {
            "input": "Generate the morning briefing for {{region}}",
            "variables": {"region": "EMEA"},
        },
    }).encode(),
)
with urlopen(request) as response:
    agent_deployment = json.load(response)["agent_deployment"]
```

The response contains `agent_deployment`, including its `_id`, status, configuration, and computed `stats.next_run_at` and `stats.upcoming_runs_at` values.

## Configuration

| Field | Description |
| - | - |
| `display_name` | Required name, up to 200 characters. |
| `key` | Starts with a letter; letters, numbers, `.`, `-` and `_`, up to 100 characters. Unique within the **Agent** and fixed after creation. `latest` and version-like values such as `v2` are reserved. Defaults to one derived from `display_name`. |
| `agent_version` | Version number as a string. Omit to use the active version. |
| `trigger` | Exactly one of `schedule` or `webhook`. |
| `trigger.schedule.expression` | Six-field cron expression. Required for a schedule trigger. |
| `trigger.schedule.timezone` | IANA timezone, such as `Europe/Amsterdam`. Defaults to `UTC`. |
| `payload.input` | Default Responses input for each run. |
| `payload.variables` | Template values merged with invocation variables. Invocation values take precedence. |
| `payload.memory_entity_id` | **Memory Store** entity to attach to each run. |
| `payload.metadata` | Metadata attached to generated responses. |
| `budget.max_cost_per_run` | Maximum cost in USD per run. |
| `budget.amount` and `budget.period` | Period budget in USD; period is `BUDGET_PERIOD_DAILY`, `BUDGET_PERIOD_WEEKLY`, `BUDGET_PERIOD_MONTHLY`, or `BUDGET_PERIOD_YEARLY`. Defaults to monthly. |
| `limits.max_concurrent_runs` | Maximum simultaneous runs. Defaults to `1`. Overlapping attempts are recorded as skipped. |
| `limits.max_invocations_per_hour` | Invocation rate limit. Defaults to `20`. |
| `limits.max_runtime_seconds` | Run timeout in seconds, up to `1800`. Defaults to `1800`. |

A schedule follows local wall-clock time in its configured timezone. Inspect the upcoming run timestamps after editing the expression or timezone.

## Run and inspect

Select **Run now** in **AI Studio**, or call the run operation. Manual runs are allowed while a **Deployment** is paused.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST 'https://my.orq.ai/v2/agents/ops_digest/deployments/{deployment_id}:run' \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"Generate a briefing for the current incident"}'
```

The response contains a `run`. List its run history with `GET /v2/agents/ops_digest/deployments/{deployment_id}/runs`. Add `status=AGENT_DEPLOYMENT_RUN_STATUS_FAILED` to filter failed runs, or retrieve one with `GET /v2/agents/ops_digest/deployments/{deployment_id}/runs/{run_id}`.

Runs have status `AGENT_DEPLOYMENT_RUN_STATUS_QUEUED`, `AGENT_DEPLOYMENT_RUN_STATUS_RUNNING`, `AGENT_DEPLOYMENT_RUN_STATUS_COMPLETED`, `AGENT_DEPLOYMENT_RUN_STATUS_FAILED`, or `AGENT_DEPLOYMENT_RUN_STATUS_SKIPPED`. A run records its trigger context, response and trace IDs, timestamps, and a typed error when it did not complete. Input, output, and usage stay on the response: follow `response_id` through the [Responses API](https://docs.orq.ai/reference/responses/retrieve-response.md) or open the trace.

Invoke a published configuration directly with `model: "agent/ops_digest@morning-briefing"`. Direct invocations use the same run history and limits. Supplied input replaces the default input.

## Pause, resume, archive, and delete

Update `status` with `PATCH /v2/agents/{agent_key}/deployments/{deployment_id}`:

| Status | Behavior |
| - | - |
| `AGENT_DEPLOYMENT_STATUS_ACTIVE` | Accept triggers. Scheduled runs resume from the next matching time without replaying missed runs. |
| `AGENT_DEPLOYMENT_STATUS_PAUSED` | Suppress automatic triggers. Manual runs remain available. |
| `AGENT_DEPLOYMENT_STATUS_ARCHIVED` | Stop execution permanently. An archived **Deployment** cannot be reactivated. |

A paused **Deployment** includes `paused_reason`, which identifies a manual or automatic pause. Resolve the reported cause before resuming an automatically paused **Deployment**.

Delete a **Deployment** with `DELETE /v2/agents/{agent_key}/deployments/{deployment_id}`. Deletion also removes its run records and associated budget.

## Webhook triggers

A **Deployment** with `"trigger": {"webhook": {}}` has no schedule. The calling system sends each request through the [Responses API](https://docs.orq.ai/ai-studio/ai-engineering/run-agents.md) with an API key and the input for that call. A `payload.input` saved on the deployment is used only when a call sends no input:

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -X POST 'https://my.orq.ai/v3/router/responses' \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"agent/ops_digest@{deployment_key}","input":"Summarize the incident for customer 1234"}'
```

Each call is recorded as a **Webhook** run and counts toward the deployment's invocations per hour. A call over that limit returns `429` without starting a run.

## Lifecycle events

Subscribe through [Webhooks](https://docs.orq.ai/ai-studio/organization/webhooks.md) to react to changes and run outcomes. **Agent Deployment** events use `agent_deployment.created`, `updated`, `paused`, `unpaused`, `archived`, and `deleted`. Run events use `agent_deployment_run.started`, `completed`, `failed`, and `skipped`.

Event payloads contain identifiers, status, and a reason when available. Retrieve the **Deployment** or run for the complete record. Deliveries use the existing `X-Orq-Signature` verification mechanism.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.