Agent sandbox runs
The Agent sandbox runs endpoints of the Kenso API.
List your sandbox runs
/v1/agent-sandbox-runsagent-sandbox-runs.listNeeds 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.
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.
Parameters
nextCursor, unchanged, with the same active.YYYY-MM-DD form. 1.1 is another name for the first dated version. 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 date that is not a version answers 400 unsupported_version; any other value that is not a version is treated as legacy.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.
asr_ and 32 lowercase hex characters.claude, codex, antigravity, opencode, grok or cursor.queued, starting, running, stopping or ended.queue_empty, stopped, usage_limit, max_length, credits_used, agent_logged_out, answer_refused or failed), set once it is stopping; null before.manual or automatic.full, partial or none, or null until the run reports it.curl -X GET "https://api.ken.so/v1/agent-sandbox-runs?limit=1" \ -H "Authorization: Bearer $KEN_API_KEY" \ -H "Ken-Version: 1.1" \ -H "X-Ken-Workspace-Id: $KEN_WORKSPACE_ID"
{
"success": true,
"data": [
{
"id": "string",
"agent": "string",
"status": "string",
"endReason": "string",
"trigger": "string",
"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": "string",
"estimate": {
"waitingItems": 1,
"expectedMinutes": 1,
"ceilingMinutes": 1,
"ceilingCredits": 0.5,
"creditsPerHour": 0.5
}
}
],
"pagination": {
"nextCursor": "eyJpZCI6ODE1fQ",
"hasMore": true,
"total": 1,
"isTotalCapped": true
}
}Estimate or start a sandbox run
/v1/agent-sandbox-runsagent-sandbox-runs.createNeeds 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.
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.
Parameters
YYYY-MM-DD form. 1.1 is another name for the first dated version. 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 date that is not a version answers 400 unsupported_version; any other value that is not a version is treated as legacy.400 workspace_required. A workspace you are not a member of answers 404 not_found.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.Request body
application/json, optional.
claude, codex, antigravity, opencode, grok or cursor: an agent you connected.meeting_brief, call_brief, workflow_prompt, qualification, segmentation, personalization, rewriting); left out for every kind on My agent.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.
curl -X POST "https://api.ken.so/v1/agent-sandbox-runs" \
-H "Authorization: Bearer $KEN_API_KEY" \
-H "Ken-Version: 1.1" \
-H "X-Ken-Workspace-Id: $KEN_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"agent": "string",
"campaignId": 812,
"kinds": [
"string"
],
"estimateOnly": true,
"maxCeilingCredits": 0.5
}'{
"success": true,
"data": {
"estimate": {
"waitingItems": 1,
"expectedMinutes": 1,
"ceilingMinutes": 1,
"ceilingCredits": 0.5,
"creditsPerHour": 0.5
}
}
}Get a sandbox run
/v1/agent-sandbox-runs/{runId}agent-sandbox-runs.getNeeds 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.
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.
Parameters
asr_....YYYY-MM-DD form. 1.1 is another name for the first dated version. 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 date that is not a version answers 400 unsupported_version; any other value that is not a version is treated as legacy.400 workspace_required. A workspace you are not a member of answers 404 not_found.Response 200
data is a AgentSandboxRun.
asr_ and 32 lowercase hex characters.claude, codex, antigravity, opencode, grok or cursor.queued, starting, running, stopping or ended.queue_empty, stopped, usage_limit, max_length, credits_used, agent_logged_out, answer_refused or failed), set once it is stopping; null before.manual or automatic.full, partial or none, or null until the run reports it.curl -X GET "https://api.ken.so/v1/agent-sandbox-runs/string" \ -H "Authorization: Bearer $KEN_API_KEY" \ -H "Ken-Version: 1.1" \ -H "X-Ken-Workspace-Id: $KEN_WORKSPACE_ID"
{
"success": true,
"data": {
"id": "string",
"agent": "string",
"status": "string",
"endReason": "string",
"trigger": "string",
"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": "string",
"estimate": {
"waitingItems": 1,
"expectedMinutes": 1,
"ceilingMinutes": 1,
"ceilingCredits": 0.5,
"creditsPerHour": 0.5
}
}
}Stop a sandbox run
/v1/agent-sandbox-runs/{runId}/cancelagent-sandbox-runs.cancelNeeds 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.
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.
Parameters
asr_....YYYY-MM-DD form. 1.1 is another name for the first dated version. 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 date that is not a version answers 400 unsupported_version; any other value that is not a version is treated as legacy.400 workspace_required. A workspace you are not a member of answers 404 not_found.Response 200
data is a AgentSandboxRun.
asr_ and 32 lowercase hex characters.claude, codex, antigravity, opencode, grok or cursor.queued, starting, running, stopping or ended.queue_empty, stopped, usage_limit, max_length, credits_used, agent_logged_out, answer_refused or failed), set once it is stopping; null before.manual or automatic.full, partial or none, or null until the run reports it.curl -X POST "https://api.ken.so/v1/agent-sandbox-runs/string/cancel" \ -H "Authorization: Bearer $KEN_API_KEY" \ -H "Ken-Version: 1.1" \ -H "X-Ken-Workspace-Id: $KEN_WORKSPACE_ID"
{
"success": true,
"data": {
"id": "string",
"agent": "string",
"status": "string",
"endReason": "string",
"trigger": "string",
"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": "string",
"estimate": {
"waitingItems": 1,
"expectedMinutes": 1,
"ceilingMinutes": 1,
"ceilingCredits": 0.5,
"creditsPerHour": 0.5
}
}
}