Observability Hooks provide a centralized entry point for initializing observability providers (AgentOps, future Langfuse, W&B) in PraisonAI and custom framework adapters.Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
praisonai.observability.hooks.init_observability(framework_tag, *, tags=None) is now a public hook, called automatically by the orchestrator and intended to be called by custom framework adapters’ setup() method.
Quick Start
How It Works
init_observability(framework_tag, *, tags=None) centralizes observability initialization:
- Auto-call site: orchestrator calls
init_observability(adapter.name)immediately afterassert_framework_available(...)and beforeadapter.setup(...) - AgentOps init guard:
agentops.init(...)only fires if both (a)agentopsis importable, and (b)AGENTOPS_API_KEYis set in the env - Failure mode:
ImportError(no agentops) is logged atDEBUG; any other exception is logged atWARNINGand never propagated AGENTOPS_AVAILABLEmodule-level boolean for code that wants to short-circuit instrumentation entirely
_init_langfuse and _init_wandb), so users may want to know the surface area.
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
framework_tag | str | required | Primary tag (e.g. "crewai", "autogen_v4"). Becomes the first entry in default_tags passed to agentops.init. |
tags | list[str] | None | None | Extra tags appended after framework_tag. |
Best Practices
Use for run-scoped tags only
Use for run-scoped tags only
Don't import agentops directly
Don't import agentops directly
Don’t import
agentops at the top of your adapter — gate it behind AGENTOPS_AVAILABLE or rely on the hook to no-op silently:Future-proof for new providers
Future-proof for new providers
New providers (Langfuse, W&B, etc.) will be added inside
_init_<provider> helpers in praisonai/observability/hooks.py — calling init_observability(...) will automatically pick them up; you don’t need to update adapter code:Related
AgentOps
AgentOps integration documentation
Framework Adapter Plugins
How to create custom framework adapters

