Skip to content
Open Console

Start a run

2 min readUpdated

POST/v1/sessions/{session_id}/runs

Start one run inside an existing session. The session serializes its runs. idempotency_key is scoped to the session and prevents a retry from starting a second run; a request without a key always creates a new run. By default the endpoint returns 202 Accepted with the admitted run; set Accept: text/event-stream or add ?stream=true to stream immediately, or reconnect later through the run’s events endpoint.

Generated from the Platform API specification on 2026-09-04.

Parameter Type Description
session_id string The session, as returned by Create a session.
Parameter Type Description
stream boolean Stream the run’s events instead of returning the admitted run.
Header Required Description
Authorization yes Bearer plus a short-lived OAuth access token issued for the Tanomis API audience. Backends obtain tokens with an organization automation client; the CLI’s human login is not an application credential.
X-Organization-ID yes The organization_id from the workspace projection you selected in GET /v1/me/workspaces.
X-Workspace-Tenant-ID yes The nested tenant_id from the same projection. A header cannot widen what the token grants. Some single-workspace or self-hosted environments take X-Tenant-ID instead, as supplied by their administrator.
Field Type Required Description
input object required Passed to the agent as JSON. The shape is defined by your agent’s entrypoint.
idempotency_key string optional Scoped to the session; a retry with the same key returns the original run. At most 255 bytes.
attachments array optional Files prepared and uploaded in this session, as { "file_id": ... } objects.
work object optional Settlement-mode agents only. Send either subject (open new work) or work_id (continue work opened by an earlier session).
work.subject string optional Opens new work, for example invoice:INV-1842.
work.work_id string optional Continues work opened by an earlier session.
work.contract_ref string optional Sent together with contract_version when opening work. Cannot be added or changed later.
work.contract_version string optional Sent together with contract_ref.
Status Meaning
200 With streaming requested: the run’s server-sent event stream.
202 The run was admitted. Poll it or open the event stream.
404 No such session in the selected tenant.
409 The idempotency key matched a run with a different body, or the session cannot admit a run.
Terminal
curl -X POST "https://api.tanomis.com/v1/sessions/ses_7d4f9c/runs" \
-H "Authorization: Bearer $TANOMIS_TOKEN" \
-H "X-Organization-ID: $TANOMIS_ORG" \
-H "X-Workspace-Tenant-ID: $TANOMIS_WORKSPACE" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "Draft a concise reply for the customer."
},
"idempotency_key": "support-case-1842-reply-1"
}'
202 Accepted
{
"id": "run_a12bc3",
"session_id": "ses_7d4f9c",
"status": "running",
"started_at": "2026-09-02T11:43:02Z"
}

Reference files that were prepared and uploaded in this session (see Prepare a file) when starting the run.

Request
{
"input": {
"prompt": "Summarize the attached case."
},
"attachments": [
{
"file_id": "file_b172c9"
}
],
"idempotency_key": "case-summary-run-v1"
}

For a settlement-mode agent, the first run in a new session must declare the work it serves. Use work.subject to open new work, or work.work_id to continue work opened by an earlier session; send either, never both. When opening work, contract_ref and contract_version may establish a contract and must be sent together. Later requests may omit the contract or restate that exact pair, but cannot add or change it. The admitted run includes settlement_work_id; store it if another session may need to continue the same work. Standard-mode agents do not require a work object. Durable work and settlement are tenant capabilities: for a version in settlement mode, an unavailable settlement boundary fails session activation rather than silently running without it.

Request
{
"input": {
"prompt": "Reconcile invoice INV-1842."
},
"work": {
"subject": "invoice:INV-1842",
"contract_ref": "billing/reconciliation",
"contract_version": "2026-09"
},
"idempotency_key": "invoice-1842-attempt-1"
}
Response
{
"id": "run_a12bc3",
"session_id": "ses_7d4f9c",
"status": "running",
"started_at": "2026-09-02T11:43:02Z",
"settlement_work_id": "work_f61ca9"
}