AgentOps Integration
AgentOps provides agent monitoring, debugging, and optimization.AgentOps is treated as a soft optional dependency. If the package isn’t installed, PraisonAI skips telemetry without raising; if
end_session() fails at runtime, the failure is logged as a warning and the agent run still returns its result.Setup
1. Install Dependencies
2. Set Environment Variables
3. Initialize
How Integration Works
- AgentOps is optional: if
pip install agentopshasn’t been run, PraisonAI silently skips session telemetry. - After every agent execution — on both success and failure paths — the wrapper calls
praisonai.observability.hooks.finalize_observability(adapter_name, status=…)from afinallyblock.statusis"Success"when no exception is propagating and"Failure"otherwise (errors,KeyboardInterrupt, cancellation, rate limits). Failures inside the end-session call are logged atWARNINGlevel and never propagate. - Detection happens once at module import via
importlib.util.find_spec("agentops"). Installingagentopsafter the process started will not be picked up — restart the process. - PraisonAI auto-inits AgentOps for you if
AGENTOPS_API_KEYis set in the environment. The init is centralized inpraisonai.observability.hooks.init_observability(framework_tag, tags=...)and is called automatically by the orchestrator before any adapter runs. You can call it yourself from a custom framework adapter’ssetup()hook if you need control over the tags.
See Observability Hooks for details on the centralized observability system and how to use it in custom adapters. The centralized
finalize_observability(...) hook is documented in Observability Hooks → Quick Start.Usage
Auto-Instrumentation (Recommended)
Explicit Tracing (For Fine Control)
Configuration Options
| Option | Environment Variable | Description |
|---|---|---|
api_key | AGENTOPS_API_KEY | Your AgentOps API key |
tags | - | Default tags for sessions |
auto_start_session | - | Auto-start session (default: True) |

