> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agnost.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agno

> Capture traces from Agno agents and teams

<Note>
  Agno traces can include prompts, completions, tool inputs, and tool outputs. Review [Data Governance](/data-governance) before enabling production traffic.
</Note>

## Install

```bash theme={null}
pip install agno openinference-instrumentation-agno \
            opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
```

## Setup

```python theme={null}
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from openinference.instrumentation.agno import AgnoInstrumentor
from openinference.instrumentation import using_attributes
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://otel.agnost.ai"
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = "X-Agnost-Org-ID=<your-org-id>"

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
AgnoInstrumentor().instrument()

agent = Agent(
    model=OpenAIChat(id="gpt-4o-mini"),
    session_id="sess-123",   # Agno's first-class session
    user_id="u-42",
)

with using_attributes(session_id="sess-123", user_id="u-42"):
    agent.print_response("Hello")
```

Agno itself supports `session_id` and `user_id` as `Agent` constructor params. Spans carry OpenInference attributes plus `agno.agent.name` / `agno.team.name`. Instrument once at process start; child agents in teams inherit.

## Alternative: OpenLit

`openlit.init(...)` is also supported and auto-instruments common providers in one shot.

## Verify

Run one `agent.print_response` call, then open **Raw logs** in Agnost. Confirm spans include `session_id`, `user_id`, and `agno.agent.name`.

## Troubleshooting

* Instrument once at process start before agent calls.
* Confirm `OTEL_EXPORTER_OTLP_HEADERS` contains `X-Agnost-Org-ID=<your-org-id>`.
* If child team spans are missing, confirm the parent Agno agent is instrumented before teams are constructed.

## References

* [Enable OpenTelemetry export](https://docs.agno.com/observability/openlit)
* [Add custom metadata](https://docs.agno.com/tracing/overview)
