docs/examples/medical-agent-delegation.md
Medical triage and delegation system built with Pydantic AI, demonstrating how an orchestrator agent (triage_agent) coordinates multiple specialized agents (e.g. cardiology, neurology, and senior clinician).
Demonstrates:
This example shows how to use multiple Pydantic AI agents to simulate a medical triage workflow.
The system includes:
The triage_agent uses two tools:
consult_specialist — routes the complaint to a domain specialist.consult_senior_doctor — escalates the case for critical or ambiguous scenarios.Each specialist produces a structured MedicalReport, and the senior doctor produces a structured TreatmentPlan.
The orchestrator then compiles both into a final TriageFinalOutput.
With dependencies installed and environment variables set, run:
python -m pydantic_ai_examples.medical_agent_delegation
Make sure to set a valid **Cohere API key** or replace the model reference:
```bash
export CO_API_KEY="your-cohere-api-key"
You may also switch to an OpenAI or Anthropic model if preferred:
MODEL = 'openai:gpt-5.2'