wiqilee.dev
← All writing
11 May 202611 min readARIA

Eighteen Warnings in Fourteen Seconds: Why I Created ARIA

A clinical reasoning engine for polypharmacy, built with Rust, Python, and Gemini 2.5 Pro, capable of communicating with other AI agents via the A2A v1 protocol

HealthcareFHIRGeminiAI safety
A pharmacist in Jakarta, Indonesia, dismissed eighteen drug-interaction warnings in just fourteen seconds. That moment inspired the creation of ARIA.
A pharmacist in Jakarta, Indonesia, dismissed eighteen drug-interaction warnings in just fourteen seconds. That moment inspired the creation of ARIA.

A pharmacist friend in Jakarta, Indonesia, once showed me her screen: eighteen drug-interaction pop-ups for a single elderly patient on twelve medications. She closed every one of them in fourteen seconds without reading a single line. Not because she didn’t care, but because she had been trained, like every clinician I’ve ever met, to treat those alerts as noise.

Then she said something that has stayed with me ever since.

If I read every alert, I would never get to see another patient.

That single sentence captures the failure mode of modern clinical decision support, compressed into just thirteen words. We have spent two decades adding more alerts to electronic health records, yet the alert override rate has barely budged. According to the WHO’s 2024 report on the global burden of preventable medication harm, medication errors cost the world $42 billion every year, and low- and middle-income countries lose roughly twice as many healthy life years to those errors as high-income countries. A 2025 systematic review in PLOS One places Africa and Southeast Asia at the top of that burden.

And the tools we give to clinicians are mostly still static lookup tables that flag drug pairs. They cannot reason about the patient in front of them. They cannot explain why an interaction is dangerous at the molecular level. They cannot prioritize what matters most. They just shout.

So I built one that doesn’t.

What ARIA Is, In One Sentence#

ARIA agent reasoning pipeline: from patient medication input to structured clinical report, showing service-to-service communication over the A2A and MCP protocols.
ARIA agent reasoning pipeline: from patient medication input to structured clinical report, showing service-to-service communication over the A2A and MCP protocols.
ARIA agent reasoning pipeline: step-by-step flow from patient medication input to structured clinical report, showing how services communicate over A2A and MCP protocols.
ARIA agent reasoning pipeline: step-by-step flow from patient medication input to structured clinical report, showing how services communicate over A2A and MCP protocols.

ARIA, short for Adaptive Risk Intelligence for Polypharmacy Assessment, is a clinical reasoning engine that takes a medication list and patient context and returns a structured clinical report explaining why each interaction matters, when it is likely to peak, what to deprescribe first, and how much risk you can expect to remove at each step.

It is not a drug-interaction checker. It is the layer that decides what a clinician should actually do about the interactions a checker would surface.

Three things make ARIA different from anything else I could find:

ARIA Polypharmacy Specialist on the Prompt Opinion Marketplace: a versioned agent card, ready for A2A calls with no custom integration required.
ARIA Polypharmacy Specialist on the Prompt Opinion Marketplace: a versioned agent card, ready for A2A calls with no custom integration required.

The Architecture, And Why It Is Polyglot#

System overview: ARIA’s A2A agent orchestrates the MCP server, clinical reasoning models, and the frontend, integrating public clinical data sources to deliver actionable insights to clinicians.
System overview: ARIA’s A2A agent orchestrates the MCP server, clinical reasoning models, and the frontend, integrating public clinical data sources to deliver actionable insights to clinicians.
ARIA Cloud Run services: A2A agent and MCP server running in asia-southeast2, fully deployed and ready for clinical workflows.
ARIA Cloud Run services: A2A agent and MCP server running in asia-southeast2, fully deployed and ready for clinical workflows.

Most demos at a healthcare AI hackathon are a single Python script behind a chatbot. ARIA is not. It is three independently deployable services, in three languages, because each layer has a different job.

The reasoning backbone is a Rust server that implements ten clinical tools over the Model Context Protocol (MCP): drug interaction checks, mechanistic reasoning, phenotype-adjusted risk scoring, N-drug graph construction, anticholinergic and sedation burden, temporal cascade modeling, deprescribing plan generation, evidence grading with PubMed citations, alternative-drug suggestion, and FHIR R4 medication ingestion.

