Skip to content
Documentation menu

Runs and conversations

Run an agent once, stream its answer, drive long tool-using runs as resumable jobs, and keep multi-turn conversations with message history.

A run sends a prompt to an agent, lets it answer under the workspace's policy, and records what happened on a run receipt. This page covers four ways to run: one request that returns the finished answer, the same run streamed as server-sent events, a resumable job for agents that work in connected systems and may wait for human approval, and conversations that keep message history between turns. Run an agent explains when to use each, and Worked examples has complete scripts for a job, a stream and a conversation.

Starting or continuing a run needs an API key with the run scope or a signed-in session; see Authentication. Reading job status and conversations needs read, and creating or deleting a conversation needs admin. Each run is checked against policy, the agent's status and the spend budget before any model call. A refused run is not an HTTP error: the response reports decision as deny with a reasonCode, and the refusal is written to a run receipt like a completed run. Run starts count against the run rate limit.

Send the header X-CoA-Model-Request: <milliseconds>.<uuid> with every POST /api/run, every POST /api/run/stream and every conversation turn: the current Unix time in milliseconds (13 digits), a dot, and a UUID you generate for that request. It identifies the request for usage accounting. A request without it can be refused before any model call: POST /api/run and conversation turns then answer 503 with the code model_usage_request_identity_required. A value that is malformed, more than 24 hours old or more than a minute ahead of the server clock is not accepted either: the request is refused, or the run ends as a denied run, without a model call. Use a new value for each run, stream or turn you start, and send the same value again only when you resend that same request; see Retry safely. A job does not use the header: POST /api/run/job ignores it both when you start a job and when you continue one, because a job's usage is accounted to the job itself. Activated agents need two more headers, described under Run an agent below.

Run an agent

New agents are under managed activation: the agent object reports grantLifecycle as managed, and the agent runs only from a version that a workspace admin has reviewed and activated. Launching an agent that has such an active version, an activated agent, takes two calls with the same credential. First request a launch ticket with POST /api/agent-runtime/ticket (described under Launch tickets in the Agents reference), sending the header X-CoA-Agent-Protocol: agent-active-grants/1 and the body { agentId, purpose, nonce, request }, where purpose names the operation you are about to call (run, run_stream, run_job or conversation), nonce is a new UUID and request is the exact JSON body you are about to send. Then send that body with the same protocol header plus X-CoA-Agent-Ticket set to the returned ticketId. A ticket expires ten minutes after it is issued if it is not used, is bound to the agent, the operation and the request body, and starts exactly one run: repeating a request whose ticket was already used answers 200 with the JSON body { replayed: true, root: { id, status } } and does not run the agent again. The response to a launched run carries an X-CoA-Agent-Root header that identifies the run. Runs without an agent need neither header. An agent that is not under managed activation (grantLifecycle is legacy_unadopted) gets no launch ticket, so run it without the two headers: a request that sends the protocol header for it is refused with 409 agent_adoption_required. It runs that way as long as the workspace has not made managed activation mandatory for all of its agents. Where the workspace has, a request without the protocol header is refused with 426 agent_protocol_required, so such an agent cannot run at all until a workspace admin adopts it. See Adopt agents created before activation.

POST /api/run

Run an agent once and return the finished answer

Runs the prompt and responds when the agent has finished; the request can take up to 60 seconds. An agent with connections can call its tools for up to five model rounds, and every tool call is decided on its own before it is sent. This operation cannot wait for human approval: a tool call that needs approval is refused while the rest of the run continues, and the response names the refused tools in approvalRequired. Use POST /api/run/job for agents whose actions need approval or more time.

Access: API key with the run scope, or a signed-in workspace member. An activated agent also needs the launch headers X-CoA-Agent-Protocol and X-CoA-Agent-Ticket.

