OpenInference Agno Instrumentation
Project description
OpenInference Agno Instrumentation
Python auto-instrumentation library for Agno Agents
The following instrumentation is fully OpenTelemetry-compatible and can be sent to an OpenTelemetry collector for monitoring, such as arize-phoenix
or Langfuse.
Installation
pip install openinference-instrumentation-agno
Quickstart
This quickstart shows you how to instrument your Agno Agent application.
You've already installed openinference-instrumentation-agno. Next is to install packages for agno,
Phoenix and opentelemetry-instrument
, which exports traces to it.
pip install agno arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp-proto-grpc opentelemetry-distro
Start the Phoenix app in the background as a collector:
phoenix serve
By default, it listens on http://localhost:6006
. You can visit the app via a browser at the same address.
The Phoenix app does not send data over the internet. It only operates locally on your machine.
Create a simple Agno agent:
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from openinference.instrumentation.agno import AgnoInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry import trace as trace_api
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
# Optionally, you can also print the spans to the console.
tracer_provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))
trace_api.set_tracer_provider(tracer_provider=tracer_provider)
# Start instrumenting agno
AgnoInstrumentor().instrument()
agent = Agent(
model=OpenAIChat(id="gpt-4o-mini"),
tools=[DuckDuckGoTools()],
markdown=True,
debug_mode=True,
)
agent.run("What is currently trending on Twitter?")
Finally, run the example:
python example.py
Finally, browse for your trace in Phoenix at http://localhost:6006
!
More Info
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file openinference_instrumentation_agno-0.1.14.tar.gz
.
File metadata
- Download URL: openinference_instrumentation_agno-0.1.14.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
a250cb37d88a603ab4dcbe1e8e0340c09ce1b044350235cb56f71c9a57a9e7d8
|
|
MD5 |
fddc7f74c4453e52d8919a13c43d59cd
|
|
BLAKE2b-256 |
97d6d842a03074dd33b7f2b64a122ff930dea74ffcaed9fb7d1bc3094c8fd81b
|
File details
Details for the file openinference_instrumentation_agno-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: openinference_instrumentation_agno-0.1.14-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d526ff0ebe8b2641203c9ce4fa35679defaa9cd85853fa4bf5791c0c73fbd84b
|
|
MD5 |
edf8720b677d640ec9c903dbf0d35a19
|
|
BLAKE2b-256 |
3de5e7e2f6f5902f493672b18484437d3c6284d15ff310b88a16e5419830203d
|