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

  1. Install AgentOps

    Ensure you have the AgentOps package installed:

    1uv pip install agentops
  2. 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 agentops
2from kern.agent import Agent
3from kern.models.openai import OpenAIResponses
4
5# Initialize AgentOps
6agentops.init()
7
8# Create and run an agent
9agent = Agent(model=OpenAIResponses(id="gpt-5.2"))
10response = agent.run("Share a 2 sentence horror story")
11
12# Print the response
13print(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.