Request headers
NameTypeDescription
X-CoA-Model-RequeststringThe current Unix time in milliseconds (13 digits), a dot and a UUID that you generate, for example 1795857400000.5f0c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11; it identifies the request for usage accounting. Send it on every request: without it a run that reaches a model call is refused with 503 model_usage_request_identity_required before the model is called, and a malformed value or one more than 24 hours old is not accepted either. Use one value per intended run and keep it when you send the same request again; see The usage-request header.
X-CoA-Agent-Protocol"agent-active-grants/1"Required when the agent is under managed activation (grantLifecycle is managed): without it the request is refused with 426 agent_protocol_required. For an agent that is not under managed activation, sending it gets 409 agent_adoption_required; a run without agentId ignores it. See Launch tickets.
X-CoA-Agent-TicketuuidThe ticketId returned by POST /api/agent-runtime/ticket for this exact body, with purpose set to run. Required when the agent is under managed activation: with the protocol header but without a ticket, the request is refused with 428 agent_launch_required. A ticket starts one run; see Launch tickets.
Request body
NameTypeDescription
prompt requiredstringThe instruction or question for the agent. It must contain more than whitespace.
agentIduuidThe agent to run. When omitted, the prompt runs without an agent: no agent instructions, skills, knowledge or connections apply.
modelstringModel id for this run. Defaults to the agent's configured model, then the workspace default model. For an activated agent the model must be one that its active version allows; otherwise the run is refused.

Returns: 200 with { output, reasonCode, decision, receipt }. decision is allow or deny; a denied run has an empty output, and detail explains a budget or model-call refusal. Runs that used connections add toolLog, connectionsUsed, toolsAvailable and errors, plus approvalRequired and detail when a tool call needed approval. receipt is the run receipt as first written: its assuranceTier and evidenceClass are recorded immediately afterwards and appear when the receipt is read later. A repeated request whose launch ticket was already used does not run again: it answers 200 with the JSON body { replayed: true, root: { id, status } }.

Errors
StatusCodeWhen
400missing_promptprompt is missing, not a string, or only whitespace.
404not_foundagentId does not match an agent in the workspace. The code is agent_not_found when the request carries the X-CoA-Agent-Protocol header.
400no_model_keyThe workspace has no model provider key saved in Settings.
400no_modelNo model was given, the agent has none, and the workspace has no default model.
400batch_model_not_supportedThe selected model is a batch-only model, which cannot be used for a live run.
426agent_protocol_requiredThe agent must be launched with the X-CoA-Agent-Protocol header and the header is missing.
428agent_launch_requiredThe protocol header is present but X-CoA-Agent-Ticket is missing.
409agent_admission_unavailableThe agent has no active version, is paused or revoked, or the ticket has expired or does not match this agent, operation and request body.
409agent_adoption_requiredThe protocol header was sent for an agent that is not under managed activation.
402spend_reservation_refusedThe budget reservation for the model call was refused. The model was not called.
409spend_reservation_refusedThe budget state changed, conflicted or expired while the run was being admitted. The model was not called.
503spend_reservation_refusedThe budget state cannot be verified right now. The model was not called.
500model_call_failedThe call to the model provider failed. The body carries detail and evidence; do not assume the call was not made.
503model_usage_request_identity_requiredThe request has no X-CoA-Model-Request header. The model was not called.
Request
curl https://centerofagentic.com/api/run \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-CoA-Model-Request: $(date +%s)000.$(uuidgen)" \
  -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
  -H "X-CoA-Agent-Ticket: $COA_LAUNCH_TICKET" \
  -d '{"agentId":"7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37","prompt":"Which supplier contracts renew next quarter?"}'
