For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
    • Overview
  • Tracing
      • OpenAI Agents
      • Claude Agent SDK
      • Vercel AI SDK
      • Pydantic AI
      • CrewAI
      • Haystack
      • LangChain
      • LangGraph
      • Langflow
      • LlamaIndex
      • AutoGen
      • DSPy
      • Google ADK
      • Smolagents
      • Strands Agents
      • AgentSpec
      • Guardrails
      • Agno
      • MCP
      • BeeAI
      • Pipecat
      • Mastra
      • Superagent
      • BAML
  • Gateway
  • Others
  • Migrating
    • Braintrust
    • Portkey
    • Langfuse
LogoLogo
DiscordPlatform
On this page
  • Setup
  • Configuration
  • Respan
  • AgnoInstrumentor
  • What gets traced
  • Attributes
  • In Respan()
  • With propagate_attributes
  • Decorators
  • Examples
  • Tool calls
  • Teams
  • Streaming
TracingAgent Frameworks

Agno (tracing)

Was this page helpful?
Previous

MCP (tracing)

Next
Built with

Agno is a Python framework for building agents and teams with model calls, tools, streaming runs, and multi-agent coordination. Respan’s Agno integration patches Agno’s native Agent.run, Agent.arun, Team.run, and Team.arun methods and sends agent, team, chat, tool, and event spans through respan-tracing.

Set up Respan

Create an account at platform.respan.ai and grab an API key.

Run npx @respan/cli setup to set up with your coding agent.

Use Respan Gateway

See Agno gateway setup to route this integration through the Respan gateway.

Example projects
  • Example repo root: respan-example-projects/python/tracing/agno

Setup

1

Install packages

$pip install respan-ai respan-instrumentation-agno agno openai
2

Set environment variables

$export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

RESPAN_API_KEY exports traces to Respan. OPENAI_API_KEY is used by Agno’s OpenAI model client in this tracing-only setup.

3

Initialize and run

1from agno.agent import Agent
2from agno.models.openai import OpenAIChat
3from respan import Respan, workflow
4from respan_instrumentation_agno import AgnoInstrumentor
5
6respan = Respan(
7 app_name="agno-quickstart",
8 instrumentations=[AgnoInstrumentor()],
9)
10
11agent = Agent(
12 name="Quickstart Agent",
13 model=OpenAIChat(id="gpt-4o-mini"),
14 instructions="Answer in one concise sentence.",
15)
16
17@workflow(name="agno_quickstart")
18def run_agent() -> str:
19 result = agent.run("What does Agno help developers build?")
20 return str(result.content)
21
22print(run_agent())
23respan.flush()
4

View your trace

Open the Traces page to see the named workflow with Agno agent, chat, and tool spans. Use unique workflow names, such as agno_01_hello_world, so each example is easy to recognize in the trace list.

Configuration

Respan

ParameterTypeDefaultDescription
api_keystr | NoneNoneFalls back to RESPAN_API_KEY env var.
base_urlstr | NoneNoneFalls back to RESPAN_BASE_URL env var.
app_namestr | NoneNoneService name shown on exported Agno spans.
instrumentationslist[]Plugin instrumentations to activate, for example AgnoInstrumentor().
customer_identifierstr | NoneNoneDefault customer identifier for all spans.
metadatadict | NoneNoneDefault metadata attached to all spans.
environmentstr | NoneNoneEnvironment tag, for example "production".

AgnoInstrumentor

ParameterTypeDefaultDescription
agentAny | NoneNoneOptional single Agno agent instance to patch. If omitted, Agno Agent and Team classes are patched globally.
include_teamsboolTruePatch Team.run and Team.arun in addition to agent runs.

What gets traced

Agno operationRespan spanNotes
Agent.run / Agent.arunagno.agentCaptures run input, final output, run id, session id, agent id, and agent name.
Agno model requestagno.model_requestCaptures messages, completion, model, provider, tool definitions, tool calls, and token usage when Agno exposes metrics.
Python function toolsagno.toolCaptures {name, arguments} as input and the tool result as output. Callable tools include a JSON schema in llm.request.functions.
Team.run / Team.arunagno.teamCaptures team input/output and keeps delegated member agent spans in the same trace tree.
Streaming run eventsagno.eventCaptures intermediate Agno run events when only stream events are available.

