Skip to main content
Stream messages as the agent works: planning, tool calls, and progress. Each message has a type, a summary, and data.
run.result is only available after the iterator finishes. In the async Python and TypeScript SDKs the same run object is both awaitable (await run → result) and async-iterable (stream messages).

Polling instead of streaming

The blocking client.run() (sync Python) or await client.run() (async / TypeScript) already runs to completion and returns the result. Use it when you don’t need live messages:

Manual control

For full control over the loop, drive the resources directly:
Python
A finished task returns to status: "plan" with activity: "idle". The SDK’s is_terminal() accounts for this, so don’t poll on status alone.

Raw SSE

Both POST /task/stream and GET /task/{task_id}/stream emit Server-Sent Events with the same event names as the dashboard. See the Task API for the raw HTTP interface.