Skip to main content

Endpoint

Use the agent for questions the structured endpoints cannot answer on their own: questions that span several documents, need judgement, or need work done in steps. The agent reasons over your organization’s workflows, tasks, and documents, and may run its own tools to answer.

Authentication

This endpoint requires an OAuth access token. Send it as a bearer token:
Required scope: agent:write The agent runs as the access token’s user. It inherits exactly that user’s access to workflows, tasks, and documents, and cannot see more than they can.

Query Parameters

Request Body

Request Example

Response

Success Response (stream=false)

Status Code: 200 OK

Response Fields

Check status before treating answer as the whole answer. A parked or interrupted run stopped rather than finished, and answer holds only what it produced before stopping - for an interrupted run, often nothing at all.

Pending Approval Object

Streaming Response (default)

With stream=true (the default), the response is text/event-stream. Each frame has the form:
A typical run sends a session_id event first, then one or more value events carrying the agent’s output, then end. Every data object carries its own event_type. Abridged example:
Event payloads are passed through from the agent service as-is and are not a stable contract. Other event types (for example heartbeat or loading) also appear and should be ignored. For scripts and integrations, prefer stream=false and the documented JSON body.

Conversation Lifecycle

1

Ask

Call this endpoint with your prompt. Keep the returned session_id.
2

Continue

Send follow-up messages to POST /v2/agent/conversations/{session_id}/messages. The agent keeps the earlier context.
3

Answer approvals

If a run comes back with status: "parked", it is waiting for a person to allow or refuse a tool. Answer it with POST /v2/agent/conversations/{session_id}/approvals - there is no other way to resume the run.

Error Responses

400 Bad Request

Returned when the access token has no user behind it. client_credentials tokens act as the admin who created the application, so this applies only to tokens issued before application creators were recorded.

401 Unauthorized

Returned when the access token is missing, unknown, revoked, or expired, or when an X-API-Key was sent instead of a bearer token. See OAuth error responses.

403 Forbidden

Returned when the token does not carry the required scope.

422 Validation Error

Returned when the request body is invalid, for example an empty prompt.

429 Too Many Requests

Returned when your organization exceeds its per-minute request limit.

500 Internal Server Error

Returned when the agent run could not be started or failed before producing an answer. With stream=false, a run that fails partway returns this error and any partial answer is discarded.

Notes

Agent runs routinely take a minute or more. Set a generous client timeout. The connection cannot be rejoined once it closes: if your client disconnects or times out, the answer is lost even though the run may continue on the server.
For a question a structured endpoint can answer directly - such as listing tasks or reading one document - call that endpoint instead. It is much faster than the agent.