# AgentOps

> Observability and DevTool platform for AI agents — from prototype to production

- Category: Evaluation & Production Ops / Observability & LLMOps
- Language: Python
- Licence: MIT
- Repository: https://github.com/AgentOps-AI/agentops
- Website: https://www.agentops.ai
- Canonical page: https://ai-tldr.dev/tools/agentops/

## In short

AgentOps is an open-source SDK and platform that helps developers build, evaluate, and monitor AI agents. You add it to a Python program to capture analytics on your LLM calls, replay agent sessions step by step, and track how much each run costs. It sits in the Observability & LLMOps category of the Evaluation & Production Ops tools and is open-source, written in Python and licensed MIT.

## Overview

AgentOps is an open-source SDK and platform that helps developers build, evaluate, and monitor AI agents. You add it to a Python program to capture analytics on your LLM calls, replay agent sessions step by step, and track how much each run costs.

It is aimed at developers building agentic apps who need visibility into what their agents actually do at runtime. Instead of guessing why an agent failed or how much a workflow spent, you get execution graphs, input/output recording, and cost tracking across foundation-model providers.

As an LLM observability tool, AgentOps sits alongside your agent framework rather than replacing it. It offers native integrations with CrewAI, LangChain, LangGraph, AG2 (AutoGen), the OpenAI Agents SDK, and others, and can run as a hosted dashboard or be self-hosted on your own cloud.

## What it does

- Replay analytics and debugging with step-by-step agent execution graphs
- LLM cost management that tracks spend across foundation-model providers
- Session replays initialized in two lines of code
- Native integrations with CrewAI, AG2 (AutoGen), Agno, LangGraph, LangChain, and the OpenAI Agents SDK
- Decorators (@session, @agent, @operation, @task, @workflow) for tracing agents, tools, and functions
- Self-hosting option to run the full dashboard and API backend on your own cloud

## Getting started

Install the SDK, then initialize the client at the start of your program to capture analytics on all your LLM calls.

1. Install AgentOps

   Install the package from PyPI.

```bash
pip install agentops
```

2. Get an API key

   Create an API key from the AgentOps dashboard at app.agentops.ai/settings/projects.

3. Initialize and record a session

   Call agentops.init() near the start of your program (for example in main.py) and end the session when your program finishes.

```python
import agentops

# Beginning of your program (i.e. main.py, __init__.py)
agentops.init(<INSERT YOUR API KEY HERE>)

...

# End of program
agentops.end_session('Success')
```

4. Trace functions with decorators

   Use AgentOps decorators to add observability to specific agents and operations. They support input/output recording, exception handling, and async functions.

```python
from agentops.sdk.decorators import session, agent, operation

@agent
class MyAgent:
    @operation
    def main_operation(self):
        return "done"

@session
def my_session():
    agent = MyAgent()
    return agent.main_operation()
```

## When to use it

- Debugging why a multi-step agent failed by replaying its execution graph step by step
- Tracking and controlling LLM spend across foundation-model providers in production
- Monitoring agents built with CrewAI, LangChain, LangGraph, or the OpenAI Agents SDK through native integrations
- Self-hosting the AgentOps dashboard and API backend to keep agent telemetry on your own cloud
