Skip to main content
Agno provides convenience functions on your database instance to query traces and spans. Parameter support can vary by database implementation.

Trace Functions

db.get_trace()

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

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 Span reference.

db.get_spans()

Get multiple spans for a trace or parent.
Parameters: Returns: List[Span]
In Agno v2.7.2, synchronous SqliteDb.get_spans() does not accept limit. Omit limit when using SQLite. The other filters and the SQLite example below work as shown.
Unlike get_traces(), get_spans() returns a list without a count.

Example: Analyzing a Run

See Also