AI-Powered Text Message-Based Healthcare Treatment Management System
stride · Healthcare · 2025 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: Telemedicine treatment support
Aila needed to help patients manage sensitive self-administered treatments over text messages while reducing manual operator button-clicking, preserving medically approved language, escalating ambiguous situations, and protecting patient data.
Constraints:
- patients administer treatment at home during traumatic or cognitively difficult moments
- the old workflow required humans to read every patient text and click predefined response buttons
- medical advice must stay close to approved treatment language and provider workflows
- the system intersects with HIPAA and patient privacy requirements
- new treatments needed to be supported without rewriting code for every regimen
Architecture
Stride built a hybrid LangGraph healthcare workflow with a Python LLM container and a separate Node/React/MongoDB/Twilio text-message gateway and dashboard on AWS. The LLM side uses Claude, LangGraph, LangSmith, MCP/file tools, local state tools, treatment blueprints, guidelines, schedules, anchors, and medically approved knowledge documents. A Virtual Operations Associate reads the conversation and current schedule-document state, proposes messages, state changes, anchors, reminders, and treatment-phase updates, then an Evaluator scores confidence and complexity. High-confidence messages can be sent automatically; low-confidence or complex situations are surfaced for human review in the operations dashboard.
Diagram confidence: explicit (topology described by the source).
flowchart LR twilio-text-gateway["twilio-text-gateway"] --> node-react-dashboard["node-react-dashboard"] twilio-text-gateway["twilio-text-gateway"] --> langgraph-python-container["langgraph-python-container"] node-react-dashboard["node-react-dashboard"] --> schedule-document-store["schedule-document-store"] node-react-dashboard["node-react-dashboard"] --> human-operations-review["human-operations-review"] schedule-document-store["schedule-document-store"] --> langgraph-python-container["langgraph-python-container"] langgraph-python-container["langgraph-python-container"] --> virtual-operations-associate["virtual-operations-associate"] langgraph-python-container["langgraph-python-container"] --> evaluator-agent["evaluator-agent"] langgraph-python-container["langgraph-python-container"] --> treatment-blueprints["treatment-blueprints"] langgraph-python-container["langgraph-python-container"] --> state-tools["state-tools"] virtual-operations-associate["virtual-operations-associate"] --> treatment-blueprints["treatment-blueprints"] virtual-operations-associate["virtual-operations-associate"] --> state-tools["state-tools"] virtual-operations-associate["virtual-operations-associate"] --> evaluator-agent["evaluator-agent"] evaluator-agent["evaluator-agent"] --> human-operations-review["human-operations-review"] evaluator-agent["evaluator-agent"] --> retry-node["retry-node"] retry-node["retry-node"] --> virtual-operations-associate["virtual-operations-associate"] treatment-blueprints["treatment-blueprints"] --> guidelines-and-confidence-docs["guidelines-and-confidence-docs"] guidelines-and-confidence-docs["guidelines-and-confidence-docs"] --> evaluator-agent["evaluator-agent"] state-tools["state-tools"] --> schedule-document-store["schedule-document-store"] promptfu-eval-harness["promptfu-eval-harness"] --> langgraph-python-container["langgraph-python-container"]
Components
| Component | Role | Interacts with |
|---|---|---|
twilio-text-gateway |
Text/MMS gateway that receives patient messages, sends scheduled messages, and connects to the application database. | node-react-dashboard, langgraph-python-container |
node-react-dashboard |
Operations dashboard where humans review conversations, see message history, approve/escalate cases, and manage attention queues. | twilio-text-gateway, schedule-document-store, human-operations-review |
schedule-document-store |
Versioned patient-state snapshot containing messages, unsent scheduled messages, anchors, treatment phase, and enough state to fill the dashboard. | node-react-dashboard, langgraph-python-container |
langgraph-python-container |
LLM workflow runtime with LangGraph agents, state tools, MCP/file access, guidelines, blueprints, and evaluator loop. | virtual-operations-associate, evaluator-agent, treatment-blueprints, state-tools, schedule-document-store |
virtual-operations-associate |
Primary Claude agent that interprets patient text, chooses approved language, updates state, schedules messages, and proposes next actions. | treatment-blueprints, state-tools, evaluator-agent |
evaluator-agent |
Live LLM-as-judge layer that scores confidence, detects complex state changes, and routes cases to humans when needed. | virtual-operations-associate, human-operations-review, retry-node |
treatment-blueprints |
Markdown treatment definitions, approved language, schedules, anchors, and linked medical knowledge documents. | virtual-operations-associate, guidelines-and-confidence-docs |
guidelines-and-confidence-docs |
LLM-readable instructions for tool use, confidence deductions, time handling, anchors, scheduling, and treatment-agnostic behavior. | virtual-operations-associate, evaluator-agent |
state-tools |
Local Python tools for reading/modifying patient data, anchors, scheduled messages, confidence, and treatment state inside a graph run. | virtual-operations-associate, schedule-document-store |
retry-node |
Graph retry path for malformed tool calls, invalid JSON, or premature empty model turns. | virtual-operations-associate, evaluator-agent |
human-operations-review |
Physician assistant and operations associates who review complicated, low-confidence, or out-of-blueprint situations. | node-react-dashboard, evaluator-agent |
promptfu-eval-harness |
External evaluation harness that pulls LangSmith data, preprocesses it, and runs PromptFu LLM-rubric evals. | langgraph-python-container |
Data flow
A patient texts the system or scans a QR code to begin. The gateway loads the current schedule document, message history, scheduled unsent messages, treatment phase, anchors, patient data, and blueprint context, then invokes the Python LangGraph workflow. The Virtual OA receives the state in its prompt, reads treatment blueprints and knowledge documents, calls tools to update anchors, patient data, scheduled messages, and confidence, and proposes an output. The Evaluator reviews the proposed state for message correctness, complexity, duplicate reminders, anchor changes, low confidence, or symptoms that need review. The final output state is serialized by Python and sent back to the gateway for persistence, text/MMS delivery, or human dashboard review.
4 supporting quotes
Why this architecture
Stride chose LangGraph because the visual workflow made a safety-critical agent understandable to the client: where loops, evaluation, and humans enter the process were visible. The architecture keeps one main Virtual OA to preserve treatment-agnostic reuse and Claude cache behavior, while state mutations are constrained to explicit tools and Python-owned serialization. Markdown blueprints were favored over a broad RAG layer because treatment knowledge had to remain human-readable, approved, linked, and flexible across future regimens. Human review stays in the loop for complicated situations rather than letting the model be the sole authority.
4 supporting quotes
Models used: Claude · LangGraph · LangChain · LangSmith · MCP · PromptFu · Gemini · OpenAI · Node.js · React · MongoDB · Twilio · AWS VPC
Scale
- The early pregnancy-loss regimen usually takes about three days, with a follow-up after that.“it tends to be a treatment which takes I think three days end to end to administer most of the time and then there's a check-in after that”transcript, stated
- Some treatment variants require a pregnancy test after six weeks.“there are some variants of this where you take a pregnancy test after six weeks”transcript, stated
- The most complicated observed conversation had about 150 texts.“the most complicated conversation I've seen was something like 150 texts.”transcript, stated
- The system targets roughly 10x capacity improvement for the operations team.“We think that they can surface roughly 10x more people with this new approach.”transcript, stated
- The existing system handled thousands, not millions, of patients.“that scale is you know again let's say thousands not millions of patients.”transcript, stated
- Baseline LLM operations cost roughly 15-20 cents per generated message in the speaker's estimate.“the average cost to generate a single message somewhere in the 15 to 20 cent range”transcript, stated
- Baseline per-turn context was around 10,000-15,000 cached tokens.“the average operation with just sort of the baseline stuff is maybe 10 to 15,000 tokens right per turn all cached”transcript, stated
Alternatives considered (roads not taken)
Keep humans manually pressing response buttons
Rejected because: It required too many people, limited patient capacity, and made new treatment workflows hard to scale.
Rewrite the legacy workflow as more traditional flexible software
Rejected because: The team chose LLM decisioning because it could support new treatments and workflows from blueprints without changing code.
RAG over all medical knowledge
Rejected because: The client already had human-readable treatment structures and linked documents, while the backup knowledge store was not used enough to justify RAG yet.
Human review for every generated message
Rejected because: Full review would be safest but would defeat the capacity goal, so high-confidence low-complexity messages are sent automatically.
Patterns
multi-agent-orchestration (agent architecture)
The LangGraph workflow separates the Virtual OA that proposes treatment actions from an Evaluator agent that scores confidence and complexity.
human-in-the-loop-gate (safety)
Low-confidence, complex, out-of-blueprint, or symptom-related situations are routed to human operations staff rather than automatically sent.
3 supporting quotes
structured-output-contract (state management)
Agents modify a constrained output state with anchors, messages, patient data, confidence, and treatment phase rather than free-writing system changes.
confidence-thresholding (safety)
The Evaluator assigns confidence and deductions for weird state changes, duplicate messages, or complex scheduling, causing human review when needed.
eval-driven-development (evaluation)
The team built an external PromptFu eval harness, replayed old conversations, and used operations staff red-teaming to test tricky treatment situations.
privacy-preserving-processing (security)
Patient identifiers are minimized before they reach the LLM side, and the whole system runs behind AWS VPC boundaries.
Tradeoffs
Use custom software plus off-the-shelf LangChain/LangGraph pieces.
Chose Custom workflow with large off-the-shelf components over Fully off-the-shelf healthcare automation.
Rationale: Client requirements around privacy, treatment workflows, and explainability made custom software necessary, while LangGraph/LangSmith still provided orchestration and observability value.
Keep one main Virtual OA rather than many treatment-specific agents.
Chose Generic treatment-agnostic main agent over Hard-coded or smaller treatment-specific agents.
Rationale: The team wanted reusable architecture across treatments and better cache behavior with one agent identity.
Use Markdown blueprints instead of overprocessed RAG for core treatment knowledge.
Chose Human-readable linked documents in context over Full RAG indexing for the treatment logic.
Rationale: Blueprints mirrored client materials, were easier for humans to maintain, and kept treatment definitions flexible.
Automatically send high-confidence messages.
Chose Human review for flagged cases only over Human review for every message.
Rationale: The system is designed to scale operations capacity while still surfacing complex or low-confidence cases.
Gotchas (what bit them)
Medical language cannot drift far from approved text.
Root cause: The workflow sends treatment advice, and the original human-button system existed partly to keep responses within approved wording.
Resolution: Use treatment blueprints, approved language, linked medical knowledge documents, and human review when the answer is outside the blueprint.
Malformed tool calls and empty turns can break the graph.
Root cause: Claude can produce invalid JSON/tool calls or prematurely end a turn without saying anything.
Resolution: Detect malformed tool calls, delete the bad message, and route through retry nodes back to the Virtual OA.
Time zones and anchors are deceptively important.
Root cause: Treatment schedules depend on local patient time, but the system deliberately knows little about the patient and receives free-form text.
Resolution: Ask for the patient's current time, compute UTC offset, store treatment anchors, and recalculate scheduled messages when anchors change.
Human-review calibration is more art than science.
Root cause: LLMs tend to believe they are correct, while real patient conversations contain ambiguous corrections and symptom reports.
Resolution: Combine model confidence with hand-tuned complexity deductions, spot checks, low-confidence trace review, and operations-team red-teaming.
Evaluation
Evaluation combines live evaluator-agent scoring, confidence/complexity deductions, human dashboard review, physician-assistant and operations-associate red teaming, replay of old-system conversations, LangSmith trace inspection, and an external PromptFu LLM-rubric harness.
Metrics: confidence score · complexity deductions for state changes and duplicate messages · human-review rate · spot-check quality · red-team failures · replayed conversation behavior · capacity improvement · patient/customer satisfaction style measures
4 supporting quotes
Outcomes
- The system is being used with real people but is still early.
- Stride estimates roughly 10x more patient capacity from the new approach.
- New treatments and workflows can be configured from blueprints without returning to application code.
- Operations staff move from pressing every button to supervising exceptions and reviewing flagged cases.
The discussed regimen often completes within about a week, can include roughly 150 text messages in complicated cases, and targets thousands rather than millions of patients at current scale.