TraceAI Agno Instrumentation
OpenTelemetry instrumentation for Agno, the high-performance AI agent framework.
Installation
pip install traceai-agno
For full functionality, also install the Agno framework and its OpenInference instrumentation:
pip install agno openinference-instrumentation-agno
Quick Start
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_agno import configure_agno_tracing
# Setup TraceAI
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="agno-agent",
)
# Configure Agno to use TraceAI (call BEFORE creating agents)
configure_agno_tracing(tracer_provider=trace_provider)
# Now import and use Agno normally
from agno.agent import Agent
from agno.models.openai import OpenAIChat
agent = Agent(
model=OpenAIChat(id="gpt-4"),
description="A helpful assistant",
)
response = agent.run("What is the capital of France?")
print(response.content)
Configuration Options
Using fi_instrumentation (Recommended)
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_agno import configure_agno_tracing
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="my-agno-project",
)
configure_agno_tracing(tracer_provider=trace_provider)
Direct OTLP Configuration
from traceai_agno import configure_agno_tracing
configure_agno_tracing(
otlp_endpoint="https://api.traceai.com/v1/traces",
otlp_headers={"Authorization": "Bearer YOUR_API_KEY"},
project_name="my-agno-project",
)
Using Custom Tracer Provider
from traceai_agno import setup_traceai_exporter, configure_agno_tracing
# Create a custom tracer provider
provider = setup_traceai_exporter(
endpoint="https://api.traceai.com/v1/traces",
headers={"Authorization": "Bearer YOUR_API_KEY"},
service_name="my-agno-service",
use_batch_processor=True,
)
configure_agno_tracing(tracer_provider=provider)
Features
Agent Tracing
Automatically captures:
- Agent name, type, and configuration
- Model information (provider, ID, temperature, etc.)
- Tool count and configuration
- Memory and knowledge settings
- Debug mode and markdown settings
Tool Tracing
Tracks tool executions including:
- Tool name and description
- Input parameters
- Execution results
Team Tracing
For multi-agent setups:
- Team name
- Team member agents
- Inter-agent communication
Workflow Tracing
For complex workflows:
- Workflow name
- Step execution
- State transitions
Span Attributes
The instrumentation adds the following attributes to spans:
LLM Attributes (OpenTelemetry GenAI Semantic Conventions)
gen_ai.system- Model provider (openai, anthropic, etc.)gen_ai.request.model- Requested model IDgen_ai.request.temperature- Temperature settinggen_ai.request.max_tokens- Max tokens settinggen_ai.usage.input_tokens- Input token countgen_ai.usage.output_tokens- Output token count
Agent Attributes
agent.name- Agent nameagent.type- Agent typeagent.description- Agent descriptionagent.instructions- Agent instructions
Agno-Specific Attributes
agno.agent.id- Agent IDagno.tool_count- Number of toolsagno.team.name- Team nameagno.team.members- Team member namesagno.workflow.name- Workflow nameagno.session.id- Session IDagno.user.id- User IDagno.debug_mode- Debug mode statusagno.memory.enabled- Memory enabled statusagno.knowledge.enabled- Knowledge enabled status
Helper Functions
Extract Agent Attributes
from traceai_agno import get_agent_attributes
agent = Agent(model=OpenAIChat(id="gpt-4"), name="MyAgent")
attrs = get_agent_attributes(agent)
# {'agent.name': 'MyAgent', 'agent.type': 'Agent', ...}
Extract Tool Attributes
from traceai_agno import get_tool_attributes
def my_tool(query: str) -> str:
"""Search for information."""
return "result"
attrs = get_tool_attributes(my_tool)
# {'gen_ai.tool.name': 'my_tool', 'gen_ai.tool.description': 'Search for information.'}
Extract Team Attributes
from traceai_agno import get_team_attributes
team = Team(name="ResearchTeam", agents=[agent1, agent2])
attrs = get_team_attributes(team)
# {'agno.team.name': 'ResearchTeam', 'agno.team.members': 'Agent1, Agent2'}
Detect Model Provider
from traceai_agno import get_model_provider
provider = get_model_provider("gpt-4") # Returns "openai"
provider = get_model_provider("claude-3-sonnet") # Returns "anthropic"
provider = get_model_provider("ollama/llama3") # Returns "ollama"
Create Trace Context
from traceai_agno import create_trace_context
context = create_trace_context(
session_id="session-123",
user_id="user-456",
tags=["production"],
metadata={"environment": "prod"},
)
Examples
See the examples directory for complete usage examples:
basic_agent.py- Simple agent with tracingagent_with_tools.py- Agent with tool callingteam_example.py- Multi-agent team coordinationworkflow_example.py- Complex workflow tracing
Requirements
- Python >= 3.10
- opentelemetry-api >= 1.0.0
- opentelemetry-sdk >= 1.0.0
- opentelemetry-exporter-otlp >= 1.0.0
- fi-instrumentation >= 0.1.0
License
Apache-2.0
Metadata
Release files for traceai-agno 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| traceai_agno-0.1.0.tar.gz | 17.6 kB | Without provenance | Details for traceai_agno-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| traceai_agno-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for traceai_agno-0.1.0-py3-none-any.whl |
Total release size: 26.5 kB
Release files / traceai_agno-0.1.0.tar.gz
| Download URL | traceai_agno-0.1.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d63586ea563145655255b69307119644d2e526bdc0397db83b744087b8173468
|
|
BLAKE2b-256 checksum How to use checksums |
f7e4b02b5ed364b710b7bdbaccce1d5e1cf16501634975e61431aea84f57b087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / traceai_agno-0.1.0-py3-none-any.whl
| Download URL | traceai_agno-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac7708bb9a54eaac4251d08d8b6e4735c0b6c6ea635119e4329e1921a9325ac0
|
|
BLAKE2b-256 checksum How to use checksums |
a8cfa5aa7b00c29f9d3aead7db7e6ca5cb84f4531c7c8c04d8774449c9f125fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for traceai-agno 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.