Why Rust? Three reasons: predictable tail latency on a Cloud Run cold path; a memory footprint small enough that the server fits comfortably in 512 MB; and no garbage-collection pauses to slow down concurrent fan-out across ten upstream APIs.

The MCP server is stateless. There is no database. There is no on-disk cache. Every request hits OpenFDA, RxNorm, PubMed, and DrugBank fresh. That may sound slow until you realize that drug safety data freshness matters more than the few hundred milliseconds a cache would save. I would rather call OpenFDA on every request than serve a clinician a stale interaction warning.

The orchestration layer is a FastAPI service implementing the A2A v1 protocol. A LangGraph state machine sequences the Rust MCP tools into one coherent reasoning pipeline: intake → normalize → graph build → phenotype score → temporal model → evidence grade → deprescribing plan → report assembly.

The agent exposes /a2a/v1 for JSON-RPC clients and /.well-known/agent-card.json for automatic discovery. It is the public, A2A-compliant entry point. The Rust MCP server is a private implementation detail behind it. Other agents in the Prompt Opinion ecosystem talk to the A2A endpoint and never see the MCP server directly.

The clinician-facing surface is a Next.js 15 app on Vercel, with React Three Fiber for 3D visualization. Features include a force-directed interaction graph, an animated temporal risk timeline, a phenotype radar chart, and a deprescribing waterfall that shows expected risk reduction at each step. One-click PDF export is available for the chart.

The frontend is the surface a clinician would actually use. The A2A endpoint is the surface another agent would use. Both call the same pipeline.

The Ten-Day Wire Format Bug That Almost Broke The Demo#

Here is the part of building ARIA that taught me the most.

Ten days before the hackathon deadline, ARIA was live on Cloud Run, the web app worked, curl tests against the A2A endpoint returned full clinical reports in 45 seconds, and the Prompt Opinion marketplace listing was published. Every box checked. Then I tried to consult ARIA from a Prompt Opinion conversation and got this error.

The external agent did not respond with a task.

My response payload had a status.state of completed, a populated artifacts array, the full Markdown clinical report inside, and a kind: “task” discriminator at the root. By every reading of the A2A v0.3 specification I had been working from, that was a valid task response. Prompt Opinion disagreed.

I spent the next two days debugging every plausible cause: wrong protocol version on the agent card, missing protocolBinding field on the AgentInterface, top-level URL needed or not needed, kind discriminator on parts, empty history array required or forbidden. Fifteen commits. Twenty curl tests. Three Discord messages to the platform team.

The root cause was hiding in a .NET migration guide inside the official A2A protocol repository. The a2aproject/a2a-dotnet migration guide from v0.3 to v1 documented something the Po-specific guide had glossed over: the wire format itself changed.

In v0.3, a task response looks like this:

{ “result”:{ “kind”:“task”, “id”:“abc”, “status”:{“state”:“completed”}, “artifacts”:[/*…*/] } }

In v1, the same response looks like this:

{ “result”:{ “task”:{ “id”:“abc”, “status”:{“state”:“TASK_STATE_COMPLETED”}, “artifacts”:[/*…*/] } } }

Three breaking changes in one diff. The kind discriminator at the root is gone, replaced by a named task wrapper. The state enum moves from kebab-case (completed) to SCREAMING_SNAKE_CASE (TASK_STATE_COMPLETED). The parts inside the artifact lose their kind discriminator too, becoming flat objects with just a textfield. This is ProtoJSON serialization, the same convention Google’s protobuf libraries use when they emit JSON.

I had been emitting v0.3 wire format inside v1 envelopes for two days. Prompt Opinion’s deserializer was correctly rejecting the response. The error message “did not respond with a task” was literally true. The deserializer could not find the task key it was looking for.

The fix took thirty minutes of code changes and three lines of test verification. The lesson took two days to learn, and it is the most important thing I will take away from this hackathon.

Specifications change. Migration guides exist. Read the one from the language closest to the reference implementation, not just the one in your own language.

FHIR Integration Without Per-Tenant Code#

The other piece of ARIA that I think will outlast the hackathon is the way patient context flows through the system.

