The AgentOps REST API allows you to integrate agent monitoring directly into your application without using our Python SDK. This is useful for:

  • Non-Python applications
  • Custom integrations
  • Direct API access

For a complete API reference, you can view our OpenAPI specification.

Authentication

The AgentOps API uses a two-step authentication process:

  1. API Key: Used to create sessions and get JWT tokens
  2. JWT: Used for all operations within a session

Initial Authentication

When you create a session, you’ll use your API key and receive a JWT token in response:

Using JWT Tokens

Use the JWT token in the Authorization header for all subsequent requests:

Refreshing Tokens

JWTs expire after 24 hours. When a token expires, use your API key to get a new one:

Session Management

Sessions require a unique identifier that you generate client-side. While any unique string will work, we recommend using UUIDs for consistency. Here’s how to generate one in Python:

Create Session

Start a new monitoring session using your generated session ID:

Update Session

Update an existing session (e.g., when it ends):

Event Tracking

Create Events

Track LLM calls, tool usage, or other events:

Update Events

Update existing events (e.g., adding completion information):

Agent Management

Create Agent

Register a new agent in a session:

Example Integration

Here’s a complete example using Python’s requests library: