agent_ops.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your API keys
4
Run the example
Save the code above as
agent_ops.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Initialize AgentOps and auto-log a GPT-4o Agno agent’s model calls.
"""
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-4o"))
# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
response = agent.run("Share a 2 sentence horror story")
print(response.content)
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno agentops openai
Export your API keys
export AGENTOPS_API_KEY="your_agentops_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:AGENTOPS_API_KEY="your_agentops_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run the example
agent_ops.py, then run:python agent_ops.py
Was this page helpful?