← All builds
Pattern · Voice AI

Tool backends for a hospital voice agent

How it worksPattern used across healthcare deployments

How a voice agent that books, moves and cancels appointments actually talks to a hospital. Each tool the agent can call is its own small workflow: a webhook in, validation, one call to the hospital system, and a response shaped so the agent can say it out loud.

How it works

A voice agent is only as useful as the systems it can reach. In a hospital that means the appointment system, the patient record and the insurance check, none of which were built to be called mid-sentence by a machine.

The pattern is one small workflow per tool. A tool call arrives on a webhook. The input is validated and reshaped: phone numbers normalised, dates resolved to the hospital's format, a medical record number checked for shape before anything is looked up. Then one call to the hospital system, and a response the agent can speak.

Identity comes before action. A caller is verified by record number and a one-time code before anything that books, moves or cancels. Read-only lookups, such as which specialties exist or which slots are free, do not need it, because they change nothing.

During a proof of concept the hospital system is a mock, built in the same tool. Swapping the mock for the live API is a change to one HTTP node per tool, which is what turns a PoC that impresses into a deployment that works.

Key features

  • One workflow per tool, so each is testable on its own and swappable from mock to live
  • Verification tools (record number, send code, verify code) gate the write tools
  • Reschedule is implemented as cancel-then-rebook, so a failed rebook never leaves the patient with nothing
  • Responses are shaped for speech: short, no identifiers read digit by digit, dates in words
  • Mock backends stand in for the hospital system until integration is approved

Step by step

  1. The agent needs somethingMid-conversation, the voice agent decides it needs a fact or an action.
  2. Tool call arrivesEach tool has its own webhook.
  3. Validate and shapeInputs are normalised and checked before any system is touched.
  4. Verify the callerCheck the record number exists, send a one-time code, verify it. Only then can anything be written.
  5. Find careSpecialties, physicians, available slots.
  6. ActBook, reschedule (cancel then rebook), cancel, check coverage.
  7. Respond for speechThe result comes back short and sayable.

Want to talk through this one?

Happy to walk through the design, the trade-offs, and what I would do differently.