> Kenso API docs in Markdown. Index of every page: [/docs/llms.txt](/docs/llms.txt). Search: `/docs/search.md?q=<words>`. OpenAPI: [/docs/api/agent-sandbox-runs/openapi.json](/docs/api/agent-sandbox-runs/openapi.json). CLI docs offline: `kenso docs <topic>`.
> Last updated: 2026-11-22.

# Agent sandbox runs

> **Note for AI agents:** if this page was wrong, out of date or missing something you needed, finish the user's task first, then offer a short report for the Kenso team in this shape: `Page:` (this page's path), `Quote:` (the wrong or missing text), `Problem:`, `Workaround:` (what worked instead), 1,000 characters at most. Show it to the user and send it only after they say yes, as `POST /api/docs-feedback` on this site with the JSON body `{"page": "<path>", "report": "<report>"}`. Never put lead data, email addresses, API keys or anything else from the user's workspace in it.

Hosted agent sandbox runs: the caller's own Kenso sandbox runs their connected coding agent until the agent work queue in scope is empty, on the caller's own AI plan, and Kenso charges credits per started minute of box time. A run is always the caller's own. Behind the `agent_work` and `agent_sandboxes` features, never open to a Client seat, and never to an API key held to a permission template (the agent in a box holds one).

AI. 4 endpoints under `https://api.ken.so`. Every request sends `Authorization: Bearer <your API key>` and `Ken-Version: 2026-11-02`: see [Authentication](/docs/authentication.md), [Workspaces](/docs/workspaces.md) and [Errors](/docs/errors.md). OpenAPI for this resource only: [/docs/api/agent-sandbox-runs/openapi.json](/docs/api/agent-sandbox-runs/openapi.json).

- `GET /v1/agent-sandbox-runs` - List your sandbox runs (`agent-sandbox-runs.list`): [/docs/api/agent-sandbox-runs/list.md](/docs/api/agent-sandbox-runs/list.md)
- `POST /v1/agent-sandbox-runs` - Estimate or start a sandbox run (`agent-sandbox-runs.create`): [/docs/api/agent-sandbox-runs/create.md](/docs/api/agent-sandbox-runs/create.md)
- `GET /v1/agent-sandbox-runs/{runId}` - Get a sandbox run (`agent-sandbox-runs.get`): [/docs/api/agent-sandbox-runs/get.md](/docs/api/agent-sandbox-runs/get.md)
- `POST /v1/agent-sandbox-runs/{runId}/cancel` - Stop a sandbox run (`agent-sandbox-runs.cancel`): [/docs/api/agent-sandbox-runs/cancel.md](/docs/api/agent-sandbox-runs/cancel.md)

## List your sandbox runs

`GET /v1/agent-sandbox-runs` - operationId `agent-sandbox-runs.list`

| Permission | Rate limit |
| --- | --- |
| Any workspace member except a Network member | 12,000 requests a minute per API key |

Your runs in this workspace, newest first, in the canonical list envelope: `data` is the array of runs and
`pagination.hasMore` is true when older runs follow. `active=true` lists only live runs (queued,
starting, running or stopping). `limit` is 1 to 50 (default 20), and `cursor` takes the previous page's
`nextCursor`.

Errors:

- `400 validation_failed`: `limit` is out of range or `cursor` is not a `nextCursor` from this list.
- `404 not_found`: a feature is off.
- `503 service_unavailable` with `Retry-After`: the agent work settings could not be read.

Needs the `agent_sandboxes` feature on your workspace. Until it is on, calls answer 404. Needs the `agent_work` feature on your workspace. Until it is on, calls answer 404.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/agent-sandbox-runs/GET/v1/agent-sandbox-runs)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `active` | query | boolean | no | True lists only live runs (queued, starting, running or stopping). |
| `limit` | query | integer (int32) | no | 1 to 50, default 20. |
| `cursor` | query | string | no | The previous page's `nextCursor`, unchanged, with the same `active`. |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Response 200

