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:

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"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

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
“with any given message from the patient right this entire system only kicks off when the patient sends a message”transcript, stated
“there is a state object that we load essentially when the request comes in from a JSON blob”transcript, stated
“the Python code not the model which essentially takes all that state and then uh serializes it and sends it out.”transcript, stated
“because it's 100% confidence, it just goes out, right? it goes back to the text message gateway and it just goes out.”transcript, stated

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
“The number one reason we went with this is because of how easy it is to explain the system to other people”transcript, stated
“we did not want to be super treatment specific in how the architecture worked.”transcript, stated
“caching the entire message stream is easier with with either one agent or with sort of one agent doing most of the work.”transcript, stated
“we fundamentally did not believe that it made sense to overprocess, you know, things like a rag.”transcript, stated

Models used: Claude · LangGraph · LangChain · LangSmith · MCP · PromptFu · Gemini · OpenAI · Node.js · React · MongoDB · Twilio · AWS VPC

Scale

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.

“humans manually push buttons on a console that would enable uh a text message to go out”transcript, stated
“to scale the human team to be able to serve a lot more patients was prohibitive”transcript, stated

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.

“either they were going to rebuild the legacy software to be more flexible or they were going to essentially rebuild it to to to use a different kind of decisioning at the core.”transcript, stated
“you can do new treatments in new workflows without writing more code.”transcript, stated

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.

“It mirrors something the client already mostly had, right? They already had a lot of these structures. Um, and you know, we fundamentally did”transcript, stated
“that probably is suited for rag right it would be okay to use a rag for that it doesn't get used that much”transcript, stated

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.

“if you wanted to be perfectly safe, you have a human review all of these things. We don't want to do that because we're trying to scale”transcript, stated

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.

“it basically comes up with I think this is what we should do and it passes it to an evaluator agent.”transcript, stated
“the virtual OA talks to the evaluator”transcript, stated

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
“this is very much a hybrid system with humans very much in the loop”transcript, stated
“maybe a human should look at this, right? So that's actually a lot easier to implement.”transcript, stated
“if they say well I'm having these symptoms you're not helping me. Like a human will step in.”transcript, stated

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.

“this output state says, well, I have 100% confidence, again, its version of it, that I did the right thing”transcript, stated
“the only things it can do is read the entire state, modify the patient data, modify messages, modify anchors”transcript, stated

confidence-thresholding (safety)

The Evaluator assigns confidence and deductions for weird state changes, duplicate messages, or complex scheduling, causing human review when needed.

“do I am I sending multiple messages? Do I send a am I sending duplicate messages accidentally? Do I have reminders for things that have already happened?”transcript, stated
“All of those things would deduct from the score and cause a human to get involved.”transcript, stated

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.

“we built an external harness that essentially pulls data out of Langmith, processes it, and then runs things through PromptFu.”transcript, stated
“we'll look at at conversations in the old system and replay them here and essentially just try to figure out, you know, where the edges are.”transcript, stated

privacy-preserving-processing (security)

Patient identifiers are minimized before they reach the LLM side, and the whole system runs behind AWS VPC boundaries.

“this entire thing is all behind you know AWS's VPC right so like there is no external access to the LLM period”transcript, stated
“the things that get get to the yellow box do not include phone numbers. They do not include anything other than the patient's identified first name.”transcript, stated

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.

“there were some specific requirements this client had that made it better, frankly, to build a lot of it custom.”transcript, stated
“you'll see a lot of Langraph, Langchain, Lang Smith, you know, a bunch of other things like that”transcript, stated

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.

“we did not want to be super treatment specific in how the architecture worked.”transcript, stated
“every time I switch the system prompt, I think the cache blows up. And so fundamentally changing the agent identity does that.”transcript, stated

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.

“these documents are all referring to each other. So I can go through here and I can look you know and and click on these links”transcript, stated
“Um, we've chosen to do it this way in part because it is human readable.”transcript, stated

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.

“the approval also is very quick right so I the argument is that you probably only see one of every 10 exchanges”transcript, stated
“We don't want to do that because we're trying to scale”transcript, stated

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.

“one of the reasons that you had humans pressing buttons instead of typing text messages is because this is medical advice”transcript, stated
“If you have approved language use it right send it send it back for human review whatever you need to do right but use that approved language.”transcript, stated

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.

“one of the agents malforms a tool call right it tries to call a tool but it uses the wrong JSON”transcript, stated
“We detect that. We say you have to say something, right? Like literally, that's the message is like don't just say nothing.”transcript, stated

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.

“The next thing I need to know, and this is a very interesting part of this treatment, I need to know what time it is.”transcript, stated
“We just change the anchor. We update everything.”transcript, stated

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.

“generally speaking, the LLM, you know, says at all times, "Yes, I know what I'm doing."”transcript, stated
“it is very handtuned and geared to this evaluation team”transcript, stated

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
“Um, we also built a self-evaluation function, which I'll go into tremendously, um, in a second.”transcript, stated
“we have the entire team of operations associates who have been spending you know weeks and months trying to trick this thing”transcript, stated
“we built an external harness that essentially pulls data out of Langmith, processes it, and then runs things through PromptFu.”transcript, stated
“there would be some combination of the operators being the ultimate arbiter”transcript, stated

Outcomes

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.

4 supporting quotes
“it is being used with real people, but it's still very very much early on”transcript, stated
“We think that they can surface roughly 10x more people with this new approach.”transcript, stated
“you can do new treatments in new workflows without writing more code.”transcript, stated
“we were trying to raise up the existing folks who were really just operating the system and and clicking all those buttons to be supervisors of of agents”transcript, stated