This example shows how to add observability to your agno agent with Agent Ops.

Code

cookbook/integrations/observability/agent_ops.py
import agentops
from agno.agent import Agent
from agno.models.openai import OpenAIChat

# Initialize AgentOps
agentops.init()

# Create and run an agent
agent = Agent(model=OpenAIChat(id="gpt-5-mini"))
response = agent.run("Share a 2 sentence horror story")

# Print the response
print(response.content)

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Set your API key

Obtain an API key from https://app.agentops.ai/
export AGENTOPS_API_KEY=xxx
3

Install libraries

pip install -U agno agentops openai
4

Run Agent

python cookbook/integrations/observability/agent_ops.py
1

Set your API key

You can view the logs in the AgentOps dashboard: https://app.agentops.ai/