Setup
Install the Braintrust SDK and Agno, plus the Yahoo Finance tools used in the example below:.env
Tracing Agno requires Agno 2.1.0 or later.
Auto-instrumentation
To trace Agno without modifying each agent call, callinit_logger() and auto_instrument() once at startup. auto_instrument() patches Agno’s agent, team, model, workflow, and tool APIs along with every other supported library.Instrument only Agno
Instrument only Agno
To patch Agno without enabling Braintrust’s other integrations, call
setup_agno() instead. It initializes a logger for you when one isn’t already active.Workflows
Agno workflows are traced without extra configuration. The workflow run appears as a parent span, with nested agent and model calls underneath it:What Braintrust traces
Braintrust captures:- Agent run spans (
<agent>.run,<agent>.arun, and their streaming variants), with the run input, agent and model metadata, output, and token usage. - Team run spans (
<team>.run,<team>.arun, and their streaming variants), with the run input, team and model metadata, output, and token usage. - Model call spans (
<model>.invoke,<model>.response, and their async and streaming variants), with the request messages, model and provider metadata, response, and token usage. - Tool call spans (
<tool>.executeand<tool>.aexecute), with the tool arguments, function metadata, and result. - Workflow run spans (
<workflow>.run, its async and streaming variants, and nested workflow-step spans), with the workflow input, workflow metadata, output, and token usage.