Multi-Agent Correlation
Automatic trace correlation across multi-agent workflows.
Overview
The correlation module provides automatic linking of traces across multiple agents in a workflow. All agents executed within a workflow context are automatically correlated without manual metadata tagging.
Features
- Automatic Correlation: Zero-code agent linking
- Distributed Tracing: OpenTelemetry-based context propagation
- Agent Chain Tracking: Visualize agent execution flow
- Cross-Service Support: HTTP header-based propagation
- W3C Standards: Standard traceparent/tracestate headers
Basic Usage
from briefcase.correlation import briefcase_workflow
with briefcase_workflow("prior_authorization", client) as workflow:
# Agent 1
result1 = intake_agent.process(claim)
# Agent 2 - automatically linked!
result2 = clinical_agent.process(result1)
# Agent 3 - automatically linked!
decision = decision_agent.process(result2)
# Dashboard shows: Intake → Clinical → Decision
Cross-Service Propagation
from briefcase.correlation import inject_trace_context, extract_trace_context
# Service A: Inject context into HTTP headers
with briefcase_workflow("distributed_workflow", client):
headers = inject_trace_context()
requests.post(url, headers=headers)
# Service B: Extract context from headers
@app.post("/process")
def process(request):
extract_trace_context(request.headers)
# Agents automatically join the workflow
result = agent.process(request.json)
Captured Metadata
Workflow context captures:
workflow.id- Unique workflow identifierworkflow.name- Workflow nameworkflow.agent_chain- Agent execution sequenceworkflow.agent_count- Number of agentstrace.id- Distributed trace ID
API Reference
See Semantic Conventions for correlation attribute definitions and the Server API for endpoint documentation.