Michael Schmuklermann
← All cases

Coachwise

AI platform for health coaches

A LangGraph-based AI service that drafts client replies, analyses check-ins, summarises calls, and runs a coach assistant that can act inside the practice, but only after the coach approves. Every run is traced, redacted, scope-checked, and covered by evals.

OrchestrationLangGraph · workflows, bounded agents, supervisor
StackLangGraph · LangChain · LangSmith · FastAPI · PostgreSQL · React · GCP
How it runs

In short

Coachwise is a platform where health coaches work with their clients: intake, goals, protocols, check-ins, messages, and calls. I built it end to end: a React web app, an iOS/Android patient app, a FastAPI backend on PostgreSQL, and a separate AI service. The AI service is written in Python with LangGraph, LangChain, and LangSmith. Every AI task runs through one entry point, so tracing, limits, redaction, and consent checks apply everywhere. I chose a different shape per task instead of one big agent. Client messages and call summaries are fixed workflows. Check-in analysis is a bounded agent. The coach assistant is a supervisor with a scope gate in front of a tool-using agent. The assistant reads and changes practice data only through the same API endpoints the coach uses, and every change waits for the coach's click through a LangGraph interrupt. Personal data is replaced with placeholders before any model call and put back afterwards. Suggestions must cite real data, and code drops anything without a valid citation. A suggestion gate decides what the coach actually sees, with cool-downs and weekly caps, so the AI does not flood them. Each task has its own eval dataset, Python checks, and an LLM judge, and I compare model configurations before changing defaults.

Building AI for health coaches: why I ended up with five shapes instead of one agent

Coachwise is a platform for health coaches. A coach runs an intake with a new client, sets goals, builds a protocol, and then follows the client through check-ins, messages, and calls. Every one of these steps produces text that a coach has to read and answer. That is where AI helps. It is also where AI can do real damage: it handles health data, it talks to clients on behalf of a coach, and a coach's reputation depends on every answer.

So the question was never "how do we add an agent". It was "which AI shape fits which step, and how do we keep every one of them safe".

One service, one entry point

The first decision was structural. All AI work runs in a separate Python service, not inside the main API. Callers name a task, and a single function, run_task, does the same steps every time: validate the input, build the run context (practice, client, acting coach, limits), record the run, execute the task's LangGraph graph inside a LangSmith trace, and validate the output.

Putting everything behind one door means the guardrails are not optional. A new task gets tracing, token limits, redaction, and consent checks for free, because there is no other way to call a model.

Different tasks, different shapes

I did not build one agent that does everything. Each task gets the simplest shape that works:

The rule of thumb: the more the output reaches a client or changes data, the less autonomy the model gets.

The coach assistant: an agent that asks before it acts

The assistant is a chat inside the coach workspace. It can answer questions about clients, protocols, and check-ins, and it can change things, for example update a protocol or schedule a check-in.

Two design choices made this safe enough to ship.

First, the agent does not get one tool per endpoint. It gets a small fixed set: find a client, read an operation, describe an operation, run an operation, search evidence, load a skill. Operations come from a catalogue that maps to the real API endpoints, and they run as the signed-in coach. The agent cannot reach anything the coach could not.

Second, every write pauses. run_action triggers a LangGraph interrupt, the state is stored by a checkpointer in its own database schema, and the coach sees Confirm, Change, or Don't do it. Only then does the run continue. Tool calls are capped per turn, and a middleware repairs tool calls a model writes as text instead of calling them.

Health data and redaction

Before any model call, personal data is replaced with placeholders like [CLIENT] or [PERSON_1], and the real values are put back in the answer. Detection combines known names from the practice, patterns for emails, phones, and IBANs, and Presidio with spaCy for English and German. German needed extra rules because every noun is capitalised and looks like a name.

What a trace may contain is controlled by a privacy switch. In strict mode, only test practices send full content to LangSmith. Real practices send metadata only.

Grounding and not flooding the coach

An AI that produces many weak suggestions is worse than none. Every suggestion has to cite something real: a check-in answer, a message id, a transcript quote. Code checks the citation and drops anything that fails, plus anything on the practice's "never suggest" list.

Then a suggestion gate decides what the coach sees. Low importance never shows. Urgent always shows. Everything else respects cool-downs after a dismissal or a bad rating, and weekly caps per client. Suppressed suggestions are stored with the reason, so I can see later what the gate filtered.

Quality: evals before defaults

Each task has an eval dataset with made-up practices and clients, Python checks for hard expectations, and a rubric for an LLM judge. Running the evals syncs the dataset to LangSmith and records an experiment. Model choices are made by comparing configurations on the same cases, not by gut feeling. The result is cheap models for triage and checks, a mid-size model for writing and analysis, and a tiny local model for the pre-check, with an automatic fallback when the local server is down.

What I would tell another team

Start with the guardrails, not the agent. One entry point, redaction, scope, limits, and evals are what made it possible to move fast later. And give autonomy step by step. A workflow you can test is better than an agent you have to trust.

Code on GitHubMore cases