Attributes

In Respan()

Set defaults at initialization. These apply to all spans emitted by the Agno instrumentor.

1from respan import Respan
2from respan_instrumentation_agno import AgnoInstrumentor
3
4respan = Respan(
5 app_name="agno-support-api",
6 instrumentations=[AgnoInstrumentor()],
7 customer_identifier="user_123",
8 metadata={"service": "agno-support-api", "version": "1.0.0"},
9)

With propagate_attributes

Override per request using a context scope.

1from agno.agent import Agent
2from agno.models.openai import OpenAIChat
3from respan import Respan, workflow
4from respan_instrumentation_agno import AgnoInstrumentor
5
6respan = Respan(instrumentations=[AgnoInstrumentor()])
7agent = Agent(name="Support Agent", model=OpenAIChat(id="gpt-4o-mini"))
8
9@workflow(name="agno_support_request")
10def answer_question(question: str) -> str:
11 result = agent.run(question)
12 return str(result.content)
13
14def handle_request(user_id: str, question: str):
15 with respan.propagate_attributes(
16 customer_identifier=user_id,
17 thread_identifier="conv_abc_123",
18 trace_group_identifier="support-request",
19 metadata={"plan": "pro"},
20 ):
21 print(answer_question(question))
AttributeTypeDescription
customer_identifierstrIdentifies the end user in Respan analytics.
thread_identifierstrGroups related Agno calls into a conversation.
trace_group_identifierstrGroups related traces for search and filtering.
metadatadictCustom key-value pairs. Merged with default metadata.

Decorators

Agno runs are auto-traced by the instrumentor. Use @workflow and @task when you want a recognizable root span around a full script or request. This is the pattern used by the example set so each result is visible by script name in the trace list.

1from agno.agent import Agent
2from agno.models.openai import OpenAIChat
3from respan import Respan, task, workflow
4from respan_instrumentation_agno import AgnoInstrumentor
5
6respan = Respan(instrumentations=[AgnoInstrumentor()])
7agent = Agent(
8 name="Checklist Agent",
9 model=OpenAIChat(id="gpt-4o-mini"),
10 instructions="Return exactly two bullets.",
11)
12
13@task(name="draft_prompt")
14def draft_prompt(topic: str) -> str:
15 return f"Write a two-bullet operational checklist for {topic}."
16
17@workflow(name="agno_checklist_workflow")
18def run_checklist(topic: str) -> str:
19 result = agent.run(draft_prompt(topic))
20 return str(result.content)
21
22print(run_checklist("reviewing an SDK integration"))
23respan.flush()

Examples

Tool calls

1from agno.agent import Agent
2from agno.models.openai import OpenAIChat
3
4def lookup_shipping_status(order_id: str) -> str:
5 """Look up the shipping status for an order id."""
6 return f"Order {order_id} is packed and ready for pickup."
7
8agent = Agent(
9 name="Support Agent",
10 model=OpenAIChat(id="gpt-4o-mini"),
11 instructions="Use tools when order status is requested.",
12 tools=[lookup_shipping_status],
13)
14
15result = agent.run("What is the shipping status for order A-100?")
16print(result.content)

Teams

1from agno.agent import Agent
2from agno.models.openai import OpenAIChat
3from agno.team import Team
4
5researcher = Agent(
6 name="Researcher",
7 model=OpenAIChat(id="gpt-4o-mini"),
8 instructions="Find the most relevant operational facts.",
9)
10writer = Agent(
11 name="Writer",
12 model=OpenAIChat(id="gpt-4o-mini"),
13 instructions="Turn operational facts into concise prose.",
14)
15team = Team(
16 name="Tracing Team",
17 model=OpenAIChat(id="gpt-4o-mini"),
18 members=[researcher, writer],
19 instructions="Coordinate a concise final answer.",
20)
21
22result = team.run("Explain why tool spans are useful in one paragraph.")
23print(result.content)

Streaming

1from agno.agent import Agent
2from agno.models.openai import OpenAIChat
3
4agent = Agent(
5 name="Streaming Agent",
6 model=OpenAIChat(id="gpt-4o-mini"),
7 instructions="Answer in one short paragraph.",
8)
9
10for event in agent.run("Explain streaming agent output.", stream=True):
11 if getattr(event, "content", None):
12 print(event.content, end="")