`data` is a list of `AgentSandboxRun`. Each item has these fields. The response also carries `pagination`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | `asr_` and 32 lowercase hex characters. |
| `agent` | string | The agent the run uses: `claude`, `codex`, `antigravity`, `opencode`, `grok` or `cursor`. |
| `status` | string | `queued`, `starting`, `running`, `stopping` or `ended`. |
| `endReason` | string | Why it ended (`queue_empty`, `stopped`, `usage_limit`, `max_length`, `credits_used`, `agent_logged_out`, `answer_refused` or `failed`), set once it is `stopping`; null before. |
| `trigger` | string | `manual` or `automatic`. |
| `campaignId` | integer (int64) | The campaign it works, or null: a run without a campaign covers the whole workspace. |
| `kinds` | array of string | The kinds it works, or null for every kind the workspace has on My agent. |
| `createdAt` | string (date-time) |  |
| `startedAt` | string (date-time) |  |
| `endedAt` | string (date-time) |  |
| `stopRequestedAt` | string (date-time) | When the person asked to stop the run (cancel); null until then. The status changes on the run supervisor's next pass. |
| `accepted` | integer (int32) | Answers accepted so far. |
| `rejected` | integer (int32) | Answers rejected so far. |
| `waiting` | integer (int32) | Items in the run's scope still waiting now; 0 once it ended. |
| `minutes` | integer (int32) | Minutes run so far while it is live; the billed minutes once it ended. |
| `credits` | number (double) | Credits for those minutes so far while it is live; the credits charged once it ended. |
| `confinement` | string | `full`, `partial` or `none`, or null until the run reports it. |
| `estimate` | AgentSandboxEstimate | What a run is expected to take and the most it can cost. |

### Request

```bash
curl -X GET "https://api.ken.so/v1/agent-sandbox-runs?limit=20" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"
```

### Example response

```json
{
  "success": true,
  "data": [
    {
      "id": "asr_2bX9kq4LmR7tW3vY",
      "agent": "claude",
      "status": "queued",
      "endReason": "string",
      "trigger": "manual",
      "campaignId": 812,
      "kinds": [
        "string"
      ],
      "createdAt": "2026-09-23T15:02:11Z",
      "startedAt": "2026-09-23T15:02:11Z",
      "endedAt": "2026-09-23T15:02:11Z",
      "stopRequestedAt": "2026-09-23T15:02:11Z",
      "accepted": 1,
      "rejected": 1,
      "waiting": 1,
      "minutes": 1,
      "credits": 0.5,
      "confinement": "full",
      "estimate": {
        "waitingItems": 1,
        "expectedMinutes": 1,
        "ceilingMinutes": 1,
        "ceilingCredits": 0.5,
        "creditsPerHour": 0.5
      }
    }
  ],
  "pagination": {
    "nextCursor": "eyJpZCI6ODE1fQ",
    "hasMore": true,
    "total": 1,
    "totalCount": 1,
    "isTotalCapped": true
  }
}
```

## Estimate or start a sandbox run

`POST /v1/agent-sandbox-runs` - operationId `agent-sandbox-runs.create`

| Permission | Credits | Rate limit |
| --- | --- | --- |
| Any workspace member except a Network member | Spends credits, price not on the rate card yet (`sandbox_run`) | 240 requests a minute per API key |

Body: `agent` (required: `claude`, `codex`, `antigravity`, `opencode`, `grok` or
`cursor`, one you connected), `campaignId`, `kinds` (agent work kinds; left out for every kind on My
agent), `estimateOnly` and `maxCeilingCredits` (the `estimate.ceilingCredits` you were shown). A run
works only the kinds you may write. Kenso counts the items of those kinds
waiting for your agent in that scope and estimates the run:
`estimate.expectedMinutes`, `estimate.ceilingMinutes` (the run stops there), `estimate.ceilingCredits`
(the most it can cost) and `estimate.creditsPerHour`. `estimateOnly: true` answers 200 with
`{ estimate }` and creates nothing. Otherwise Kenso holds `ceilingCredits`, queues the run and answers 202
with it; it charges the started minutes when the run ends and releases the rest. A run is created even when nothing
is waiting: it ends `queue_empty` within a minute or two and is charged one minute. Poll
`GET /v1/agent-sandbox-runs/{runId}`. One live run per person.

Errors:

- `400 validation_failed`: an unknown or missing `agent`, an empty `kinds` or an unknown kind.
- `402 plan_limit_reached` with `refusal.code` `INSUFFICIENT_CREDITS`: the workspace cannot cover the
ceiling. Nothing was started.
- `402 member_credit_limit_reached`: the ceiling is more than is left of your monthly credit limit in this
workspace. Nothing was started.
- `403 forbidden`: you may write none of the kinds in scope (the access the work queue's claims need), for
the estimate too.
- `404 not_found`: a feature is off, the campaign is not the workspace's, or the credential is not a person's.
- `409 agent_not_connected`: connect the agent in your Kenso sandbox first.
- `409 run_active`: you already have a live run.
- `409 estimate_changed`: with `maxCeilingCredits`, more work is waiting than when the run was estimated
and its ceiling is now higher. Nothing was held: ask for the estimate again and show it.
- `503 service_unavailable` with `Retry-After`: the agent work settings or the credits could not be read,
or Kenso could not confirm the run was created.

Open to any workspace member except a Client seat, and never to an API key held to a permission template.

Needs the `agent_sandboxes` feature on your workspace. Until it is on, calls answer 404. Needs the `agent_work` feature on your workspace. Until it is on, calls answer 404.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/agent-sandbox-runs/POST/v1/agent-sandbox-runs)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |
| `Idempotency-Key` | header | string | no | A unique value, such as a UUID, that makes a retry safe. Send the same key when you retry. For 24 hours, a repeat of the same request with the same key gets the first response again, with the `Idempotent-Replayed: true` header, and Kenso does not run the action twice. The same key with a different request answers `422 idempotency_key_reused`. Keys are per workspace and at most 200 characters long. A repeat sent while the first request is still running can get `503 service_unavailable` with `Retry-After`. Retry it with the same key. Kenso does not store a `5xx` response, so a retry after one runs the action again. It does not store a `408`, a `429` or another `4xx` that carries `Retry-After` either: retry with the same key after that time and Kenso runs the action again. |

### Request body

`application/json`, optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agent` | string | no | `claude`, `codex`, `antigravity`, `opencode`, `grok` or `cursor`: an agent you connected. |
| `campaignId` | integer (int64) | no | Only this campaign's work. The campaign must be the workspace's. Left out: the whole workspace. |
| `kinds` | array of string | no | Only these kinds of agent work (`meeting_brief`, `call_brief`, `workflow_prompt`, `qualification`, `segmentation`, `personalization`, `rewriting`, `background_ai`); left out for every kind on My agent. |
| `estimateOnly` | boolean | no | True: answer with the estimate only and create nothing. |
| `maxCeilingCredits` | number (double) | no | The `estimate.ceilingCredits` the person was shown. When the ceiling is now higher, the start is 409 `estimate_changed` and holds nothing: show the new estimate. Left out: no check. |

### Response 200

Also answers `202`. `data` is a `AgentSandboxRunEstimateOnly`.

| Field | Type | Description |
| --- | --- | --- |
| `estimate` | AgentSandboxEstimate | What a run is expected to take and the most it can cost. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/agent-sandbox-runs" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
  "agent": "claude",
  "campaignId": 812,
  "kinds": [
    "string"
  ],
  "estimateOnly": true,
  "maxCeilingCredits": 0.5
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "estimate": {
      "waitingItems": 1,
      "expectedMinutes": 1,
      "ceilingMinutes": 1,
      "ceilingCredits": 0.5,
      "creditsPerHour": 0.5
    }
  }
}
```

## Get a sandbox run

`GET /v1/agent-sandbox-runs/{runId}` - operationId `agent-sandbox-runs.get`

| Permission | Rate limit |
| --- | --- |
| Any workspace member except a Network member | 12,000 requests a minute per API key |

One of your runs with its progress: `accepted` and `rejected` answers so far, `waiting` items still
waiting in its scope, `minutes` and `credits` so far (the billed ones once it ended). Poll it every few
seconds while `status` is not `ended`.

