Skip to content
Ali Zarreh
Live demo Healthcare

RxFlow Pharmacy Assistant

A refill assistant that knows when a doctor or pharmacist has to step in.

A conversational prescription-refill assistant built on a 10-state workflow and a LangChain agent with 16+ tools. Controlled substances, expired prescriptions and unknown medications are routed to a doctor or pharmacist instead of being handled by the AI.

workflow states with explicit transitions
10
specialized tools
16+
escalation scenarios passing
5 / 5
end-to-end workflow scenarios tested
8
RxFlow Pharmacy Assistant chat interface with the current patient, insurance and medication summary in the sidebar

Why it exists

Prescription refills look routine, and most of them are. The hard part is the minority that are not: a controlled substance, a prescription with no refills left, an expired script, a medication the system does not recognize, a store that is out of stock. A refill assistant earns its keep by handling the routine cases end to end — and by recognizing the others and handing them to the right professional.

RxFlow explores that boundary. The conversation is driven by an LLM agent, but the workflow it moves through, and the decision to escalate, are explicit and testable.

How it works

  1. 01 Input Patient request "Refill my medication"
  2. 02 Model / AI Identify & clarify medication patient history, RxNorm lookup
  3. 03 Check Safety & coverage checks dosage, interactions, allergies, formulary
  4. 04 Code Escalation routing doctor or pharmacist
  5. 05 Code Pharmacy & order fallback if out of stock
  6. 06 Human Doctor / pharmacist for escalated cases
In order · Model / AI Independent check Code Human
  • A 10-state workflow — from identifying the medication through confirmation and order submission — defines what can happen next at every step, with conditional transitions and error recovery. The agent converses; the state machine keeps the process on rails.
  • A LangChain agent with 16+ tools handles patient history, RxNorm lookups, adherence, dosage validation, interaction and allergy screening, insurance formulary and prior-authorization checks, cost comparison and order management.
  • Medical escalation is explicit. Controlled substances, expired prescriptions and zero-refill scripts route to a doctor; unknown medications and verification questions route to a pharmacist.
  • Pharmacy fallback retries across stores in a defined order when a medication is out of stock, instead of failing the request.
  • Multiple model providers (OpenAI, Anthropic, or a local model via Ollama) sit behind the same interface.

Results and honest limits

  • Escalation: all 5 escalation scenarios — including controlled-substance detection and pharmacy fallback — pass.
  • Workflow coverage: integration tests exercise 8 end-to-end workflow scenarios, including edge cases and failure modes.
  • Delivery: a Streamlit interface, Docker deployment and a documentation site covering user, developer and deployment guides.

Engineering decisions

  • State machine plus agent, rather than an agent alone: the LLM handles language, while the process and its allowed transitions are deterministic and inspectable.
  • Escalation as a first-class outcome, with its own routing rules and logging, not as an error path.
  • Tools over free text: clinical and coverage checks are tool calls with structured results the workflow can act on.
  • Provider-agnostic model layer, so the same workflow can run on a hosted or a local model.

Who it’s for

For pharmacy and digital-health teams, it shows how to automate the routine path of a regulated workflow while making the hand-off to professionals explicit. For engineering leaders, it is a compact example of pairing a conversational agent with a deterministic process model.

All case studies
Cohort Risk & Review Lab home page showing the four-step flow from risk model to fairness audit to AI evidence agent to clinician decision
Live demo Healthcare

Cohort Risk & Review Lab

A calibrated risk model decides who is flagged, fairness is audited for every subgroup, an AI agent assembles the evidence, and a clinician makes every enrolment decision. It also reproduces how training on cost instead of illness burden skews who gets care.

  • Fairness & explainability
  • Agentic AI
  • Machine learning
Clinical Care Navigator home page with the four-step guardrail flow: pre-flight screen, record lookup, post-flight check, and publish, hold or replace
Live demo Healthcare

Clinical Care Navigator

An assistant that explains a patient's own record, with independent safety checks before and after the AI. Dosing questions are refused, emergencies get urgent guidance, and answers that conflict with the record — such as a critical lab value — are overridden and sent to a clinician.

  • Evaluation & guardrails
  • Agentic AI
  • RAG & retrieval
Credit Decisioning review page showing the model's reasons and the eight notice-verification checks
Live demo Finance

Credit Decisioning

A calibrated credit model, notices written by code from a reviewed template, an independent eight-check verifier proven by mutation testing, and a human who makes the call. A read-only AI analyst explains cases — and code checks every number it states.

  • Evaluation & guardrails
  • Fairness & explainability
  • Machine learning

Open to consulting, advisory roles and select projects.

Building AI that has to be right?

I help teams design systems with verifiers, guardrails and human review built in from the start — not bolted on after the demo.

Search zarreh.ai