← Case studies

Case study · Healthcare technology

An AI assistant for patient records, built on AWS in the client’s region

Grootan built a health assistant on Amazon Bedrock, Bedrock AgentCore and Strands Agents. Seven of its eleven flows run on small language models, everything runs in the client’s AWS region, answers start in about a second, and prompt caching cut cost per turn by about 40%.

  • Built on AWS
  • Bedrock AgentCore
  • Bedrock Guardrails
  • Signed off
~40%Lower cost per turn, prompt caching
~90%Of input tokens served from cache
~1 sTo the first streamed word
7 of 11Flows on small language models

The problem

Patients needed answers from long health records, and the records couldn’t go anywhere

The client runs a platform for patient health records. Records grow long, and finding a patient’s history or seeing how their health has changed over time takes a lot of searching. The client wanted an AI assistant that patients could simply ask: what has changed, what a result means, what they are taking.

Health data made that harder than it sounds. To answer a question, the AI model has to read the patient’s records, so every question sends health data to whoever runs the model. The assistant also had to feel like a conversation, and cost little enough to offer to every patient.

In region

Close to the client

Health data handled in the client’s AWS region, with no new vendor in the path.

Fast

Conversational

Answers that start arriving in about a second, not after a long pause.

Affordable

Cost you can see

AI cost under control, and visible for every patient and every conversation.

The solution

A health assistant built entirely on managed AWS services, in the client’s region

We built the assistant on Amazon Bedrock, Amazon Bedrock AgentCore and Strands Agents, running in the same AWS region as the client. Patients sign in with the client’s existing Keycloak, so there was no new user store and no user migration. AgentCore checks that sign-in token before any request reaches the agent, runs every conversation in its own isolated microVM, and passes the patient’s own token to the health-record API. The agent can only ever fetch that patient’s records.

The assistant runs as eleven flows, and seven of them use small language models (SLMs) on Amazon Bedrock for specialised tasks. Answers stream word by word. General medical questions are answered from a Bedrock Knowledge Base with the sources shown, and combined with the patient’s own records: explaining what metformin does, and noting that the patient takes it. Bedrock Guardrails check every model call. AgentCore Memory keeps each conversation for seven days, then deletes it.

The agent started as a single assistant. With Strands we then built a multi-agent version, an orchestrator that calls two specialist agents as tools, without changing framework.

Everything is defined in one AWS CDK stack, in TypeScript, the same language as the agent and the React app. Every deployment is tagged with its git commit, and Amazon CloudWatch shows what each patient, conversation and turn costs.

Why we built it this way

One rule decided every layer: managed AWS services, in the client’s region

For a health assistant, choosing a model platform is really choosing where patient data goes. The client already runs on AWS, and Amazon Bedrock kept model calls on AWS, in the same region as the client, under the agreement they already have. It also let us match the model to the task: small language models for specialised flows, without adding a second provider. We applied the same test to every other layer.

DecisionWe choseInstead ofBecause
AI models
Amazon Bedrock
A direct model API, another cloud’s AI platform, or a self-hosted open modelModels run on AWS in the same region as the client, with no new vendor for health data: Bedrock is covered by the client’s existing AWS agreement. Small and larger models sit behind one API, so each flow can use the model that fits it. Access is through IAM roles, not API keys, and every call can be audited in CloudTrail.
Agent platform
Amazon Bedrock AgentCore
AWS Lambda, ECS or EKS containers, another cloud’s agent service, or self-hostingLogin checks, a microVM per conversation, conversation memory and tracing come built in. On Lambda or containers we would have built and run each of those ourselves.
Agent framework
Strands Agents (TypeScript)
LangGraph, CrewAI, the OpenAI Agents SDK, the original Bedrock Agents, or our own loopBuilt by AWS for Bedrock and AgentCore, so prompt caching and guardrails were settings rather than code. The brief also asked for TypeScript, which CrewAI doesn’t offer.
Safety
Amazon Bedrock Guardrails
Rules in the prompt, our own filters, or a third-party moderation APIApplied by Bedrock on every model call, so they can’t be talked around from the prompt, and no other vendor sees patient conversations.
Medical knowledge
Bedrock Knowledge Bases
Answers from the model’s memory, or a self-managed vector databaseSourced answers through one managed API inside AWS, with no embedding pipeline of our own to run.
Cost and monitoring
Amazon CloudWatch
A third-party observability tool, or the monthly AWS billCost per patient and per conversation, without sending conversation logs to another vendor.
Infrastructure
AWS CDK (TypeScript)
Console set-up, raw CloudFormation or TerraformThe same language as the agent and the app, with official AgentCore constructs. Every resource can be reviewed and rebuilt.

