AgentOps Integration
Initialize AgentOps and auto-log an Agno agent's model calls.
Demonstrates logging Agno model calls with AgentOps.
"""
AgentOps Integration
====================
Demonstrates logging Agno model calls with AgentOps.
"""
import agentops
from agno.agent import Agent
from agno.models.openai import OpenAIChat
# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
# Initialize AgentOps
agentops.init()
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(model=OpenAIChat(id="gpt-5.6-luna"))
# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
response = agent.run("Share a 2 sentence horror story")
print(response.content)Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno agentops openaiExport your API keys
export AGENTOPS_API_KEY="your_agentops_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"Run the example
Save the code above as agent_ops.py, then run:
python agent_ops.pyFull source: cookbook/observability/agent_ops.py