Skip to main content
Agno provides convenience functions on your database instance to query traces and spans. These functions work with any supported database (SQLite, PostgreSQL, etc.).

Trace Functions

db.get_trace()

Get a single trace by identifier.
Parameters: Returns: Trace or None See the reference for Trace for more information.

db.get_traces()

Get multiple traces with filtering and pagination.
Parameters: Returns: tuple[List[Trace], int] - (traces, total_count)

Span Functions

db.get_span()

Get a single span by ID.
Parameters: Returns: Span or None See the reference for Span for more information.

db.get_spans()

Get multiple spans for a trace or parent.
Parameters: Returns: List[Span]
Unlike get_traces(), get_spans() returns a list without a count.

Example: Analyzing a Run

See Also