AgentOps is an observability and DevTool platform for AI agents, providing tools to trace, debug, and deploy reliable AI agents and LLM applications. It offers features like session replays, LLM cost tracking, failure detection, tool usage statistics, and benchmarking, helping engineers move AI agents from prototype to production by ensuring they operate safely, efficiently, and transparently.
pip install agentops python-dotenvVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the minimal setup for AgentOps. After installation, initialize AgentOps with your API key (preferably from an environment variable). This enables automatic instrumentation of supported LLM and agent framework calls. Remember to call `load_dotenv()` before `agentops.init()` if you're using a `.env` file.
Refer to the official changelog and documentation for each new minor version for specific migration guides and updated integration patterns. Ensure your environment dependencies are compatible with the AgentOps version used.
Set the `AGENTOPS_API_KEY` environment variable (e.g., `export AGENTOPS_API_KEY="your_key"` or in a `.env` file) or pass it directly to `agentops.init(api_key="your_key")`. Always call `load_dotenv()` early in your script if you rely on a `.env` file.
For deeper visibility into custom agent logic, specific function calls, or multi-step workflows, import and apply the relevant decorators (e.g., `@operation` on functions, `@agent` on agent classes) to your code. Refer to the 'Beyond Automatic Instrumentation: Decorators' section in the documentation.
Ensure `agentops.end_session()` is called at the logical end of your agent's execution path. Consider using `try...finally` blocks or the `@trace` decorator for robust session management.
Integrate AgentOps with a broader AgentOps framework that includes robust testing, evaluation harnesses, version control for prompts/configs, and defined policies for agent behavior and tool usage. Use AgentOps metrics to inform these design choices and detect anomalies proactively.