Most clinical AI demos hardcode a single FHIR server URL, maybe a single bearer token. The moment you try to deploy that thing to a real hospital network, you discover that every tenant has a different FHIR endpoint, a different OAuth provider, a different token expiration policy, and a different patient identifier scheme. The integration tax is brutal.

ARIA solves this with the SHARP Extension Specs pattern: three HTTP headers, propagated per request, that any A2A client can send.

Prompt Opinion sends these headers natively. A Prompt Opinion workspace pointed at a Cerner endpoint and a workspace pointed at an Epic endpoint can both consult the same ARIA instance, and ARIA routes each request to the right FHIR server. No code changes. No per-tenant deployment. The MCP server contains zero Epic-specific or Cerner-specific code, because the FHIR base URL travels with every request.

Bearer tokens never appear in logs. The agent middleware strips them, normalizes the Bearer prefix, and forwards the raw token to the FHIR tool through a per-request context dict. Presence-only logging means I can debug routing without ever printing a credential.

This is the difference between a demo that works once and a system that could land in a hospital.

What I Got Wrong, And What I Would Do Differently#

Three things stand out in hindsight.

1. I optimized for Pro before I had a baseline#

My first pipeline ran every reasoning step through Gemini 2.5 Pro. A four-drug analysis took 80 to 110 seconds. Prompt Opinion’s blocking budget for an A2A SendMessage call is around 50 seconds. I was getting timeouts on every Po invocation even though the pipeline eventually finished.

The fix was to tier the model. Flash handled the structural and computational tools, and Pro was used only for the three highest-stakes clinical reasoning stages: mechanism explanation, deprescribing plan, and report generation. The same case dropped to 41 to 49 seconds and stayed inside the budget.

If I had measured cold-path latency on day one instead of day three, I would have made that decision before building the rest of the pipeline around the wrong assumption.

2. I treated the agent card as documentation, not as code#

The /.well-known/agent-card.json file is not a README. It is a typed contract that other agents will deserialize. Every field name matters. Every enum value matters. I lost most of a day to a protocolBinding field that was documented in the migration guide and silently required by the platform.

Next time, I will validate the agent card against the official JSON schema as part of CI, not by curling it after each deploy.

3. I underestimated how much Markdown matters#

My first version returned structured JSON from the A2A endpoint. Clean schema, easy to test. Useless inside Prompt Opinion because the orchestrator would summarize it back to the user in two sentences and lose the entire clinical report.

When I switched the artifact text to Markdown with proper headings, tables, and bullet lists, Prompt Opinion rendered the full clinical report inline. Same data, same backend. The presentation layer is the product.

What ARIA Does Today, In Numbers#

For a 72-year-old female patient on warfarin, aspirin, ibuprofen, and atorvastatin, with CKD stage 3:

Every number above is reproducible. Click the 72F CKD3 quick-test preset on Vercel, or send the same payload over A2A from any client that speaks v1.

Where ARIA Goes Next#

The hackathon submission is a milestone, not a finish line. Five things on the roadmap:

The Ten-Year Bet#

I think the next decade of clinical AI will be defined less by how good the models are and more by how well the agents around them are designed. The model is the easy part now. The hard parts are calibration, presentation, interoperability, and trust.

ARIA is a small step toward agents that meet clinicians in their actual workflow. Not another pop-up to dismiss in fourteen seconds. A reasoning partner that does the prioritization a clinician does not have time to do alone.

If you are a clinician, try the demo. If you are an engineer, read the code. If you run a hospital system that wants to pilot it, get in touch.

Eighteen warnings, fourteen seconds. We can do better than that.

Try ARIA by exploring the web app, checking out the source code on GitHub, browsing the Prompt Opinion marketplace listing, or viewing the agent card JSON specification.

Built solo by me (Wiqi Lee) at Wiqi Labs for the Prompt Opinion “Agents Assemble: Healthcare AI Endgame” Hackathon in 2026, ARIA uses only public, sourced data, including RxNorm, DrugBank Open Data, OpenFDA, PubMed, HAPI FHIR public sandbox, and synthetic patient profiles, with no real Protected Health Information used in development or testing.

Also on Medium

I publish every article on Medium too. Follow me there to get new posts in your feed, or leave a clap if this one helped.

Wiqi LeeData scientist, AI/ML researcher and software engineer. More about me.