Skip to main content
GitHub

Agents

Multi-agent observability and analytics.

Track individual agent performance and inter-agent interactions.

Agent Identity

Define agent identity in your code:

from risicare import agent
 
@agent(name="researcher", role="specialist")
def research_agent(query: str):
    # Agent code here
    pass

Or with context managers:

from risicare import agent_context
 
with agent_context(
    name="planner",
    role="coordinator",
    agent_id="planner-001"
):
    # Agent code here
    pass

Agent Attributes

AttributeTypeDescription
namestringAgent name
rolestringcoordinator, specialist, worker
agent_idstringUnique instance ID
parent_agent_idstringParent in hierarchy
agent_typestringFramework-specific type

Agent Roles

RoleDescription
coordinatorOrchestrates other agents
specialistDomain expert agent
workerExecutes specific tasks
reviewerValidates outputs
routerRoutes to other agents

Agent Dashboard

Agent List

View all agents with metrics:

ColumnDescription
NameAgent name
RoleAgent role
InvocationsTotal calls
Avg LatencyAverage response time
Error RateFailure percentage
Avg TokensAverage token usage
Avg CostAverage cost per call

Agent Detail

Deep dive into a single agent:

  • Performance: Latency percentiles, throughput
  • Tokens: Usage by model
  • Errors: Top error codes, failure patterns
  • Interactions: Agents it calls and is called by

Agent Hierarchy

Track parent-child relationships:

@agent(name="orchestrator", role="coordinator")
def orchestrator():
    with agent_context(
        name="researcher",
        role="specialist",
        parent_agent_id="orchestrator"
    ):
        research()
 
    with agent_context(
        name="writer",
        role="specialist",
        parent_agent_id="orchestrator"
    ):
        write()

Visualized as:

orchestrator (coordinator)
├── researcher (specialist)
└── writer (specialist)

Inter-Agent Communication

Track messages between agents:

from risicare import trace_message
 
@trace_message(sender="orchestrator", receiver="researcher")
def send_research_request(task: str):
    return researcher.process(task)

Message Attributes

AttributeDescription
senderSending agent name
receiverReceiving agent name
message_typerequest, response, broadcast
contentMessage content
correlation_idLinks request/response

Agent Delegation

Track when agents delegate tasks:

from risicare import trace_delegate
 
@trace_delegate(delegator="planner", delegate="executor")
def delegate_execution(plan: dict):
    return executor.execute(plan)

Agent Analytics

Performance Comparison

Compare agents across:

  • Latency (P50, P95, P99)
  • Error rate
  • Token efficiency
  • Cost per operation

Interaction Graph

Visual network showing:

  • Agent nodes
  • Communication edges
  • Message volume
  • Error paths

Bottleneck Analysis

Identify slow agents:

  • Agents on critical path
  • High-latency operations
  • Token-heavy agents
  • Error-prone agents

Agent Iterations

Track iterative agent loops:

@agent(name="refiner", role="specialist")
def iterative_refine(content: str, max_iterations: int = 3):
    for i in range(max_iterations):
        with agent_context(
            name="refiner",
            metadata={"iteration": i + 1}
        ):
            content = refine_step(content)
            if is_good_enough(content):
                break
    return content

Filtering Agents

# By name
name:researcher

# By role
role:coordinator

# By performance
latency_p99:>5000
error_rate:>0.1

# By activity
invocations:>1000

Next Steps