Trace represents one complete agent execution from start to finish. Each trace has a unique trace_id that groups all related spans together.
Trace Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
trace_id | str | Required | Unique trace identifier |
name | str | Required | Trace name (typically the root span name, e.g., Agent.run) |
status | str | Required | Overall status: OK, ERROR, or UNSET |
duration_ms | int | Required | Total execution time in milliseconds |
start_time | datetime | Required | When the trace started |
end_time | datetime | Required | When the trace completed |
total_spans | int | 0 | Total number of spans in this trace |
error_count | int | 0 | Number of spans that errored |
run_id | Optional[str] | None | Associated agent/team/workflow run ID |
session_id | Optional[str] | None | Associated session ID |
user_id | Optional[str] | None | Associated user ID |
agent_id | Optional[str] | None | Associated agent ID |
team_id | Optional[str] | None | Associated team ID |
workflow_id | Optional[str] | None | Associated workflow ID |
created_at | datetime | Required | When the trace record was created |
Methods
to_dict()
Convert the trace to a dictionary.
dict
from_dict()
Create a trace from a dictionary.
data(dict): Dictionary containing trace data
Trace
Usage
See Also
- Span Reference - Individual operations within a trace
- DB Functions - Query functions for traces and spans