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(
    "planner-001",                   # agent_id (required, positional)
    agent_name="planner",
    agent_role="orchestrator",
    agent_type="custom",
    version=1,
):
    # Agent code here
    pass

Agent Attributes

AttributeTypeDescription
agent_idstringUnique instance ID (required, first positional argument)
agent_namestringHuman-readable agent name (falls back to agent_id)
agent_rolestringorchestrator, worker, specialist, etc.
parent_agent_idstringParent in hierarchy (set automatically when nesting)
agent_typestringFramework-specific type (langgraph, crewai, autogen, custom)
versionintAgent version number
metadatadictCustom agent metadata

Agent Roles

RoleDescription
orchestratorCoordinates other agents
workerExecutes assigned tasks
supervisorMonitors and validates
specialistDomain expert
routerRoutes messages/tasks
aggregatorAggregates results
broadcasterBroadcasts to multiple agents
criticReviews and critiques
plannerCreates execution plans
executorExecutes plans
retrieverRetrieves information
validatorValidates outputs

JS SDK has a different role set

The JavaScript SDK defines 7 roles: orchestrator, worker, reviewer, planner, executor, critic, custom. See the JS SDK reference for details.

Agent Dashboard

Risicare Agents dashboard showing agent performance metrics, success rates, and trace counts

The KPI strip shows: Total Agents, Invocations (with trace count), Success Rate (with errors), Avg Latency (with P95), Total Errors (with error rate), and Total Cost (with tokens).

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:

Agent detail view showing 8 KPI cards (Invocations, Success Rate, Avg Latency, Total Cost, Errors, Avg Tokens, Total Traces, Last Active) with Recent Traces, Tool Usage, and Error Breakdown tabs

  • 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="orchestrator")
def orchestrator():
    with agent_context(
        "researcher-001",
        agent_name="researcher",
        agent_role="specialist",
    ):
        research()
 
    with agent_context(
        "writer-001",
        agent_name="writer",
        agent_role="specialist",
    ):
        write()

Visualized as:

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

Inter-Agent Communication

Track messages between agents:

from risicare import trace_message
 
@trace_message(target="researcher-001", target_name="Researcher")
def send_research_request(task: str):
    return researcher.process(task)

Message Types

TypeDescription
taskTask assignment
resultTask result
statusStatus update
errorError notification
queryInformation request
responseInformation response
broadcastBroadcast to all
directDirect message
proposalPropose action
voteVote on proposal
consensusConsensus reached
conflictConflict detected
heartbeatAgent alive signal
shutdownShutdown signal
handoffHandoff to another agent

JS SDK has a different message type set

The JavaScript SDK defines 5 message types: REQUEST, RESPONSE, DELEGATE, COORDINATE, BROADCAST. See the JS SDK reference for details.

Message Attributes

AttributeDescription
senderSending agent name
receiverReceiving agent name
message_typeOne of the types above
contentMessage content
correlation_idLinks request/response

Agent Delegation

Track when agents delegate tasks:

from risicare import trace_delegate
 
@trace_delegate(target="executor-001", target_name="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(
            "refiner-001",
            agent_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:orchestrator

# By performance
latency_p99:>5000
error_rate:>0.1

# By activity
invocations:>1000

Next Steps