AgentOps
Integrate Kern with AgentOps to send traces and logs to a centralized observability platform.
Integrating Kern with AgentOps
AgentOps provides automatic instrumentation for your Kern agents to track all operations including agent interactions, team coordination, tool usage, and workflow execution.
Prerequisites
-
Install AgentOps
Ensure you have the AgentOps package installed:
1uv pip install agentops -
Authentication Go to AgentOps and copy your API key
1export AGENTOPS_API_KEY=<your-api-key>
Logging Model Calls with AgentOps
This example demonstrates how to use AgentOps to log model calls.
1import agentops2from kern.agent import Agent3from kern.models.openai import OpenAIResponses45# Initialize AgentOps6agentops.init()78# Create and run an agent9agent = Agent(model=OpenAIResponses(id="gpt-5.2"))10response = agent.run("Share a 2 sentence horror story")1112# Print the response13print(response.content)Notes
- Environment Variables: Ensure your environment variable is correctly set for the AgentOps API key.
- Initialization: Call
agentops.init()to initialize AgentOps. - AgentOps Docs: AgentOps Docs
Following these steps will integrate Kern with AgentOps, providing comprehensive logging and visualization for your AI agents’ model calls.