Quick Start
AgentResponse
The main response object returned byagent.run().
Properties
| Property | Type | Description |
|---|---|---|
response | str | The agent’s text response |
session_id | str | Session identifier for conversation continuity |
message_id | str | None | Unique identifier for this message |
metadata | dict | None | Additional metadata (tokens, timing, etc.) |
tool_calls | List[dict] | None | Tools called during execution |
raw_response | dict | None | Raw API response for debugging |
artifact_files | List[Artifact] | None | Generated files |
Methods
has_files()
Check if the response contains generated files.files (property)
Get the list of generated files.to_dict()
Convert response to dictionary.Example
AgentStream
A single chunk from a streaming response. Yielded when usingstream=True.
Properties
| Property | Type | Description |
|---|---|---|
content | str | Accumulated content so far |
delta | str | None | New text added in this chunk |
done | bool | True if this is the final chunk |
session_id | str | None | Session identifier |
metadata | dict | None | Chunk-specific metadata |
chunk_index | int | None | Index of this chunk (0-based) |
structured_data | BaseModel | None | Validated Pydantic model (final chunk only) |
artifact_files | List[Artifact] | None | Generated files (final chunk only) |
Methods
has_files()
Check if the chunk contains generated files.files (property)
Get generated files from the chunk.to_dict()
Convert chunk to dictionary.Example
Streaming with Progress
Artifact
Represents a generated file whenfile_output=True.
Properties
| Property | Type | Description |
|---|---|---|
name | str | File name (e.g., “report.pdf”) |
url | str | URL to download the file |
format_type | str | File format (pdf, docx, png, csv, etc.) |
artifact_id | str | None | Unique identifier for the artifact |
Methods
download()
Download the artifact to a local file.| Parameter | Type | Description |
|---|---|---|
save_path | str | Local path to save the file |
Example
TaskResponse
Response from creating a long-running task.Properties
| Property | Type | Description |
|---|---|---|
task_id | str | Unique identifier for polling status |
status | str | Current status |
session_id | str | None | Session ID |
created_at | str | None | Timestamp |
TaskStatus
Status of a long-running task.Methods
is_complete()
Check if task has finished (completed or failed).is_successful()
Check if task completed successfully.Structured Responses
When usingresponse_model, responses are parsed into Pydantic models: