Exercise Routine Agent
A conversational AI that builds and edits clinical exercise programs, with deterministic safety rules the model cannot override.
Prescribing exercise for a patient recovering from surgery is not a content problem, it is a safety problem. A floor exercise that is fine for one participant is a fall risk for another, and the difference is not something you want a language model deciding on its own.
So the agent is built the other way around. Every exercise in the catalog is scored by a deterministic risk model — complexity, orientation and fitness type, weighted from the evidence review behind the original research notebook. The catalog is pre-filtered to the patient's adjusted risk threshold before the model ever sees it, the model only selects, phases and orders what remains, and the assembler re-validates every pick against the same numbers afterwards. Rest breaks are inserted by rule, not by the model.
On top of generation sits a chat editor: a clinician can ask for changes in plain language — swap this out, make week three easier, this participant had a fall — and the agent proposes an edited routine that goes through the same validation before anything is saved.
Highlights
- Deterministic risk scoring gates the catalog before generation and re-validates after, so unsafe exercises cannot reach a patient even if the model asks for them.
- Conversational editing with structured proposals merged onto the existing routine rather than regenerated from scratch.
- Adverse-event handling that adjusts the program in response to a reported fall or injury.
- Ported from a research notebook into the production TypeScript monorepo, sharing safety rules with the pathway generator.