Response
{
  "output": "Three contracts renew next quarter. The largest is the logistics agreement.",
  "reasonCode": "ALLOWED",
  "decision": "allow",
  "receipt": {
    "id": "b84d1f02-6c3a-4e19-a7d5-2f0c9e3b6a48",
    "agentId": "7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37",
    "agentName": null,
    "userId": "api-key:5b0e7c2a-9d14-4f6b-8a3e-2c1d0f9e8b77",
    "prompt": "Which supplier contracts renew next quarter?",
    "output": "Three contracts renew next quarter. The largest is the logistics agreement.",
    "model": "openai/gpt-4o-mini",
    "runtimeMode": "hybrid",
    "decision": {
      "action": "recommend",
      "object": { "dataClass": "internal" },
      "placement_requested": "cloud_model",
      "evaluated_at": "2026-11-20T09:14:02.118Z",
      "policy_bundle_id": "tenant-policy-7c1d2e3f",
      "decision": "allow",
      "reason_code": "ALLOWED",
      "applicable_allowlist_layers": ["tenant_admin", "package_manifest", "role_team", "user_identity"],
      "allow_rules_matched": ["allow_tenant_admin_1", "allow_package_manifest_2", "allow_role_team_3", "allow_user_identity_4"],
      "allowlist_layers_missing_grant": [],
      "deny_rules_matched": [],
      "obligations": [
        { "kind": "logging", "layer": "law_regulation", "ruleId": "obl_logging_8", "reason": "audit_all_runs" },
        { "kind": "confidence_label", "layer": "package_manifest", "ruleId": "obl_confidence_label_9", "reason": "label_confidence" }
      ],
      "surviving_placements": ["local", "cloud_model", "cloud_connector", "cloud_connector_write"]
    },
    "policyResults": [
      { "policy": "tenant-policy-7c1d2e3f applied", "result": "passed" },
      { "policy": "logging", "result": "passed" },
      { "policy": "confidence_label", "result": "passed" }
    ],
    "placements": ["local", "cloud_model", "cloud_connector", "cloud_connector_write"],
    "promptTokens": 412,
    "completionTokens": 96,
    "costUsd": 0.00012,
    "latencyMs": 1840,
    "guardrailsPassed": true,
    "rawUploaded": false,
    "toolLog": [],
    "connectionsUsed": [],
    "steps": [
      {
        "step_id": "policy",
        "kind": "policy_decision",
        "label": "Authority & placement check",
        "status": "ok",
        "placement": "local",
        "reason_code": "ALLOWED",
        "policy": {
          "decision": "allow",
          "reason_code": "ALLOWED",
          "deny_rules_matched": [],
          "obligations": [
            { "kind": "logging", "layer": "law_regulation", "ruleId": "obl_logging_8", "reason": "audit_all_runs" },
            { "kind": "confidence_label", "layer": "package_manifest", "ruleId": "obl_confidence_label_9", "reason": "label_confidence" }
          ]
        },
        "seq": 0
      },
      {
        "step_id": "model-d17a5c3e-8b40-4f92-a6c1-9e0f2b4d7a85",
        "seq": 1,
        "kind": "model_call",
        "placement": "cloud_model",
        "label": "Cloud reasoning turn",
        "status": "ok",
        "started_at": "2026-11-20T09:14:02.305Z",
        "evidence": {
          "decisionId": "d17a5c3e-8b40-4f92-a6c1-9e0f2b4d7a85",
          "operationDigest": "4b1e0c7a9d2f63580e1a7c4d9b20f6e35a8c1d7e0f92b4a6c3d5e8f10a2b7c94",
          "dispatch": "recorded",
          "invoked": true,
          "outcome": "ok",
          "recording": "complete",
          "reconciliationId": null,
          "startedAt": "2026-11-20T09:14:02.305Z",
          "tokens": { "input": 412, "output": 96 },
          "costUsd": 0.00012
        },
        "tokens": { "input": 412, "output": 96 },
        "cost": { "amount": 0.00012 }
      }
    ],
    "assistant": null,
    "assuranceTier": null,
    "evidenceClass": null,
    "signatureStatus": null,
    "flagged": false,
    "evidenceIncomplete": false,
    "reconciliationIds": [],
    "createdAt": "2026-11-20T09:14:04.151Z"
  }
}

Stream a run

The streaming operation applies the same checks and writes the same receipt as POST /api/run, but returns the answer while it is produced. The response has the content type text/event-stream; each event is an event: line with the event name, a data: line with one JSON object, and a blank line, for example event: delta followed by data: {"text":"Three contracts renew"}. Problems found before the run starts (a missing prompt, an unknown agent, a missing model key, a rate limit, a missing launch ticket) are returned as ordinary JSON errors, and a request whose launch ticket was already used answers 200 with the JSON replay body instead of a stream, so check the status code and the content type before reading events. The connection closes after done or error; if it closes without either, treat the outcome of the run as unknown.

POST /api/run/stream

Run an agent once and stream the answer as server-sent events

Takes the same body as POST /api/run. For an agent with connections the tool rounds run first and the whole answer arrives in a single delta event. A run that policy refuses produces meta with decision set to deny, followed by done with an empty output and the receipt. Always send the X-CoA-Model-Request header: on this operation a request without it is not answered with 503; the stream can open, send meta and then close without done or error.

Access: API key with the run scope, or a signed-in workspace member. An activated agent also needs the launch headers X-CoA-Agent-Protocol and X-CoA-Agent-Ticket, with the ticket's purpose set to run_stream.

