Sponsored

The hidden cost of building healthcare AI agents in-house

Advertisement

Building an AI agent that clicks through a payer portal once, in a demo, on a clean test account, is not hard anymore. Frontier models are a commodity, and browser automation frameworks are open source. A small engineering team can have something working in a few weeks that looks, to anyone watching, like a finished product.

Getting that same agent to run unattended in a hospital’s revenue cycle, every day, for a year, without ever showing up in an incident report, is a different problem entirely. And for health systems weighing whether to build agentic AI in-house or bring in a partner, three costs in particular tend to get underestimated until it’s too late to course-correct cheaply.

“Building an agent is easy. Building an operating system to manage that agent is hard,” said Harpaul Sambhi, CEO of Magical, a healthcare AI agent company.

1. The cost of an agent that goes rogue

The most consequential failure mode is also the least visible in a demo: an agent that leaves its intended path without anyone noticing. Page state changes mid-task, an instruction turns out to be ambiguous, or a model simply picks the wrong next action. In a healthcare workflow, that can mean editing the wrong patient record or submitting to the wrong claim, and there’s often no signal that anything went wrong until the damage is already done, and someone has to clean it up.

It’s a risk that has made headlines well beyond healthcare. Leading frontier models from OpenAI and Anthropic recently made headlines when they exhibited unexpected, unintended behavior during testing, the kind of episode commonly described as a model “going rogue.”

“Do you trust this agent not to go haywire, not to do something wrong, or drift off a system it’s not supposed to leave?” Sambhi said.

Catching that kind of drift before it touches a real record requires runtime enforcement built specifically for it: deviation detection that flags the moment an agent leaves its expected workflow, and safe-stop behavior that halts the agent automatically rather than letting it compound a mistake. That’s infrastructure, not a system prompt asking a model to be careful, and building it properly typically takes a quarter or more.

2. The cost curve that doesn’t stay predictable

Model spend is the second cost that tends to surprise teams building their own agents. Routing every click decision through a frontier model, showing it a screenshot and asking what to do next, works fine in a demo and becomes financially unworkable at volume.

Forbes reported in May that Uber burned through its entire 2026 AI budget for Claude Code in just four months, an example of how quickly usage-based model pricing can outrun annual planning once a workflow is actually running in production.

“You can use frontier models for healthcare automation. But it’s going to cost about 10 times as much,” said Sambhi. “The reason we’re able to price this reasonably is we have opinionated model selection built in, which lets us use much more cost effective and proprietary models on parts of the workflow that don’t need the top-of-the-line.”

The alternative many teams underestimate is a purpose-built way for an agent to read a screen: structured screen segmentation paired with a smaller, fine-tuned model trained specifically on coordinate-based interaction, rather than a frontier model on every step. That takes weeks to prototype and months to make reliable across the range of interfaces a real healthcare workflow touches.

3. The cost of defending an audit alone

The third cost only shows up when something goes wrong, and by then it’s too late to build. If a payer or CMS audits an automated workflow, someone has to answer, precisely, what the agent did, why it did it, and whether every constraint held.

The stakes were made concrete by the Department of Justice’s $23 million settlement with UCHealth over an automated emergency-room coding rule. “We will hold accountable health care companies who adopt automatic coding practices that lead to unnecessary and improper billing,” the department said in announcing the settlement.

“If you get audited, you need to show, action by action, why your agent did what it did,” Sambhi said. “A DIY build isn’t going to have the logs, compliance or guardrails to defend that.”

Audit-readiness isn’t a feature that gets added after launch. It has to be built in from the start: scoped credential handling, permissions enforced at the tool-call level, and a complete, traceable record of every action an agent takes, ready before an auditor ever asks the question.

To learn more about how Magical builds and operates AI agents for healthcare revenue cycle and administrative workflows, visit getmagical.com.

Advertisement

Next Up in Artificial Intelligence

Advertisement