Skip to main content
Want a ready-made UI? See the Chat UI tutorial.
Stream messages as the agent works — reasoning, tool calls, browser actions, and results. Each message has role, type, summary, data, and screenshot_url. See List session messages for all fields.

Cancel a running task

Use stop(strategy="task") to cancel the current task without destroying the session. The session goes back to idle and can accept a new task.
run.result is only available after the iterator finishes (all messages consumed or task completes). If you break early from async for / for await, the task may still be running — call stop(strategy="task") to cancel it before sending a follow-up.

Manual polling

If you need full control over the polling loop (e.g. custom interval, filtering):