RunOutput object; streaming runs yield a sequence of RunOutputEvent objects.
RunOutput
TheRunOutput dataclass contains everything from a completed run:
Content
| Field | Type | Description |
|---|---|---|
content | str | The agent’s final text response |
content_type | str | Content type ("text", "json") |
reasoning_content | str | Chain-of-thought reasoning (if applicable) |
reasoning_steps | list | Individual reasoning steps |
Identity
| Field | Type | Description |
|---|---|---|
run_id | str | Unique identifier for this run |
agent_id | str | Agent that produced this output |
session_id | str | Session this run belongs to |
parent_run_id | str | Parent run ID (for nested runs) |
model | str | Model used (e.g., "gpt-4o") |
model_provider | str | Provider name (e.g., "OpenAI") |
Execution
| Field | Type | Description |
|---|---|---|
status | RunStatus | COMPLETED, ERROR, PAUSED, CANCELLED |
messages | List[Message] | Full conversation history |
metrics | Metrics | Aggregated token usage, cost, and timing |
events | list | All events that occurred during the run |
Media
| Field | Type | Description |
|---|---|---|
images | List[Image] | Generated images |
videos | List[Video] | Generated videos |
audio | List[Audio] | Generated audio |
files | List[File] | Generated files |
response_audio | Audio | Audio response (for audio models) |
Control
| Field | Type | Description |
|---|---|---|
requirements | list | Pending requirements (confirmations, user input) |
is_paused | bool | Whether the run is waiting for user action |
RunStatus
Stream Events
Streaming runs yield typed events. Each event has anevent field identifying its type.
Lifecycle Events
Content Events
Tool Events
Reasoning Events
Complete Event Reference
| Event | Key Fields | Description |
|---|---|---|
RunStarted | run_id, agent_id | Execution began |
RunContent | content | Content chunk |
RunContentCompleted | full_content | All content generated |
IntermediateRunContent | content | Intermediate content (between tool calls) |
ToolCallStarted | tool_name, tool_args | Tool call began |
ToolCallCompleted | tool_name, result | Tool call finished |
ToolCallError | tool_name, error | Tool call failed |
PreHookStarted | tool_name | Pre-hook began |
PreHookCompleted | tool_name | Pre-hook finished |
PostHookStarted | tool_name | Post-hook began |
PostHookCompleted | tool_name | Post-hook finished |
ReasoningStarted | Reasoning began | |
ReasoningStep | content | One reasoning step |
ReasoningContentDelta | delta | Reasoning text chunk |
ReasoningCompleted | Reasoning finished | |
KnowledgeRetrievalStarted | query | Knowledge retrieval began |
KnowledgeRetrievalCompleted | query, documents_found, documents_used, duration_ms | Knowledge retrieval finished |
MemoryRecallStarted | query | Memory recall began |
MemoryRecallCompleted | query, tokens_used, chunks_included, chunks_available, duration_ms | Memory recall finished |
MemoryUpdateStarted | message_count | Memory storage began |
MemoryUpdateCompleted | message_count, duration_ms | Memory storage finished |
FileReadStarted | file_count | File reading began |
FileReadCompleted | file_count, files_read, files_failed, duration_ms | File reading finished |
SessionSummaryStarted | Session summary began | |
SessionSummaryCompleted | Session summary finished | |
RunPaused | requirements | Waiting for user action |
RunContinued | Resumed after pause | |
RunCompleted | output | Run finished (includes full RunOutput) |
RunError | error | Run failed |
RunCancelled | Run was cancelled | |
CustomEvent | data | Application-defined event |
Getting RunOutput from a Stream
TheRunCompleted event contains the full RunOutput: