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
passOr with context managers:
from risicare import agent_context
with agent_context(
name="planner",
role="coordinator",
agent_id="planner-001"
):
# Agent code here
passAgent Attributes
| Attribute | Type | Description |
|---|---|---|
name | string | Agent name |
role | string | coordinator, specialist, worker |
agent_id | string | Unique instance ID |
parent_agent_id | string | Parent in hierarchy |
agent_type | string | Framework-specific type |
Agent Roles
| Role | Description |
|---|---|
coordinator | Orchestrates other agents |
specialist | Domain expert agent |
worker | Executes specific tasks |
reviewer | Validates outputs |
router | Routes to other agents |
Agent Dashboard
Agent List
View all agents with metrics:
| Column | Description |
|---|---|
| Name | Agent name |
| Role | Agent role |
| Invocations | Total calls |
| Avg Latency | Average response time |
| Error Rate | Failure percentage |
| Avg Tokens | Average token usage |
| Avg Cost | Average 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
| Attribute | Description |
|---|---|
sender | Sending agent name |
receiver | Receiving agent name |
message_type | request, response, broadcast |
content | Message content |
correlation_id | Links 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 contentFiltering Agents
# By name
name:researcher
# By role
role:coordinator
# By performance
latency_p99:>5000
error_rate:>0.1
# By activity
invocations:>1000