Registry / observability / opentelemetry-instrumentation-agno

opentelemetry-instrumentation-agno

JSON →
library0.62.3pypypi✓ verified 22d ago

This library provides OpenTelemetry auto-instrumentation for Agno agents, enabling detailed tracing of AI applications. It's part of the OpenInference project, ensuring compatibility with OpenTelemetry collectors and observability backends like Arize Phoenix and Langfuse. Currently at version 0.58.0, it follows a rapid release cadence, with multiple minor and patch releases occurring monthly to incorporate new features and align with evolving OpenTelemetry semantic conventions.

pip install opentelemetry-instrumentation-agno agno opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-agno
observabilitypythonv0.62.3
Install
11.8s avg
Import
Disk
110MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.62.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 107.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 11.8s · import 0.000s · 109MB
110MB installed
● package 110MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AgnoInstrumentor
from openinference.instrumentation.agno import AgnoInstrumentor
The primary class to enable Agno instrumentation.

This quickstart demonstrates how to set up OpenTelemetry to automatically instrument an Agno agent application. It configures a `TracerProvider` with an `OTLPSpanExporter` to send traces to an OpenTelemetry collector and then initializes the `AgnoInstrumentor` before running a simple Agno agent. Ensure your OpenTelemetry collector is running and accessible at the configured OTLP endpoint.

import os from opentelemetry import trace from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import SimpleSpanProcessor from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from openinference.instrumentation.agno import AgnoInstrumentor # Agno related imports for the example from agno.agent import Agent from agno.models.openai import OpenAIChat from agno.tools.duckduckgo import DuckDuckGoTools # Configure OpenTelemetry TracerProvider resource = Resource.create({"service.name": "agno-agent-app"}) provider = TracerProvider(resource=resource) # Export spans to an OTLP collector (e.g., SigNoz, Jaeger, Arize Phoenix) # Replace with your actual OTLP endpoint if not using default localhost otlp_endpoint = os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318/v1/traces") span_processor = SimpleSpanProcessor(OTLPSpanExporter(endpoint=otlp_endpoint)) provider.add_span_processor(span_processor) # Set the global TracerProvider trace.set_tracer_provider(provider) # Initialize Agno instrumentation AgnoInstrumentor().instrument() # Example Agno Agent application print("Agno Agent started...") agent = Agent( model=OpenAIChat(id=os.environ.get("OPENAI_MODEL_ID", "gpt-4o-mini")), tools=[DuckDuckGoTools()], markdown=True, debug_mode=True, ) response = agent.print_response("What is the current weather in London?") print(f"Agent Response: {response}") print("Agno Agent finished. Check your OTLP collector for traces.") # In a real application, you might want to ensure all spans are exported # before the application exits. For this simple example, we rely on # the SimpleSpanProcessor flushing on shutdown. For production, consider BatchSpanProcessor. provider.shutdown()
Debug
Known issues
gotchaOpenTelemetry SDK must be initialized before AgnoInstrumentation. If `trace.set_tracer_provider()` is called after `AgnoInstrumentor().instrument()` or after Agno components are imported, no traces will be emitted as API calls will use a no-op implementation.
fix
Ensure `trace.set_tracer_provider(provider)` is called early in your application's lifecycle, prior to importing or initializing any Agno-related code or calling `AgnoInstrumentor().instrument()`.
affects: All versions
breakingThe OpenTelemetry semantic conventions, particularly for Generative AI (GenAI), are actively evolving. Recent versions of `opentelemetry-instrumentation-agno` frequently update to align with new OpenTelemetry GenAI semantic conventions (e.g., changes to `gen_ai.tool.name`). This can lead to breaking changes in attribute names or structures if your observability backend or custom analysis tools rely on older semantic conventions.
fix
Monitor OpenTelemetry semantic convention releases and your instrumentation library's updates. Consider using the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable (e.g., `OTEL_SEMCONV_STABILITY_OPT_IN=http/dup` for HTTP) to manage compatibility during migration, and update your dashboards/queries accordingly. For Agno-specific attributes, refer to the `openinference-semantic-conventions` documentation.
affects: 0.53.0 and newer (due to active updates)
gotchaThis instrumentation library only works if the `agno` package is installed alongside it. Without `agno` present, the instrumentation will not find the target library to patch, and no Agno-specific traces will be generated.
fix
Ensure `agno` is included in your project dependencies and installed in the environment where your application runs (e.g., `pip install agno`).
affects: All versions
Upgrade
Version history
0.62.3latest on PyPI · released Aug 10, 2026
Audit
Dependencies
agnorequiredThe core AI agent library being instrumented.
opentelemetry-apirequiredOpenTelemetry API for Python.
opentelemetry-sdkrequiredOpenTelemetry SDK for Python, required for application instrumentation.
openinference-semantic-conventionsrequiredProvides semantic conventions for tracing LLM applications, used by OpenInference instrumentations.
opentelemetry-semantic-conventionsrequiredStandard OpenTelemetry semantic conventions.
pythonrequiredRequired Python version.
Agent activity
19 hits · last 30 days
node
14
OpenAI (training)
2
Resources
opentelemetry-instrumentation-agno — pip install opentelemetry-instrumentation-agno · libregistry