Runs

A run is a single execution of a teammate. Runs stream events in real-time (tool calls, reasoning, output) and persist results.

Create a Run

Streaming (default)

The simplest way to get real-time output:

Python

Use the context manager for automatic cleanup:

Python

Non-Streaming

For simpler use cases, disable streaming and poll for the result:

Quick Start Mode

Omit teammate_id to auto-create a teammate:

Python

This finds or creates a teammate named "Weekly Bot" and runs it immediately.

Run Options

FieldTypeDefaultDescription
messagestring (required)The task or question for the teammate
teammate_idintExisting teammate to use
streambooltrueEnable real-time event streaming
toolsstring[]Override teammate tools for this run
namestringQuick start: teammate name
instructionsstringQuick start: teammate instructions
user_idstringEnd-user ID for multi-tenancy
metadatadictArbitrary key-value data
memorybooltrueInclude saved per-user memories
historybooltrueInclude previous run context
human_in_the_loopboolfalseEnable interactive features — see Human-in-the-Loop
permission_modestring"autonomous"See Permissions. Requires human_in_the_loop for non-autonomous modes

Note: permission_mode values other than "autonomous" require human_in_the_loop=true.

Follow-Up Messages

Continue a conversation with runs.reply(). This creates a new run that inherits the teammate and context from the original:

Convenience Helpers

Shortcuts for common patterns:

Python

Answering Questions

When a teammate asks a clarifying question (via AskUserQuestion), the run pauses. Submit answers with runs.answer():

Python

Questions are only asked when human_in_the_loop=True. By default, runs are fully autonomous. See the Human-in-the-Loop guide for the complete interactive workflow.

List Runs

Get a Run

Python

Cancel a Run

Run Files

Agents can generate files during execution. List and download them after the run completes:

Run Statuses

StatusDescription
runningTeammate is actively executing
completedFinished successfully, output available
failedExecution failed, check run.error
cancelledCancelled by user
awaiting_approvalPaused — tool needs permission approval

What's Next