Inspiration

Hospitals readmit 1 in 5 patients within 30 days. The root cause is almost always the same — no one connected the dots between the patient's diagnoses, their medications, and the treatment guidelines before discharge. We built the Patient Risk Stratification Agent to be that connection — an agent that assembles other agents to see the full picture.

What it does

A fully A2A-compliant external agent that orchestrates two MCP servers in real time to produce a unified patient risk profile:

  1. Calls Clinical Decision Support MCPcheck_treatment_guidelines and flag_contraindications
  2. Calls Prior Auth Copilot MCPanalyze_patient_fhir
  3. Synthesizes all three results via Gemini 2.0 Flash into a structured risk stratification

Output includes:

  • risk_level — critical / high / medium / low
  • clinical_priority_score — 1 to 100
  • Top 3 recommended interventions with urgency and rationale
  • pa_complexity — simple / moderate / complex
  • 2-sentence handoff summary for care transitions

How we built it

  • External A2A Agent in Node.js implementing the Google A2A protocol — GET /.well-known/agent.json and POST /a2a
  • MCP Client using @modelcontextprotocol/sdk SSE transport to connect to both local MCP servers
  • Gemini 2.0 Flash via raw fetch with responseMimeType: "application/json" for guaranteed structured output
  • Cloudflare Tunnel for public accessibility
  • Demo frontend — glassmorphism dashboard showing risk score, interventions, and handoff summary visually
  • Published to Prompt Opinion as an External A2A Agent

Challenges we ran into

The hardest part was making the multi-agent chain resilient. If either MCP server is down, the agent can't just crash — it needs to degrade gracefully, report what it missed to Gemini, and still return a useful risk stratification. Implementing that fallback logic took careful error handling across three async tool calls.

Getting Prompt Opinion to recognize the A2A agent card also required serving it at /.well-known/agent-card.json in addition to the standard /.well-known/agent.json path.

Accomplishments that we're proud of

This is the only submission in the hackathon that demonstrates a true multi-agent chain — one agent orchestrating two MCP servers, synthesizing their outputs, and returning a unified clinical decision. That's literally what "Agents Assemble" means. We built the endgame.

What we learned

A2A and MCP are complementary standards, not competing ones. MCP gives agents tools. A2A gives agents the ability to collaborate. The real power is when you combine them — an orchestrator agent that knows which specialist MCP to call for which problem.

What's next for Patient Risk Stratification Agent

  • Add Discharge Summary Translator as a third MCP in the chain — automatic plain-language discharge instructions for high-risk patients
  • Real-time EHR integration — triggering risk stratification automatically on admission via FHIR webhooks
  • Outcome tracking — closing the loop by comparing predicted risk scores against actual 30-day readmission data

Built With

Share this project:

Updates