Request headers
NameTypeDescription
X-CoA-Model-RequeststringThe current Unix time in milliseconds (13 digits), a dot and a UUID that you generate; it identifies the request for usage accounting. Send it on every request: without it this operation does not answer with an error status; the stream can open, send meta and then stall or close without done or error, and no model is called. Use one value per intended run and keep it when you send the same request again; see The usage-request header.
X-CoA-Agent-Protocol"agent-active-grants/1"Required when the agent is under managed activation (grantLifecycle is managed): without it the request is refused with 426 agent_protocol_required. For an agent that is not under managed activation, sending it gets 409 agent_adoption_required; a run without agentId ignores it. See Launch tickets.
X-CoA-Agent-TicketuuidThe ticketId returned by POST /api/agent-runtime/ticket for this exact body, with purpose set to run_stream. Required when the agent is under managed activation: with the protocol header but without a ticket, the request is refused with 428 agent_launch_required. A ticket starts one run; see Launch tickets.
Request body
NameTypeDescription
prompt requiredstringThe instruction or question for the agent. It must contain more than whitespace.
agentIduuidThe agent to run. When omitted, the prompt runs without an agent.
modelstringModel id for this run. Defaults to the agent's configured model, then the workspace default model.

Returns: A text/event-stream response with four event types. meta is sent first: { decision, reasonCode, model }. delta is sent zero or more times: { text }, the next fragment of the answer. done is sent last on a completed or refused run: { output, receipt }, where receipt has the shape shown for POST /api/run, plus decision, reasonCode and detail when the run was refused after the stream opened, and approvalRequired and detail when tool calls needed approval. error is sent last on a failure: an object with detail and, where available, error (a code such as spend_reservation_refused or batch_model_not_supported) and evidence. A repeated request whose launch ticket was already used is not streamed: it answers 200 with the JSON body { replayed: true, root: { id, status } }.

Errors
StatusCodeWhen
400missing_promptprompt is missing, not a string, or only whitespace.
404not_foundagentId does not match an agent in the workspace. The code is agent_not_found when the request carries the X-CoA-Agent-Protocol header.
400no_model_keyThe workspace has no model provider key saved in Settings.
400no_modelNo model was given, the agent has none, and the workspace has no default model.
426agent_protocol_requiredThe agent must be launched with the X-CoA-Agent-Protocol header and the header is missing.
428agent_launch_requiredThe agent needs a launch ticket and X-CoA-Agent-Ticket is missing.
409agent_admission_unavailableThe agent has no active version, is paused or revoked, or the ticket has expired or does not match this agent, operation and request body.
409agent_adoption_requiredThe protocol header was sent for an agent that is not under managed activation.
Request
curl -N https://centerofagentic.com/api/run/stream \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-CoA-Model-Request: $(date +%s)000.$(uuidgen)" \
  -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
  -H "X-CoA-Agent-Ticket: $COA_LAUNCH_TICKET" \
  -d '{"agentId":"7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37","prompt":"Which supplier contracts renew next quarter?"}'

Resumable runs

