Skip to main content

OpenInference Agno Instrumentation

Project description

OpenInference Agno Instrumentation

pypi

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.print_response("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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openinference_instrumentation_agno-0.1.33.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file openinference_instrumentation_agno-0.1.33.tar.gz.

File metadata

File hashes

Hashes for openinference_instrumentation_agno-0.1.33.tar.gz
Algorithm Hash digest
SHA256 4857098cad4fedb7dc9dbb6b5a249134a8a45f7bd37d82cb19067d0f71da895d
MD5 88318be1df5d117f2cbdcee7dd122c42
BLAKE2b-256 4f4a40b4fb4adaf7990404b3b7ff09eeeefc2e8b71bc9c6a71132eddd50f7c44

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinference_instrumentation_agno-0.1.33.tar.gz:

Publisher: publish.yaml on Arize-ai/openinference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openinference_instrumentation_agno-0.1.33-py3-none-any.whl.

File metadata

File hashes

Hashes for openinference_instrumentation_agno-0.1.33-py3-none-any.whl
Algorithm Hash digest
SHA256 6daa7a8699c526d24ff23caca0b994217712f0f4536cb812f0d4c9c34f0b4259
MD5 5c8f2303a4dbe6c275b82a63283c5f8b
BLAKE2b-256 f38d9fbf17d288205ff404484406c3c28fee7ed7401322fcb55980af6dc36c94

See more details on using hashes here.

Provenance

The following attestation bundles were made for openinference_instrumentation_agno-0.1.33-py3-none-any.whl:

Publisher: publish.yaml on Arize-ai/openinference

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page