id, and all of it works the same whether the agent runs alone or delegates to subagents.
This guide ties together the read endpoints and the control endpoints into one mental model. Each links to its reference page for the full request and response shape.
In the Python and TypeScript SDKs, starting a session returns immediately with a lightweight handle bound to its id; the snippets below read and steer through that handle. Every operation is equally available as a direct client call keyed by id, and as a raw HTTP request, as each reference page shows.
Watch a run
There are three ways to read a session, from cheapest to most complete. Pick by what you need, not by habit.- Liveness, with
status. A small snapshot: current state, step count, and token usage. Poll it on an interval to drive a progress indicator or to detect a terminal state. - The answer and live updates, with
changes. Long-poll from an event index and the call blocks until something new happens, then returns the new events and the finalanswerwhen it lands. This is how you read the result without hammeringstatus. - Full history, with
events. The complete, paginated record of everything the agent observed and did. Use it to replay or audit a run after the fact.
changes while a run is active, poll status for a lightweight health check, and page through events when you need the whole trajectory.
Steer a running agent
As long as the session is not in a terminal state, you can intervene:- Send a message to add context or redirect the agent mid-run. The message is picked up on the next step; a message to an
idlesession also wakes it. See Send a message. - Pause and resume to halt the agent with its state preserved (for review or cost control), then continue. Sending a message auto-resumes a paused session. See Pause and Resume.
- Force an answer to tell the agent to stop exploring and commit to a final answer from what it has so far. See Force an answer.
- Cancel to stop the session for good; it ends in
interrupted. See Cancel.
A blocking run-and-wait call never surfaces the session mid-run. Start the session and keep its handle when you need to read or intervene while it works.
Hold an interactive conversation
By default a session ends as soon as the agent answers. Setidle_timeout_s when you create it to keep it open: after each answer the session enters idle and waits that long for your next message before terminating. One session becomes a multi-turn conversation that keeps its full context and environment state across turns.
status flip to idle between turns; it terminates once a turn goes unanswered for idle_timeout_s.