Skip to main content

Multi-Agent Correlation

Use this feature to connect related AI decisions across agents and services under a single workflow context.

What Engineers Use It For

  • Link agent steps without custom correlation plumbing
  • Preserve workflow context across service boundaries
  • Query full execution chains during replay and incident response
  • Keep OpenTelemetry-compatible trace propagation

Basic Usage

from briefcase_ai 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)

# Trace view: Intake -> Clinical -> Decision

Cross-Service Propagation

from briefcase_ai.correlation import inject_trace_context, extract_trace_context

# Service A: Inject context into outbound headers
with briefcase_workflow("distributed_workflow", client):
headers = inject_trace_context()
requests.post(url, headers=headers)

# Service B: Extract context from inbound headers
@app.post("/process")
def process(request):
extract_trace_context(request.headers)
result = agent.process(request.json)

Captured Metadata

Workflow context captures:

  • workflow.id - unique workflow identifier
  • workflow.name - workflow name
  • workflow.agent_chain - ordered agent execution sequence
  • workflow.agent_count - number of agent steps
  • trace.id - distributed trace identifier

API Reference

See Semantic Conventions for correlation attribute definitions and Server API for endpoint reference.

Migration Note

briefcase remains available as a compatibility alias in 2.1.30. Use briefcase_ai imports for all new code. Alias removal is planned for 2.1.31.