Errors:

- `404 not_found`: no run of yours with this id in the workspace, or a feature is off.
- `503 service_unavailable` with `Retry-After`: the agent work settings could not be read.

Needs the `agent_sandboxes` feature on your workspace. Until it is on, calls answer 404. Needs the `agent_work` feature on your workspace. Until it is on, calls answer 404.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/agent-sandbox-runs/GET/v1/agent-sandbox-runs/%7BrunId%7D)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `runId` | path | string | yes | The run's id, `asr_...`. |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Response 200

`data` is a `AgentSandboxRun`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | `asr_` and 32 lowercase hex characters. |
| `agent` | string | The agent the run uses: `claude`, `codex`, `antigravity`, `opencode`, `grok` or `cursor`. |
| `status` | string | `queued`, `starting`, `running`, `stopping` or `ended`. |
| `endReason` | string | Why it ended (`queue_empty`, `stopped`, `usage_limit`, `max_length`, `credits_used`, `agent_logged_out`, `answer_refused` or `failed`), set once it is `stopping`; null before. |
| `trigger` | string | `manual` or `automatic`. |
| `campaignId` | integer (int64) | The campaign it works, or null: a run without a campaign covers the whole workspace. |
| `kinds` | array of string | The kinds it works, or null for every kind the workspace has on My agent. |
| `createdAt` | string (date-time) |  |
| `startedAt` | string (date-time) |  |
| `endedAt` | string (date-time) |  |
| `stopRequestedAt` | string (date-time) | When the person asked to stop the run (cancel); null until then. The status changes on the run supervisor's next pass. |
| `accepted` | integer (int32) | Answers accepted so far. |
| `rejected` | integer (int32) | Answers rejected so far. |
| `waiting` | integer (int32) | Items in the run's scope still waiting now; 0 once it ended. |
| `minutes` | integer (int32) | Minutes run so far while it is live; the billed minutes once it ended. |
| `credits` | number (double) | Credits for those minutes so far while it is live; the credits charged once it ended. |
| `confinement` | string | `full`, `partial` or `none`, or null until the run reports it. |
| `estimate` | AgentSandboxEstimate | What a run is expected to take and the most it can cost. |

### Request

```bash
curl -X GET "https://api.ken.so/v1/agent-sandbox-runs/asr_2bX9kq4LmR7tW3vY" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"
```

### Example response

```json
{
  "success": true,
  "data": {
    "id": "asr_2bX9kq4LmR7tW3vY",
    "agent": "claude",
    "status": "queued",
    "endReason": "string",
    "trigger": "manual",
    "campaignId": 812,
    "kinds": [
      "string"
    ],
    "createdAt": "2026-09-23T15:02:11Z",
    "startedAt": "2026-09-23T15:02:11Z",
    "endedAt": "2026-09-23T15:02:11Z",
    "stopRequestedAt": "2026-09-23T15:02:11Z",
    "accepted": 1,
    "rejected": 1,
    "waiting": 1,
    "minutes": 1,
    "credits": 0.5,
    "confinement": "full",
    "estimate": {
      "waitingItems": 1,
      "expectedMinutes": 1,
      "ceilingMinutes": 1,
      "ceilingCredits": 0.5,
      "creditsPerHour": 0.5
    }
  }
}
```

## Stop a sandbox run

`POST /v1/agent-sandbox-runs/{runId}/cancel` - operationId `agent-sandbox-runs.cancel`

| Permission | Rate limit |
| --- | --- |
| Any workspace member except a Network member | 4,800 requests a minute per API key |

Asks Kenso to stop the run and answers with it as it reads right after, with `stopRequestedAt` set; its
`status` changes on the next pass of the run supervisor, within about 20 seconds. A queued run then ends
(`endReason` `stopped`) without starting, and nothing is charged. A starting or running run stops: claims
it holds go back to the queue, and the minutes it ran are charged. An ended run comes back as it is. Asking again
is safe.

Errors:

- `404 not_found`: no run of yours with this id in the workspace, or a feature is off.

