Skip to main content
GitHub

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:

  1. Auto-Instrumentation - Zero-code tracing of LLM providers
  2. SDK Decorators - Rich context with @agent, @trace_* decorators
  3. Framework Integrations - Native support for LangGraph, CrewAI, AutoGen

Choose Your Approach

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.py

Tier 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):
    pass

Tier 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(): pass

Tier 5: Multi-Agent

Track messages with @trace_message, @trace_delegate.

@trace_message
def send_to_reviewer(msg): pass
 
@trace_delegate
def assign_subtask(task): pass

What Gets Captured

DataAutoWith Decorators
LLM requests/responses
Token counts & costs
Latency & timing
Agent identity-
Session grouping-
Decision phases-
Inter-agent messages-
Custom attributes-

Next Steps