All work
Applied AI

Evaluating a Patient-Facing AI Agent

A patient-facing chatbot was behaving unpredictably, and the way it was being improved was to edit a text box and read a few chats. I helped replace that with something closer to engineering: fixed scenarios, a sandbox, scored rounds, and written reasons for every change.

Role
Built the evaluation approach, co-ran the rounds
Result
About 74% to about 90% of scenarios scoring 8/10 or better
Timeline
April to May 2026
Team
A customer-success lead and an engineer

The shape of the problem

The agent runs on two stacked prompts. A core prompt, controlled by the vendor, holds the guardrails and the rules for escalating to a human. A per-customer prompt is appended to it with the persona and the step-by-step workflow. The bot had started life doing triage and been stretched into intake and booking.

We wrote down six ways it was failing, and they were specific:

  • Announcing a summary, then not delivering it.
  • Ending a message with no question, leaving the patient at a dead end.
  • Skipping steps, or escalating early without a summary.
  • Mentioning outside businesses.
  • Accepting a patient's claim that a document had been uploaded when it had not.
  • Treating the customer's rules as suggestions.

A sandbox with a deadline

The production model was being retired from the Australian region, and health data has to stay in the country, which narrowed the choice of replacement. I researched Azure AI Foundry, wrote the sandbox plan and deployed a candidate model in a non-production project, pinned to the Australian region rather than a global deployment.

Each test case recorded a scenario, where in the conversation it starts, what the patient says, and what a correct response does. Cases covered triage timing, general questions, the booking flow, off-topic requests, dates and times, and customer-specific rules. Responses were scored out of ten against the expected behaviour, with a written reason for every score.

Three rounds

Round one compared three rewrites of the core prompt across 19 scenarios. Mine came last. It averaged 4.6 out of ten against 8.0 for a colleague's version, undone by a bug where the bot lost its place and looped. That is the argument for the method in one result: without the scores I would have shipped my own prompt.

The winning version became the single baseline. Round two added seven harder scenarios drawn from round one's gaps (adversarial rule-breaking, interruptions, two answers in one message, non-English input) and ran everything against a second customer's prompt to catch changes that only worked for one. Round three tightened individual rules: asking one question at a time became a prohibition rather than a preference, and the bot gained a rule for holding its place after an interruption.

The result, with its caveats

On the primary customer configuration, the share of scenarios scoring eight or better rose from 14 of 19 in round one to 23 of 26 in round three, about 74% to about 90%, with the average moving from 8.0 to 8.9. On the original 19 scenarios alone it went 14, then 18, then 17.

The caveats matter. The threshold of eight is my reading of the scores, not a metric the platform produced. Each case ran once and was scored by a language model. Round three slipped slightly from round two, and the second customer configuration improved far less, ending near 60% with two new failures. The honest summary is a real improvement on one configuration and a clear list of what to fix on the other.

What it changed

The most useful finding was structural. Customer prompts were being written without sight of the core prompt, so they repeated its rules in different words, and the bot followed both. That explained the repeated questions better than any wording change could fix.

I also built a proof of concept for the next scaling problem: a rollout across thousands of locations, where a hand-written prompt per site cannot work. The design retrieves one to five matching records per question from a search index instead of loading everything into the prompt, and keeps the data in-country.

  • Azure AI Foundry
  • GPT-4.1 mini
  • Prompt evaluation
  • Azure AI Search
Next
HABIT Studio Operations