A job, called a background job in the guides, is a run that spans several requests. Use it for agents that work in connected systems: the run can take more tool rounds than fit in one request (up to ten in total), and it can stop and wait when a tool call needs human approval. Each toolLog entry describes one tool call: tool, connection, ok, detail (the connected system's response or the reason for a refusal, shortened), outcome (authorized, pending or denied), reasonCode, placement and decisionId; entries can carry further evidence fields such as modelDecisionId, dispatchRecorded and evidence. A held job that is not approved before its approval window ends is closed with the error APPROVAL_EXPIRED, and its held actions are not executed.

POST /api/run/job

Start a resumable run, or continue one step by step

Send { agentId, prompt } to start a job and { jobId } to continue it. Each request advances the run by one time-boxed step of up to 60 seconds and returns its current status; keep sending { jobId } while the status is running. When a tool call needs human approval the job stops at pending_approval and names the held tools in heldActions; once the approval is resolved, continue with the same jobId. Only one request advances a job at a time, so parallel requests cannot repeat a tool call.

Access: API key with the run scope, or a signed-in workspace member. A job can be continued only by the credential that started it, or by a workspace admin signed in to the web workspace. Starting a job for an activated agent needs the launch headers with purpose set to run_job; continuing it needs only the X-CoA-Agent-Protocol header. For such an agent the jobId is the same value as the X-CoA-Agent-Root response header, and as root.id when a repeated start is answered with the replay body.

Request headers
NameTypeDescription
X-CoA-Agent-Protocol"agent-active-grants/1"Required to start and to continue a job when the agent is under managed activation (grantLifecycle is managed): without it the request is refused with 426 agent_protocol_required. For an agent that is not under managed activation, sending it gets 409 agent_adoption_required. See Launch tickets.
X-CoA-Agent-TicketuuidThe ticketId returned by POST /api/agent-runtime/ticket for the exact start body, with purpose set to run_job. Required to start a job when the agent is under managed activation: with the protocol header but without a ticket, the start is refused with 428 agent_launch_required. Continuing a job with { jobId } needs no ticket; see Launch tickets.
Request body
NameTypeDescription
agentIduuidRequired to start a job. The agent to run; it must have at least one connection, unless it runs with Deep Agents delegation.
promptstringRequired to start a job. The instruction for the agent; it must contain more than whitespace.
jobIduuidThe job to continue. When present, the request continues that job and agentId and prompt are ignored.

Returns: 200 with the job state { jobId, status, output, rounds, chunks, toolLog }. status is running (send { jobId } again), pending_approval, done or error; an error response always has jobId, status and error, and adds reasonCode, detail and the other fields where known. The response of the step that reaches a state carries more: heldActions when the job stops for approval (the held tool names as they were offered to the model, with a connection prefix such as c0__), and receipt, connectionsUsed and errors when it finishes. Asking again for a job that is waiting for approval or has ended returns only { jobId, status, output, rounds, chunks, toolLog, error }, so keep the receipt from the response that finishes the job. A run that is refused before it starts creates no job: the response is { status, decision, reasonCode, output, receipt } with status set to done, decision set to deny and no jobId. Deep Agents runs add rootJobId, activeLeafId, tree, treeBudget and, once ended, terminal, and can also report the status reconciliation_required. A repeated start whose launch ticket was already used does not start another job: it answers 200 with the JSON body { replayed: true, root: { id, status } }.

Errors
StatusCodeWhen
400missing_promptStarting a job without a prompt.
400missing_agentStarting a job without an agentId.
400no_connectionsThe agent has no connections and does not use delegation. Use POST /api/run for such an agent.
404not_foundagentId does not match an agent in the workspace. The code is agent_not_found when the request carries the X-CoA-Agent-Protocol header.
404run_not_foundjobId does not match a job in the workspace.
403run_access_deniedThe job was started by another credential and the caller is not a workspace admin signed in to the web workspace.
400no_model_keyThe workspace has no model provider key saved in Settings.
400no_modelThe agent has no model and the workspace has no default model.
409tree_runtime_unavailableThe agent's active version enables Deep Agents delegation, but the delegation runtime is not switched on. It is a platform-wide switch that Center of Agentic controls.
426agent_protocol_requiredThe agent must be launched with the X-CoA-Agent-Protocol header and the header is missing.
428agent_launch_requiredStarting a job for an agent that needs a launch ticket without X-CoA-Agent-Ticket.
409agent_admission_unavailableThe agent has no active version, is paused or revoked, or the ticket has expired or does not match this agent, operation and request body.
409agent_adoption_requiredThe protocol header was sent for an agent that is not under managed activation.
Request
# Start a job
curl https://centerofagentic.com/api/run/job \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
  -H "X-CoA-Agent-Ticket: $COA_LAUNCH_TICKET" \
  -d '{"agentId":"7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37","prompt":"Draft the renewal reminder email for the logistics agreement."}'

# Continue it until the status is done, error or pending_approval
curl https://centerofagentic.com/api/run/job \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
  -d '{"jobId":"9c2b7e41-3d5a-4f80-b6e2-1a0d9c8b7f36"}'
Response
{
  "jobId": "9c2b7e41-3d5a-4f80-b6e2-1a0d9c8b7f36",
  "status": "pending_approval",
  "output": null,
  "rounds": 2,
  "chunks": 1,
  "heldActions": ["c0__create_email"],
  "toolLog": [
    {
      "tool": "create_email",
      "connection": "Marketing Cloud EU",
      "ok": false,
      "detail": "Held until approval is given.",
      "decisionId": "a3e81b56-2c7d-4f09-9b14-6d5e0c8f7a23",
      "outcome": "pending",
      "reasonCode": "APPROVAL_REQUIRED",
      "placement": "cloud_connector_write",
      "modelDecisionId": "e2f4a6c8-1b3d-4e5f-8a7b-9c0d1e2f3a4b"
    }
  ]
}

GET /api/run/job

Get the status of a resumable run

Returns the stored status of a job without advancing it. managed tells you whether continuing the job needs the X-CoA-Agent-Protocol header, and deepAgents whether the job runs with Deep Agents delegation and can be cancelled.

Access: API key with the read scope, or a signed-in workspace member. Only the credential that started the job can read it; a workspace admin signed in to the web workspace can read any job in the workspace.

Query parameters
NameTypeDescription
jobId requireduuidThe job to look up.

Returns: { managed, deepAgents, status, rootId }. status is the stored job status: running, claimed (a step is in progress), blocked_on_child (waiting for a sub-agent job), pending_approval, done or error. rootId identifies the launched run for an agent under managed activation and is null otherwise.

Errors
StatusCodeWhen
404not_foundNo job has this id in the workspace, or the job was started by another credential.
Request
curl "https://centerofagentic.com/api/run/job?jobId=9c2b7e41-3d5a-4f80-b6e2-1a0d9c8b7f36" \
  -H "Authorization: Bearer $COA_API_KEY"
Response
{
  "managed": true,
  "deepAgents": false,
  "status": "pending_approval",
  "rootId": "9c2b7e41-3d5a-4f80-b6e2-1a0d9c8b7f36"
}

POST /api/run/job/cancel

Gated

Stop a Deep Agents run and all of its sub-agent jobs

Status: Gated. Shipped, but closed until a switch described on this page is turned on.

Stops a run that uses Deep Agents delegation, including every sub-agent job that is still in progress; jobId can be the root job or any job of the run. Cancelling prevents further steps but does not undo an action that an external system has already received. It stays available after the agent has been revoked. Jobs without delegation cannot be cancelled with this operation and answer 404.

Access: API key with the run scope, or a signed-in workspace member. Only the credential that started the run, or a workspace admin signed in to the web workspace, can cancel it. It applies to Deep Agents runs only: delegation is off by default, is enabled per agent in a version that a workspace admin has reviewed and activated, and also needs the delegation runtime to be switched on, a platform-wide switch that Center of Agentic controls.

Request body
NameTypeDescription
jobId requireduuidThe root job or any job of the run to stop.

Returns: 200 with the final state of the run: { jobId, rootJobId, status, treeBudget, activeLeafId, tree, output, rounds, toolLog }, plus receipt when the run's receipt is available and terminal, which records how the run ended. A run that was still in progress ends with status set to error and terminal.reason set to cancelled.

Errors
StatusCodeWhen
400job_id_requiredjobId is missing or is not a UUID.
404not_foundThe job does not exist, does not use Deep Agents delegation, or was started by another credential.
Request
curl https://centerofagentic.com/api/run/job/cancel \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jobId":"9c2b7e41-3d5a-4f80-b6e2-1a0d9c8b7f36"}'

Conversations

A conversation stores the messages of a multi-turn exchange, optionally tied to one agent. Conversations are private to the credential that created them: an API key lists, reads, continues and deletes only the conversations created with that same key, and a signed-in person only their own, workspace admins included. Anyone else's conversation answers 404 as if it did not exist. A conversation object is { id, agentId, title, createdAt, updatedAt }; createdAt is an ISO 8601 timestamp, while updatedAt is currently returned as a JavaScript date string, so parse it leniently.

GET /api/conversations

List your 50 most recently updated conversations

Access: API key with the read scope, or a signed-in workspace member. Returns only conversations created with the calling credential.

Returns: { conversations }: an array of at most 50 conversation objects, most recently updated first. There is no paging.

Request
curl https://centerofagentic.com/api/conversations \
  -H "Authorization: Bearer $COA_API_KEY"

POST /api/conversations

Create a conversation

Creates an empty conversation owned by the calling credential. Messages are added by sending turns to POST /api/conversations/{id}/run/stream with the same credential, so an API key that creates conversations needs the admin scope here and then uses its run permission for the turns.

Access: API key with the admin scope, or a signed-in workspace member.

Request body
NameTypeDescription
agentIduuidThe agent that answers in this conversation. When omitted, turns run without an agent, using the workspace default model.
titlestringA label for the conversation. Defaults to New conversation.

Returns: 201 with the new conversation object { id, agentId, title, createdAt, updatedAt }.

Request
curl https://centerofagentic.com/api/conversations \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agentId":"7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37","title":"Contract renewals"}'
Response
{
  "id": "3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
  "agentId": "7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37",
  "title": "Contract renewals",
  "createdAt": "2026-11-20T09:13:40.000Z",
  "updatedAt": "Fri Nov 20 2026 09:13:40 GMT+0000 (Coordinated Universal Time)"
}

GET /api/conversations/{id}

Get a conversation with its messages

Access: API key with the read scope, or a signed-in workspace member. Only the credential that created the conversation can read it.

Path parameters
NameTypeDescription
id requireduuidThe conversation id.

Returns: { conversation, messages }. messages holds every message, oldest first; each is { id, role, content, model, promptTokens, completionTokens, costUsd, latencyMs, decision, reasonCode, createdAt }. role is user or assistant. On assistant messages decision is the policy decision recorded for that turn; the usage fields are null on user messages and on refused turns.

Errors
StatusCodeWhen
404not_foundNo conversation has this id for the calling credential.
Request
curl https://centerofagentic.com/api/conversations/3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11 \
  -H "Authorization: Bearer $COA_API_KEY"
Response
{
  "conversation": {
    "id": "3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11",
    "agentId": "7a2e4c10-5b3f-4d8a-8c66-1e9d0a4b2f37",
    "title": "Contract renewals",
    "createdAt": "2026-11-20T09:13:40.000Z",
    "updatedAt": "Fri Nov 20 2026 09:14:04 GMT+0000 (Coordinated Universal Time)"
  },
  "messages": [
    {
      "id": "0e6b3d58-9f21-4c7a-b1e4-5d2a8c7f9b60",
      "role": "user",
      "content": "Which supplier contracts renew next quarter?",
      "model": null,
      "promptTokens": null,
      "completionTokens": null,
      "costUsd": null,
      "latencyMs": null,
      "decision": null,
      "reasonCode": null,
      "createdAt": "2026-11-20T09:14:02.050Z"
    },
    {
      "id": "c5d09a77-1e42-4b6f-9d03-8a7b6c5d4e21",
      "role": "assistant",
      "content": "Three contracts renew next quarter. The largest is the logistics agreement.",
      "model": "openai/gpt-4o-mini",
      "promptTokens": 412,
      "completionTokens": 96,
      "costUsd": 0.00012,
      "latencyMs": 1840,
      "decision": {
        "action": "recommend",
        "object": { "dataClass": "internal" },
        "placement_requested": "cloud_model",
        "evaluated_at": "2026-11-20T09:14:02.118Z",
        "policy_bundle_id": "tenant-policy-7c1d2e3f",
        "decision": "allow",
        "reason_code": "ALLOWED",
        "applicable_allowlist_layers": ["tenant_admin", "package_manifest", "role_team", "user_identity"],
        "allow_rules_matched": ["allow_tenant_admin_1", "allow_package_manifest_2", "allow_role_team_3", "allow_user_identity_4"],
        "allowlist_layers_missing_grant": [],
        "deny_rules_matched": [],
        "obligations": [
          { "kind": "logging", "layer": "law_regulation", "ruleId": "obl_logging_8", "reason": "audit_all_runs" },
          { "kind": "confidence_label", "layer": "package_manifest", "ruleId": "obl_confidence_label_9", "reason": "label_confidence" }
        ],
        "surviving_placements": ["local", "cloud_model", "cloud_connector", "cloud_connector_write"]
      },
      "reasonCode": "ALLOWED",
      "createdAt": "2026-11-20T09:14:04.151Z"
    }
  ]
}

DELETE /api/conversations/{id}

Delete a conversation and its messages

Deletes the conversation and all of its messages. Run receipts written for its turns are separate records and are not deleted.

Access: API key with the admin scope, or a signed-in workspace member. Only the credential that created the conversation can delete it.

Path parameters
NameTypeDescription
id requireduuidThe conversation id.

Returns: { ok: true }.

Errors
StatusCodeWhen
404not_foundNo conversation has this id for the calling credential.

Conversation turns

A turn adds one user message to a conversation and streams the agent's reply in the event format of POST /api/run/stream. The earlier messages of the conversation are sent to the model as context, and both the user message and the reply are saved. A refused turn is saved as well: its reply is a short assistant message saying that the request was blocked.

POST /api/conversations/{id}/run/stream

Send a message in a conversation and stream the reply

Runs one turn with the conversation's agent and writes a run receipt for it. Sending the same X-CoA-Model-Request value with the same body again does not call the model a second time: a completed reply is returned as a single done event with replayed set to true, and an unfinished one answers 409. A repeat that also reuses its launch ticket is answered before that check, with the JSON replay body instead of a done event; see After a replayed response. For an activated agent, request the launch ticket with purpose set to conversation, parentScope set to the conversation id and request set to this body.

Access: API key with the run scope, or a signed-in workspace member. Only the credential that created the conversation can send turns to it. An activated agent also needs the launch headers X-CoA-Agent-Protocol and X-CoA-Agent-Ticket.

Request headers
NameTypeDescription
X-CoA-Model-RequeststringThe current Unix time in milliseconds (13 digits), a dot and a UUID that you generate; it identifies the turn for usage accounting. Send it on every turn: a turn without it, or with a malformed value, is refused with 503 model_usage_request_identity_required, and nothing is saved or sent to the model. Use one value per intended turn and keep it when you send the same turn again; see The usage-request header.
X-CoA-Agent-Protocol"agent-active-grants/1"Required when the conversation's agent is under managed activation (grantLifecycle is managed): without it the request is refused with 426 agent_protocol_required. For an agent that is not under managed activation, sending it gets 409 agent_adoption_required; a conversation without an agent ignores it. See Launch tickets.
X-CoA-Agent-TicketuuidThe ticketId returned by POST /api/agent-runtime/ticket for this exact body, with purpose set to conversation and parentScope set to the conversation id. Required for every turn when the conversation's agent is under managed activation: with the protocol header but without a ticket, the turn is refused with 428 agent_launch_required. A ticket starts one turn; see Launch tickets.
Path parameters
NameTypeDescription
id requireduuidThe conversation id.
Request body
NameTypeDescription
prompt requiredstringThe user message for this turn. It must contain more than whitespace.

Returns: A text/event-stream response. meta is sent first: { decision, reasonCode, model }. delta carries { text }, the next fragment of the reply. done is sent last: { message, steps, receiptId }, where message is the saved assistant message in the shape used by GET /api/conversations/{id}, steps is the step timeline of the run (the shape of receipt.steps shown for POST /api/run) and receiptId identifies its run receipt (omitted when the turn was refused for a revoked agent or an exhausted budget). done adds decision, reasonCode and detail when a model call was refused, approvalRequired and detail when tool calls needed approval, and replayed on a replayed turn, which sends no meta event and an empty steps array. error is sent last on a failure: an object with detail and, where available, error and evidence. A repeated turn whose launch ticket was already used is not streamed: it answers 200 with the JSON body { replayed: true, root: { id, status } }.

Errors
StatusCodeWhen
404conversation_not_foundNo conversation has this id for the calling credential.
400missing_promptprompt is missing, not a string, or only whitespace.
409model_usage_conversation_reconciliation_requiredThis turn was already registered with the same X-CoA-Model-Request value and its reply is incomplete. The body carries turnId; the turn was not sent to the model again.
400no_model_keyThe workspace has no model provider key saved in Settings.
400no_modelThe agent has no model and the workspace has no default model.
503model_usage_request_identity_requiredThe X-CoA-Model-Request header is missing or malformed. Nothing was saved or sent to the model.
426agent_protocol_requiredThe agent must be launched with the X-CoA-Agent-Protocol header and the header is missing.
428agent_launch_requiredThe conversation's agent needs a launch ticket and X-CoA-Agent-Ticket is missing.
409agent_admission_unavailableThe agent has no active version, is paused or revoked, or the ticket has expired or does not match this agent, operation and request body.
409agent_adoption_requiredThe protocol header was sent for an agent that is not under managed activation.
Request
curl -N https://centerofagentic.com/api/conversations/3f1c2a9e-0b7d-4e55-9a51-6f2f1c0e8d11/run/stream \
  -H "Authorization: Bearer $COA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-CoA-Model-Request: $(date +%s)000.$(uuidgen)" \
  -H "X-CoA-Agent-Protocol: agent-active-grants/1" \
  -H "X-CoA-Agent-Ticket: $COA_LAUNCH_TICKET" \
  -d '{"prompt":"Which supplier contracts renew next quarter?"}'

Something missing or unclear? Tell us and we will improve this page.