Instrument
Add observability to your AI agents with automatic and manual instrumentation.
The Instrument section covers everything you need to add observability to your AI agents.
Overview
Risicare provides multiple ways to instrument your code:
- Auto-Instrumentation - Zero-code tracing of LLM providers
- SDK Decorators - Rich context with
@agent,@trace_*decorators - Framework Integrations - Native support for LangGraph, CrewAI, AutoGen
Choose Your Approach
SDK Reference
Core SDK configuration and decorators
Learn more
LLM Providers
OpenAI, Anthropic, Cohere, and more
Learn more
Frameworks
LangGraph, CrewAI, AutoGen integrations
Learn more
Progressive Integration
Start simple and add depth as needed:
Tier 0: Environment Variable
Set RISICARE_TRACING=true for automatic instrumentation of all LLM calls.
export RISICARE_API_KEY=rsk-xxx
export RISICARE_TRACING=true
python agent.pyTier 1: Explicit Init
Call risicare.init() for configuration control.
import risicare
risicare.init(environment="production")Tier 2: Agent Identity
Use @agent() to identify agent functions.
@agent(name="planner", role="orchestrator")
def plan(objective):
passTier 3: Sessions
Group traces with @session or session_context().
with session_context(session_id=user_session):
agent.run(query)Tier 4: Phases
Track decision phases with @trace_think, @trace_decide, @trace_act.
@trace_think
def analyze(): pass
@trace_decide
def choose(): pass
@trace_act
def execute(): passTier 5: Multi-Agent
Track messages with @trace_message, @trace_delegate.
@trace_message
def send_to_reviewer(msg): pass
@trace_delegate
def assign_subtask(task): passWhat Gets Captured
| Data | Auto | With Decorators |
|---|---|---|
| LLM requests/responses | ✓ | ✓ |
| Token counts & costs | ✓ | ✓ |
| Latency & timing | ✓ | ✓ |
| Agent identity | - | ✓ |
| Session grouping | - | ✓ |
| Decision phases | - | ✓ |
| Inter-agent messages | - | ✓ |
| Custom attributes | - | ✓ |