Runs

A run is one execution of a teammate or task. Use runs for direct messages, follow-ups, and real-time output.

Create a run

Use the context manager so the stream closes cleanly even if you exit early.

Python

Direct iteration is still supported:

Python

Stream text only

Python

Non-streaming

Follow up on a run

Follow-up messages create a new run that keeps context from the previous one.

Python

runs.reply() is always non-interactive. It does not enable AskUserQuestion, approval mode, or plan mode.

Run options

FieldTypeDefaultDescription
messagestring (required)n/aPrompt or instruction for the run
teammate_idintn/aExisting teammate to execute
streambooltrueStream events in real-time
toolsstring[]n/aOverride teammate tools for this run
user_idstringn/aEnd-user scope. See Users
memorybooltrueInclude saved per-user memory
historybooltrueInclude prior run context
human_in_the_loopboolfalseEnable interactive questions and approvals
permission_modestringautonomousautonomous, approval, or plan

For permission and approval flows, see Human-in-the-Loop.

Run statuses

StatusMeaning
runningRun is executing
pausedRun is paused by execution control flow
awaiting_approvalRun is paused for user input or approval
completedRun finished successfully
failedRun failed
cancelledRun was cancelled
closedRun is closed
archivedRun is archived

Run files

Runs can generate files. List and download them after execution.

Python

What's next