Skip to content

Documentation

Developers

Sessions, Threads, and Runs

How a conversation, a turn of work, and a delegated task are represented.

A session is one conversation: messages, attachments, documents, and media. A run is one turn, from the moment the agent receives a message until it finishes, including every tool it used. A run continues if the page reloads. Only a cancel from the person who started it stops the run.

/api/v3/sessions is the current conversation API. Shared sessions have their own routes. Sub-agent tasks are addressed under the session and as /api/v3/tasks/{id}. /api/v2 still exposes the older assistants, threads, runs, and messages style. New integrations should use v3. Vector-store file APIs remain on v2 because they have no v3 equivalent.

Sending work

POST /api/v3/chat/send waits and returns the finished response. Use it for server integrations that do not need live tool progress. POST /api/v3/chat/stream returns server-sent events and ends with data: [DONE]. It does not carry file attachments. The WebSocket at /api/v3/chat/ws is the interactive path: it accepts attachments, can cancel or resume a run, and receives session updates. See WebSockets and Streaming.

A chat message names the agent and, when you are continuing a conversation, the session. The first message creates the session. Workspace conversations record the author of each message.

Schedules, channels, and sub-agents

A schedule creates its own session for each run. An API event runs inside an existing session. WhatsApp, Slack, phone, and meetings also create or continue sessions, so the same conversation is visible in the product and through the API.

A delegated task runs in a child session. The parent receives subagent_started and subagent_completed. The child does not inherit the parent transcript. It receives the task the parent wrote. Each child run is separate.

If a generation is already running in the session, a new one is refused until that run ends or the person who started it cancels it.