# Agno

Install Brizz with the Agno agent framework.

Quickstart for the Agno integration shown during onboarding. For the full Python SDK reference, see the [Python SDK guide](/docs/sdks/python.md).

## Install

:::tabs
:::tab[pip]
```bash
pip install brizz
```
:::tab[uv]
```bash
uv add brizz
```
:::tab[poetry]
```bash
poetry add brizz
```
:::

## Initialize and run

Initialize Brizz before importing Agno — Agno is auto-instrumented.

```python
from dotenv import load_dotenv
load_dotenv()

import os
from brizz import Brizz, start_session

Brizz.initialize(
    api_key=os.getenv("BRIZZ_API_KEY"),
    app_name="my-app",
)

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    name="My Agent",
    model=OpenAIChat(id="gpt-4o-mini"),
    markdown=True,
)

with start_session("my-session"):
    response = agent.run("What is 2+2?")
    print(response.content)
```

## With Langfuse

If you already use Langfuse to trace Agno (via OpenLIT), set `allowed_instrumentations=[]` so Brizz stays out of Agno instrumentation and only ingests Langfuse's OTel spans.

```python
from dotenv import load_dotenv
load_dotenv()

import os
from brizz import Brizz

Brizz.initialize(
    api_key=os.getenv("BRIZZ_API_KEY"),
    app_name="my-app",
    allowed_instrumentations=[],
)

from langfuse import get_client, propagate_attributes
import openlit
langfuse = get_client()
openlit.init(tracer=langfuse._otel_tracer, disable_batch=True)

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    name="My Agent",
    model=OpenAIChat(id="gpt-4o-mini"),
    markdown=True,
)

with langfuse.start_as_current_observation(as_type="span", name="agno-run") as span:
    with propagate_attributes(session_id="my-session", user_id="user-123"):
        response = agent.run("What is 2+2?")
        print(response.content)
```

## Complete example

A single file you can copy, set `BRIZZ_API_KEY` + `OPENAI_API_KEY`, and run with `python agent.py`.

```python
# agent.py
from dotenv import load_dotenv
load_dotenv()

import os
# Initialize Brizz BEFORE importing Agno — Agno is auto-instrumented at import time.
from brizz import Brizz, start_session, emit_event

Brizz.initialize(
    api_key=os.environ["BRIZZ_API_KEY"],
    app_name="my-app",
    environment=os.getenv("APP_ENV", "development"),
)

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    name="Support Bot",
    model=OpenAIChat(id="gpt-4o-mini"),
    markdown=True,
)


def run_turn(session_id: str, user_id: str, user_message: str) -> str:
    with start_session(session_id) as session:
        session.update_properties(user_id=user_id, plan="enterprise")
        session.set_input(user_message, agent_name=agent.name)

        response = agent.run(user_message)
        session.set_output(response.content, message_id=getattr(response, "run_id", None))

        # User feedback — map "feedback.positive" / "feedback.negative" to system
        # events in Org Settings -> Event so it powers filters and the Overview chart.
        emit_event(
            "feedback.positive",
            attributes={"category": "helpfulness"},
            body={"comment": "Exactly what I needed!", "context": "support-agent"},
        )
        return response.content


if __name__ == "__main__":
    print(run_turn("session-123", "user-42", "What is 2+2?"))
```

**Gotchas**

- Initialize Brizz before `from agno.agent import Agent`. Auto-instrumentation hooks at import time.
- Already tracing Agno via Langfuse + OpenLIT? Use the `allowed_instrumentations=[]` pattern in [With Langfuse](#with-langfuse) above so Brizz only ingests Langfuse's OTel spans.

## See also

- [Python SDK](/docs/sdks/python.md) — full SDK reference.
- [Sessions](/docs/instrument/sessions.md) — session capture patterns.
- [Identify users](/docs/instrument/identify-users.md) — attach user properties to Agno runs.