Needs the `agent_sandboxes` feature on your workspace. Until it is on, calls answer 404. Needs the `agent_work` feature on your workspace. Until it is on, calls answer 404.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/agent-sandbox-runs/POST/v1/agent-sandbox-runs/%7BrunId%7D/cancel)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `runId` | path | string | yes | The run's id, `asr_...`. |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |
| `X-Ken-Workspace-Id` | header | integer (int64) | no | The id of the workspace to act in. Leave it out when your API key reaches only one workspace. When the key reaches more than one, a request without this header answers `400 workspace_required`. A workspace you are not a member of answers `404 not_found`. |

### Response 200

`data` is a `AgentSandboxRun`.

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | `asr_` and 32 lowercase hex characters. |
| `agent` | string | The agent the run uses: `claude`, `codex`, `antigravity`, `opencode`, `grok` or `cursor`. |
| `status` | string | `queued`, `starting`, `running`, `stopping` or `ended`. |
| `endReason` | string | Why it ended (`queue_empty`, `stopped`, `usage_limit`, `max_length`, `credits_used`, `agent_logged_out`, `answer_refused` or `failed`), set once it is `stopping`; null before. |
| `trigger` | string | `manual` or `automatic`. |
| `campaignId` | integer (int64) | The campaign it works, or null: a run without a campaign covers the whole workspace. |
| `kinds` | array of string | The kinds it works, or null for every kind the workspace has on My agent. |
| `createdAt` | string (date-time) |  |
| `startedAt` | string (date-time) |  |
| `endedAt` | string (date-time) |  |
| `stopRequestedAt` | string (date-time) | When the person asked to stop the run (cancel); null until then. The status changes on the run supervisor's next pass. |
| `accepted` | integer (int32) | Answers accepted so far. |
| `rejected` | integer (int32) | Answers rejected so far. |
| `waiting` | integer (int32) | Items in the run's scope still waiting now; 0 once it ended. |
| `minutes` | integer (int32) | Minutes run so far while it is live; the billed minutes once it ended. |
| `credits` | number (double) | Credits for those minutes so far while it is live; the credits charged once it ended. |
| `confinement` | string | `full`, `partial` or `none`, or null until the run reports it. |
| `estimate` | AgentSandboxEstimate | What a run is expected to take and the most it can cost. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/agent-sandbox-runs/asr_2bX9kq4LmR7tW3vY/cancel" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "X-Ken-Workspace-Id: $KENSO_WORKSPACE_ID"
```

### Example response

```json
{
  "success": true,
  "data": {
    "id": "asr_2bX9kq4LmR7tW3vY",
    "agent": "claude",
    "status": "queued",
    "endReason": "string",
    "trigger": "manual",
    "campaignId": 812,
    "kinds": [
      "string"
    ],
    "createdAt": "2026-09-23T15:02:11Z",
    "startedAt": "2026-09-23T15:02:11Z",
    "endedAt": "2026-09-23T15:02:11Z",
    "stopRequestedAt": "2026-09-23T15:02:11Z",
    "accepted": 1,
    "rejected": 1,
    "waiting": 1,
    "minutes": 1,
    "credits": 0.5,
    "confinement": "full",
    "estimate": {
      "waitingItems": 1,
      "expectedMinutes": 1,
      "ceilingMinutes": 1,
      "ceilingCredits": 0.5,
      "creditsPerHour": 0.5
    }
  }
}
```

## Types

Each named type the tables above use, nested ones included.

### AgentSandboxEstimate

What a run is expected to take and the most it can cost.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `waitingItems` | integer (int32) | no | The items the run would work: waiting now, or for a stored run, answered plus waiting plus held. |
| `expectedMinutes` | integer (int32) | no | Minutes the run is expected to take. |
| `ceilingMinutes` | integer (int32) | no | Minutes the run is stopped at. |
| `ceilingCredits` | number (double) | no | The most the run can cost, in credits: the hold taken when it starts. |
| `creditsPerHour` | number (double) | no | Credits an hour of box time costs. |

All resources: [/docs.md](/docs.md).