Making the guardrails strict, but not obstructive

The guardrails cover content filters on input and output, prompt-attack protection, five health-specific denied topics such as other people’s health data, and masking for 14 types of personal data, while deliberately allowing the patient’s own name and date of birth. Strict was easy. Useful took evidence: patients asking for “all my medications” were at first blocked as if they were asking about someone else. Guardrail tracing showed which policy fired. Those two topics moved to detect-only on input while output checks still block the real cases, and every change is a pinned guardrail version in CDK.

Keeping cost flat as conversations grow

Strands made prompt caching a setting. The fixed part of every request, the instructions, the patient’s emergency card and the tool definitions, is cached, so about 90% of input tokens come from cache and each turn costs about 40% less. A sliding window sends only the last eight messages, and hooks strip spent tool data after every turn, so a long conversation doesn’t get more expensive per turn.

The trade-offs we accepted

AgentCore is newer than Lambda or ECS, with fewer community answers and recent CDK constructs. The Strands TypeScript SDK is younger than the Python one: we overrode one internal method to control caching and adapted to a change in version 1.7.0, and documented both. For an assistant handling health data, built-in isolation, login checks and memory were worth it. And because AgentCore runs any agent framework, the client isn’t locked into ours.

The impact

A fast assistant with a clear cost per patient, and a path to production on small models

The proof of concept was delivered with a production guide, and the client signed off. The guide covers long-term memory across sessions and online evaluations through AgentCore. After the proof of concept, the goal is to move the remaining four flows to small language models as well.

~40%Cost per turn

Lower, from prompt caching on the fixed part of every request.

~90%Cached input

Of input tokens served from the Bedrock prompt cache.

~1 sFirst word

Answers stream as they are written.

7 of 11Flows on SLMs

Specialised tasks run on small language models. The goal after the PoC is all eleven.

7 daysRetention

Conversations in AgentCore Memory are deleted automatically.

~$0.15Runtime a month

Estimated AgentCore Runtime cost at proof-of-concept volume of 1,000 turns.

AWS at a glance
AWS services
Amazon Bedrock · AgentCore Runtime, Memory and Observability · Bedrock Guardrails · Bedrock Knowledge Bases · Amazon CloudWatch · AWS CDK · Amazon S3 · Amazon CloudFront · IAM
Models
Small language models on Amazon Bedrock for 7 of 11 flows; goal: SLMs for every flow after the PoC
Agent
Strands Agents in TypeScript; orchestrator with two specialist agents as tools; three typed tools
Region
The same AWS region as the client
Identity
The client’s existing Keycloak, validated by AgentCore Runtime
Stage
Proof of concept with a production guide; client signed off

Facing a similar challenge?

Building an AI assistant on sensitive health data in AWS?

Talk to the team that built this one. We’ll look at where your data lives, which tasks a small language model can handle, and what a proof of concept on AWS would take.

AWS partner with a customer asking for something similar? We deliver Amazon Bedrock and AgentCore proofs of concept alongside AWS partners, including the decision record behind each choice. Talk partner delivery →

Related services: AI agents · Knowledge assistants · AI proof of concept · Keycloak and IAM · Cloud and AWS

Have a similar problem?

Let's look at yours

Tell us what you're working on. An engineer replies, not a sales script.