Blog
December 3, 2026

Applying AI Agents to Expert Work in Healthcare

Applying AI Agents to Expert Work in Healthcare

AI agents won’t take over expert work in healthcare until people can trust them to get it right every time. Today they handle plenty of high-volume work, like support tickets and routine code. Very few are trusted with high-stakes work where a mistake affects someone’s health. That’s the work we built ours to do.

Our Clinical Research Agent (CRA) writes the quality measures Garner uses to grade doctors. Most people assume agents will take on work like this once the models get smarter. Better models help, but CRA works because we give the model less room to be wrong.

Why it's hard

Garner helps patients find the best doctors by grading the care each doctor actually delivers. When you see a doctor, your insurer gets a claim, a coded record of the diagnoses, procedures and dates involved. We grade doctors with quality measures, run across more than 60 billion claims covering more than 320 million patients. A measure tests one part of a doctor's care, such as how often their knee-replacement patients develop an infection. It has to say precisely which patients count, what outcome counts against the doctor, how long to watch for it and who to leave out. Writing one takes a clinical researcher hours of reading and judgment calls they have to stand behind.

Give a frontier model that knee question, plus access to PubMed and our measure format, and it will return a complete measure that reads like a researcher wrote it.

Looking right isn't enough. Get any detail wrong and the measure still runs. It returns a score for every doctor, and nothing flags it. A good surgeon just looks average, and patients can't tell the difference before seeing them.

Shrinking the search space

An LLM gets details wrong in ways that are hard to see. Ask the same question twice and you get two measures: one watches for infection for 30 days, the next for 90. One fix is to run the model several times and take the majority answer, but agreement isn't accuracy. In our early tests, even when every run agreed, CRA still missed about 1 in 10 of the details in a measure our clinical team had verified. The runs made the same mistakes, so sampling more was never going to fix it. 

A model asked to write a measure from scratch can write it in endless ways, and most of them are a little wrong in ways nobody will notice. So most of our work on CRA went into limiting what the model is allowed to write, and into breaking the problem into pieces small enough to get right.

We don't let the agent write SQL

The obvious design is to have a model write SQL against the claims data for each measure. SQL can say nearly anything, so every measure comes out a little different. The queries are messy, hard to debug and slow. Two versions of the same measure can differ in ways nobody notices, and a clinical decision buried in a SQL query is hard for a researcher to check, let alone sign off on.

Instead, we defined a clinical language. It has terms for who counts, what counts against the doctor, the time windows and the exclusions, and little else. CRA writes each measure in that language, our compiler checks it, then we run it. That one decision gives us:

  • Measures a researcher can review. A measure reads as a short set of clinical choices instead of a page of SQL, so a researcher can check it and sign off on it. Every measure takes the same form, so two drafts that disagree differ in a specific field a researcher can settle.
  • Whole classes of mistakes ruled out. The language can't express many of the mistakes free-form SQL allows, and our clinical methods are enforced by the compiler, not left to the prompt. The same measure always runs the same way.
  • Speed at scale. Because every measure shares one structure, we evaluate them together instead of as hundreds of separate queries. Evaluating all our medical claims takes about 5 minutes, roughly 30x faster and 100x cheaper than the warehouse-based approach it replaced.

This has a cost. CRA can't guess its way past a failed check, so it asks more questions and turns down some measures we could have approximated. We accept that, because a researcher can only rely on CRA if every measure it hands over was built correctly.

We don’t let one agent handle every kind of measure

Early on, we also treated writing measures as a single problem: one agent, one set of instructions, every kind of measure. It struggled, because the lessons didn't generalize. A fix that helped a surgical-complication measure would hurt a screening measure, and every improvement seemed to cost us somewhere else.

The lesson: not all measures are alike. A researcher knows that without thinking; the agent had to be told.

So we broke the problem into archetypes: families of measures that share the same shape, like outcomes after a procedure or care that should or shouldn't happen. Each got its own research instructions, its own training and held-out evaluation sets, and its own round of tuning and validation.

Within an archetype, the questions are similar, the research looks alike and the measure has a familiar structure. That meant each archetype could get its own guidance and its own evals, and an improvement in one stopped breaking another. The agent's first step on any question is to work out which archetype it belongs to.

The single-agent version never got past 60% precision (how much of what it wrote was right) and 38% recall (how much of what the measure needed, it captured). With archetypes, CRA averages about 95% precision and 84% recall on the measures we tune it against.

Precision and recall on the measures we tune against: one agent for every kind of measure, then one set of guidance and evals per archetype.

How we measure accuracy

We grade CRA against reference measures our clinical team has verified, and we compare by meaning, not by text. A text diff marks a correct measure wrong when a concept has a different name. It marks a wrong one right when the text is nearly identical but the group of patients it counts has changed.

Graded this way, precision moves by less than a point from one run to the next. The remaining gap is why a researcher still signs off on every measure.

Grading by meaning, illustrative: matching the text gets both drafts backwards. Checking the meaning gets both right.

What we're building next

We believe this is how most of the expert work in healthcare should be done. Experts set the methods and check the results, and the agent does the research and writing in between. The important part is that it gets it right consistently. CRA proved this is possible. The time savings are significant as well, with a measure that used to take a researcher about seven hours now taking under 30 minutes of their time.

Today we grade doctors on more than 650 measures across 88 clinical subspecialties. Over the next few months CRA will help us build hundreds more, which means patients will be able to find the best doctor for much more of the care they need.

One problem is still open. Agents did most of the work of building CRA, but only after weeks of a person breaking down the problem and building a score the agents couldn't game. We want agents that can do that part too. If that sounds like your kind of problem, we should talk.

About the author

Viren Gupta is a Software Engineer at Garner Health and built the Clinical Research Agent (CRA). Before Garner, he led engineering teams at Oscar Health, and at Box he led the teams behind Box Sign and Relay, work that earned him several patents. He started out building content-management systems for pharmaceutical companies at Glemser Technologies.

What I love about working at Garner

Most of my career has been spent building software in healthcare, but what we build here directly guides patients toward better clinical outcomes.

Create your free account

Give your employees the best care