Armakuni Contact us
← All case studies

"Is this drug covered?" was asked again and again.
Each time, it paid for a fresh model call.

A U.S. health-data platform answers questions about drug formularies and insurance coverage, and the same question kept triggering the same expensive model call while large PDF jobs slowed the application for everyone. We put a cache in front of repeated questions and made model choice a configuration setting instead of something buried in code. Heavy PDF processing moved onto its own workers that scale separately, and every processed batch now gets a version so results can be compared later.

Before

Every time someone asked the same question, the system billed for it again.

The same servers ran both the big jobs and the small app.

After
10–50×faster answers when a question repeats
30–40%lower cost on model processing
90%less backend load from file transfers

As the platform reported.

Every time someone asked the same question, the system billed for it again

The platform processes drug formulary and insurance-coverage data so providers, insurers and patients can find out whether a medication is covered. Many questions are the same question asked again: does this plan cover this drug? Each one triggered a full model call, at full price, even when the answer hadn't changed since an hour ago.

The same servers ran both the big jobs and the small app

The PDF jobs that turned new formulary documents into searchable data ran on the same servers as the main application, so the whole system slowed down whenever things got busy. File uploads and downloads went through the application servers too. Testing a different model meant changing code and restarting servers, which made comparing models slow. There was also no way to tell which version of the processed data an answer came from, which made changes hard to compare or audit.

Each kind of work got its own path

The fix was to give each kind of work its own path instead of pushing everything through the same one. A repeated question now hits a cache instead of the model, since asking it again costs nothing. A heavy document goes to workers that scale on their own, which suits PDF processing's different demands from answering a question. Files move straight to storage, and switching models is now a matter of changing a setting, without redeploying anything.

How we built it

3 decisions, in the order we made them. Each one says what we did and why, with what it did drawn beside it.

  1. The system answers each question once and reuses that answer
  2. The model became a setting that could be changed without a new deployment
  3. Heavy PDFs on their own workers

The system answers each question once and reuses that answer

Built withElastiCache
A question arrivesAsked before? The answer is reusedNew? One model call, then kept
The engineering

ElastiCache stores earlier answers for reuse in the repeated-question workflow, so a common coverage question comes back from the cache instead of the model. Every processed batch gets its own version ID, and that identifier links each result to the data it came from, so a cached answer is always tied to a known version of the formulary.

Why: in coverage data the answer only changes when the formulary does, so the cache key is the question plus the data version.

The model became a setting that could be changed without a new deployment

Built withBedrockNova Pro
The model Nova ProAn alternative switched, no deployment
The engineering

A configuration layer lets the team switch models without changing application code or restarting servers. The stack includes Bedrock and Nova Pro, and the architecture supports evaluating alternatives, so a better or cheaper model can be tried in minutes.

Heavy PDFs on their own workers

Built withECSCloudFrontOpenSearch
Everything on one application App PDF workers Transfers
The engineering
  • ECS workers handle heavy PDF processing apart from the main application, and scale with demand, so a big batch no longer slows a user's question.
  • Direct file-transfer paths, through CloudFront to storage, move uploads and downloads off the application servers.
  • Each processed batch gets a unique version identifier, with OpenSearch supporting retrieval and comparison of processed information.
  • The database moved into private subnets, cutting direct exposure of the data layer.

The slow, costly jobs and the quick, cheap jobs no longer compete for the same machines, because each one now has its own path.

What we'd tell another CTO

1They cache each answer against the version of data it came from, since serving a cached answer again costs nothing. They also turned the model into a configuration setting, so comparing models now takes minutes.
2Heavy jobs run on their own workers now, and files go straight to storage. That means users never wait behind a batch, and the application servers no longer double as file servers. Each processed batch gets a version too, so an answer can be traced back to the data it came from, which makes it auditable.

What else changed

As the platform reported.

  • PDF processing runs apart from the application now, on workers that scale by themselves.
  • Every processed batch gets a version, so results can be compared or audited later.
  • The database out of public reach, in private subnets.

What comes next

More model evaluation on the configuration layer, and the same versioning applied across the data pipeline.

How we'd do it today

This project came before our current offers. Here's how we'd approach the same work now.

Most coverage questions are routine, so AI Inference Engineering would build the platform its own model for them on Amazon SageMaker AI, at about a tenth of the price, with a router sending each request to the smallest model that passes the tests and the hard ones to a frontier model through Amazon Bedrock. Before any switch, a golden set of real coverage questions with the right answers, plus a sealed set nobody tunes to, would have to pass, with a wrong coverage answer counted as critical.

Agent ControlPlane, part of AK Run, would make Amazon Bedrock AgentCore Gateway the only way to a model and record each call with the model used, who asked and what it cost.

Have a problem like this one?

A free workshop: a few hours with the architects who'd do the work, on your own systems. No cost.

Book a free workshop