4 ready-to-build workflows

AI agent workflows for Diagnostics labs & pathology

Chase critical values until a clinician actually acknowledges, turn the rejection whiteboard into re-collects, and deliver reports in the patient's language — with a pathologist owning every clinical release.

Each recipe below is expressed only in VegaDūta's real workflow building blocks — Trigger, Agent, Knowledge, Condition, Approval, Output, Tool (MCP), Voice, Device, Loop, Code and Parallel — so it maps 1:1 to something you can assemble in the Workflow designer. Consequential actions always pass a human Approval step.

1. Critical-value escalation that doesn't stop until a clinician acknowledges

02:40, one tech on the night bench. The analyser posts a potassium of 7.1. She notices it because she is scrolling the LIMS worklist between runs — there is no alarm. She opens the hard-bound 'Critical Value Callback Register' kept next to the centrifuge, rules the columns by hand, then looks up the ordering doctor in a printed on-call list taped to the wall (last revised in March). She dials from the landline. It rings out. She writes 'NR' in the register and goes back to her run, meaning to try again. At 06:00 handover the day tech sees 'NR' in yesterday's ink and nobody is sure whether anyone ever called. That register — plus a WhatsApp group where the night staff sometimes post a photo of the result — is the entire escalation system.

Trigger: Webhook (LIMS result verified / analyser middleware autoverify)

How the workflow runs

  1. Trigger

    Result verifies in the LIMS. A Webhook fires on every verified result — no worklist scrolling, no dependence on someone looking up. The LIMS/analyser middleware has no first-party connector: results arrive via inbound Webhook, and anything written back goes through a Tool (MCP) node.

  2. Knowledge

    Load YOUR critical-value table. A scoped Knowledge collection holds this lab's own critical/panic limits, delta-check rules and per-analyte callback SOP — age- and sex-banded exactly as your medical director signed them. General medical knowledge is out of bounds; only the signed table is consulted.

  3. Tool (MCP)

    Deterministic threshold check (user-defined SpEL tool). A tenant-authored tool `critical_flag` (a sandboxed SpEL expression over the tool's JSON input, e.g. input.value > input.upperLimit ? 'CRITICAL' : (input.value < input.lowerLimit ? 'LOW' : 'NORMAL')) does the actual numeric comparison. A threshold belongs in a deterministic formula the lab can edit itself, not in a prompt — and your medical director can revise it without a developer or a redeploy.

  4. Agent

    Assemble the callable fact (no interpretation). An Agent node takes the deterministic flag and returns strict JSON {critical, analyte, value, limit_breached, ordering_clinician, patient_ref}. It resolves who ordered it and formats the callable fact — it does NOT interpret, diagnose or suggest treatment, and it never overrules the SpEL flag.

  5. Condition

    Critical, routine, or unresolvable?. A Condition node branches: routine results fall to the normal report flow; a flagged critical enters the callback ladder; an unmapped analyte or unresolvable clinician goes to a human instead of being dropped.

  6. Approval

    Duty pathologist owns the call. An Approval node holds the escalation for the on-duty pathologist or lab director — the judgement that this value is real and callable is a clinician's, and the trail records who made it. A hard timeout escalates UP the human ladder; it is never a bypass that lets the agent call alone.

  7. Voice

    Escalation ladder with real retries. On approval a Voice/Call node (ElevenLabs, Sarvam-localised for Indian-language recipients) calls the ordering clinician with analyte, value, reference limit and a callback reference, backed by SMS and WhatsApp. It reads out facts and asks for a read-back; it never offers advice.

  8. Loop

    Keep going until acknowledged. A Loop node re-runs the documented ladder — ordering clinician, covering doctor, ward/nursing station — at the SOP's own intervals until an explicit acknowledgement is captured or the ladder is exhausted. This is the 'NR in the register' failure, closed.

  9. Output

    Write the read-back back. A Tool (MCP) node writes the callback record — who was reached, when, and the read-back confirmation — into the LIMS against the result id. An exhausted ladder raises a supervisor alert rather than closing itself.

Channels & connectors

  • Webhook
  • Knowledge base
  • Voice / Call
  • ElevenLabs
  • Sarvam
  • SMS / Twilio
  • WhatsApp
  • Approval / HITL
  • Tool (MCP → LIMS / HIS)

Outcome

Every verified result is checked against your own signed table the moment it posts, and flagged ones ride a persistent, documented callback ladder — replacing the hand-ruled register, the taped-up on-call list and 'NR'.

Why it helps

The mechanism is persistence plus proof. Critical-value reporting rarely fails at detection; it fails at the unfinished chase and the missing read-back record. A Loop that keeps escalating on the SOP's own intervals removes the first, and a Tool node that writes who acknowledged and when removes the second — while the decision to call stays with the pathologist and the threshold itself stays in a formula the lab controls.

Build spec

2 agents1 fact-assembly agent (runs on every verified result — the high-volume step) + 1 escalation-scripting agent (runs only on the flagged minority). The numeric threshold check is a deterministic user-defined SpEL tool, not an agent; the ladder, the branch and the approval are workflow nodes. · Pattern: Deterministic SpEL threshold → cheap per-result agent → Condition → pathologist approval → Voice/SMS ladder in a retry Loop

System prompt (paste-ready)

You prepare ONE verified laboratory result for critical-value callback. The CRITICAL/LOW/NORMAL flag has already been computed deterministically by the `critical_flag` tool against this lab's signed table — take it as given and NEVER overrule it. Return strict JSON {critical, analyte, value, units, limit_breached, age_band, patient_ref, ordering_clinician, callback_ref}. You must NOT interpret the result, suggest a diagnosis, suggest treatment, or comment on the patient's condition. If units are ambiguous, the analyte is unmapped, or the ordering clinician cannot be resolved from the HIS, set needs_human=true with a reason — never guess a clinician and never assume a unit.

Agent roles & model tiers

  • Fact assembler (per verified result) Economy tier, with a configured fallback model for provider outages — runs on EVERY result, so this choice sets the whole bill; a lab cannot have callbacks stop because one provider is down

    Take the deterministic SpEL flag as authoritative, resolve the ordering clinician from the HIS, emit strict JSON. No interpretation, no diagnosis, no treatment comment. Unmapped analyte or unresolvable clinician ⇒ needs_human=true.
  • Escalation scripter (per flagged value) Standard tier with fallback — runs only on the flagged minority, where wording accuracy on a phone call matters

    Compose the callback script and SMS/WhatsApp backup for an APPROVED critical value: analyte, value, units, reference limit, patient identifier, callback reference, and the explicit read-back question. Facts only — no advice, no interpretation, no reassurance. Localise via Sarvam when the recipient's registered language is not English.

MCP connectors

  • LIMS — via Tool (MCP): read the verified result payload and write the callback record (who was reached, when, read-back confirmation) against the result id
  • HIS / EMR — via Tool (MCP): resolve ordering clinician, department and current on-call cover for the patient encounter
  • Hospital on-call roster — via Tool (MCP): fetch tonight's covering doctor when the orderer is off-shift, replacing the printed list taped to the wall

Built-in tools

  • user-defined tool `critical_flag` (SpEL): input.value > input.upperLimit ? 'CRITICAL' : (input.value < input.lowerLimit ? 'LOW' : 'NORMAL') — the lab's own limits, edited by the medical director in the tool editor, no developer and no redeploy
  • user-defined tool `callback_ref` (SpEL): input.sampleId + '-' + input.analyte + '-' + input.verifiedAt — a stable, idempotent callback key so a re-posted result can never open a second ladder
  • knowledge_search (signed critical-value limits, delta checks and callback SOP)
  • http_request (resolve ordering clinician and on-call cover; write the callback record to the LIMS)

Guardrails

  • The agent never diagnoses, never interprets a value, never suggests treatment — it reports only which documented limit was crossed
  • The threshold decision is deterministic (the `critical_flag` SpEL tool over your signed table), so it cannot drift with a model change or a prompt edit; the agent is explicitly forbidden from overruling it
  • The escalation is released by the on-duty pathologist at the Approval node — the agent proposes the call, a clinician owns it
  • The approval timeout escalates UP the human ladder; there is no path in which the workflow calls a clinician without a human having released it
  • Unmapped analyte, ambiguous units or unresolvable clinician ⇒ needs_human=true and routed to a person — no silent drop, no guessed recipient
  • An exhausted ladder alerts a supervisor; the workflow can never close a critical value as 'done' by itself
  • Every attempt and the read-back are written back keyed to `callback_ref` — auditable, and idempotent against a re-verified result

Cost strategy

Volume sits entirely on the fact assembler, which touches every verified result — economy tier, hard-capped, with a fallback model configured so a provider outage degrades to a second provider rather than to the paper register. The standard-tier scripter runs only on the flagged subset, so its price barely registers monthly. Note that moving the threshold comparison out of the model and into the SpEL tool also removes tokens from the highest-volume step: the cheapest inference is the one you don't make. Retries in the Loop replay the composed script, so they cost telephony minutes, not tokens.

Output & delivery

Every verified result hits the `critical_flag` SpEL tool for a deterministic verdict → a cheap agent resolves the clinician and assembles the callable fact → the Condition node splits routine from critical from unresolvable → the duty pathologist approves at the Approval node → an ElevenLabs Voice call plus SMS/WhatsApp backup runs the documented ladder inside a retry Loop until an explicit read-back is captured → a Tool (MCP) node writes the callback record into the LIMS, and an exhausted ladder alerts a supervisor instead of closing.

2. The rejection whiteboard → re-collects, batched (map-reduce, 2 agents)

In accessioning there is a whiteboard headed REJECTED with today's date, and a marker on a string. Haemolysed, clotted, QNS, wrong tube, unlabelled, transport time exceeded — the tech writes barcode numbers under each heading through the shift. At around 4pm someone photographs the board into the 'Collection Boys' WhatsApp group. The front desk keeps a parallel Google Sheet called REDRAW_pending with a column nobody fills in reliably, and decides case by case whether the patient is charged for the re-draw. Most patients only learn their sample failed when they ring three days later asking where the report is — and then the front desk has to find the barcode on a photo of a whiteboard that was wiped clean on Tuesday.

Trigger: Webhook (LIMS rejection batch — per run / end of shift)

How the workflow runs

  1. Trigger

    Rejection batch lands. A scheduled Webhook fires with the run's rejection list straight from the LIMS — the board and the photo disappear because the source of truth is the system that rejected the sample.

  2. Loop

    Map: one pass per rejected sample. A Loop node fans a cheap mapper across each rejection, isolated context per sample, so a 200-line batch behaves exactly like a 6-line one.

  3. Tool (MCP)

    Chargeability by formula (user-defined SpEL tool). A tenant-authored tool `recollect_charge` (SpEL over the tool input, e.g. input.reasonCode == 'QNS' || input.reasonCode == 'CLOTTED' ? 'LAB_BEARS' : (input.collectedAt == 'HOME' ? 'VISIT_FEE' : 'NO_CHARGE')) applies the lab's own re-collect policy deterministically. Whether the patient pays is a policy question, not a language question — it belongs in an expression the lab's own manager can edit, and it will answer identically every time.

  4. Agent

    Mapper classifies + proposes an action. Strict JSON per sample: reason code (HAEMOLYSED | CLOTTED | QNS | WRONG_TUBE | UNLABELLED | TRANSPORT_TIME), the collector and route, the chargeability verdict from the SpEL tool, and a proposed action — RECOLLECT_HOME / RECOLLECT_CENTRE / CANCEL / CLARIFY. It proposes; it never cancels a test.

  5. Code

    De-duplicate and key the batch. A Code node normalises barcodes and drops duplicates from a re-sent export, so re-running a batch cannot produce two re-collect orders for one sample — the failure mode a photographed whiteboard guarantees.

  6. Agent

    Reduce: roll the run up. A reducer aggregates validated items into a run summary: reason-code counts, which collector, centre, route or tube lot recurs, the re-collect worklist, and the items needing a decision. Pre-analytical failures cluster — the whiteboard makes the cluster invisible.

  7. Approval

    Lab in-charge approves. An Approval node holds every cancellation, every chargeable re-collect and every patient-facing message — cancelling an ordered test and re-billing a patient are both consequential, so a human clicks.

  8. Output

    Tell the patient in their language. On approval, an Output node messages the patient on WhatsApp/SMS (Sarvam-localised): what must be repeated, in plain non-clinical terms, and how to rebook. The message never states or implies a clinical finding.

  9. Tool (MCP)

    Write the outcome back. A Tool (MCP) node posts approved cancellations, re-collect orders and charge flags to the LIMS and billing, keyed to the normalised barcode.

Channels & connectors

  • Webhook
  • WhatsApp
  • SMS / Twilio
  • Sarvam
  • Approval / HITL
  • Tool (MCP → LIMS / billing / home-collection app)
  • Email

Outcome

The whole rejection batch is triaged into a decision-ready worklist each run, patients hear from you the same day in a language they read, and every cancellation or charge is a human click — with the whiteboard and the parallel Google Sheet both retired.

Why it helps

Two mechanisms. First, the patient learns about a failed sample from the lab rather than from a missing report, because the trigger is the rejection itself rather than someone remembering to photograph a board. Second, the reducer surfaces the clustering — one collector, one tube lot, one long evening route — that a per-sample manual read structurally cannot reveal. Fixing the cluster is what actually reduces repeat rejections; the batch pass is what makes the cluster visible.

Build spec

2 agents1 mapper (once per rejected sample via the Loop node) + 1 reducer (once per batch). Chargeability is a deterministic SpEL tool; de-duplication is a Code node; the approval, the patient message and the write-back are workflow nodes. · Pattern: Map-reduce: Loop (map per sample, SpEL for policy) → Code de-dupe → reducer (one synthesis) → human approves cancellations, charges and messages

System prompt (paste-ready)

(Mapper) Triage ONE rejected specimen record. Return strict JSON {sample_id, test_ordered, reason_code (HAEMOLYSED|CLOTTED|QNS|WRONG_TUBE|UNLABELLED|TRANSPORT_TIME|OTHER), collector_ref, centre_ref, route_ref, charge_verdict (copied verbatim from the `recollect_charge` tool — never your own opinion), proposed_action (RECOLLECT_HOME|RECOLLECT_CENTRE|CANCEL|CLARIFY), patient_message_points[]}. Judge only from the record's own fields and the rejection-criteria SOP in Knowledge. Never infer a clinical meaning from a rejection, never state or hint at any result, and never mark a test cancelled — CANCEL is a recommendation a human approves. Malformed or ambiguous ⇒ proposed_action=CLARIFY.

Agent roles & model tiers

  • Mapper (per rejected sample) Economy tier with a fallback model — runs N times per batch, so it is the dominant cost term and must survive a provider blip mid-batch

    Classify ONE rejection into schema-valid JSON with a proposed action and plain-language patient message points; copy the chargeability verdict from the SpEL tool verbatim. No clinical inference, no result disclosure, no autonomous cancellation. Ambiguous ⇒ CLARIFY.
  • Reducer (once per batch) Standard tier with fallback — pattern-finding across the run, and the only output a manager reads

    Aggregate validated per-sample results into a run summary: reason-code distribution, recurring collector/centre/route/tube-lot clusters, the re-collect worklist, and items needing a human decision. Use only supplied items and cite real counts — never estimate a rate, never invent a trend.

MCP connectors

  • LIMS — via Tool (MCP): pull the run's rejection export, then post approved cancellations and re-collect orders against the normalised barcode
  • Billing system — via Tool (MCP): set or clear the re-collect charge flag on the patient's account once a human has approved it
  • Home-collection / phlebotomy scheduling app — via Tool (MCP): create the approved re-draw visit and read the collector's route for that day

Built-in tools

  • user-defined tool `recollect_charge` (SpEL): input.reasonCode == 'QNS' || input.reasonCode == 'CLOTTED' ? 'LAB_BEARS' : (input.collectedAt == 'HOME' ? 'VISIT_FEE' : 'NO_CHARGE') — the lab's own re-collect policy as a formula the operations manager edits directly, so who pays is decided identically every time instead of case by case at the front desk
  • user-defined tool `patient_ref_mask` (SpEL): input.name.substring(0,1) + '*** / ' + input.barcode — a masked identifier for internal worklists and the WhatsApp/SMS trail, so a batch summary never carries a full patient name
  • knowledge_search (specimen rejection criteria + re-collect/re-billing policy)
  • http_request (pull the rejection batch; post approved cancellations, re-collect orders and charge flags)

Guardrails

  • The agents only propose — every cancellation, every chargeable re-collect and every patient-facing message passes the Approval node before anything is written or sent
  • Patient messages are strictly operational (what to repeat, how to rebook). No result, no clinical interpretation, no reassurance about what a rejection 'means'
  • Chargeability is decided by the `recollect_charge` SpEL formula, not by the model — the agent copies the verdict verbatim and is forbidden from forming its own opinion about who pays
  • Reason codes come only from your rejection-criteria SOP in Knowledge — no invented policy
  • Schema validation per mapper output; a malformed record becomes CLARIFY and is queued for a human, never silently cancelled
  • The Code node normalises and de-duplicates barcodes, and write-backs are idempotent per sample id — a re-sent export cannot double-cancel or double-charge

Cost strategy

Linear and forecastable: N × (economy-tier, hard-capped mapper) + ONE standard-tier reduce. The mapper runs across the whole batch so it must stay on the economy tier — that single choice sets the bill; the reducer's one call is where the reasoning budget belongs. Pushing the chargeability rule into SpEL removes the most token-hungry ambiguity from the per-sample step. Run the map in Parallel batches for wall-clock speed at unchanged per-sample cost, and configure a fallback model so a provider blip does not strand a half-processed run.

Output & delivery

The Loop maps a cheap agent over every rejected sample, with the `recollect_charge` SpEL tool deciding who pays → a Code node normalises barcodes and drops duplicates → the reducer produces one run summary with the recurring clusters → the lab in-charge approves cancellations, charges and messages at the Approval node → an Output node notifies patients on WhatsApp/SMS in their own language (Sarvam), operational detail only → a Tool (MCP) node posts approved outcomes to the LIMS, billing and the home-collection app, idempotently.

3. Report delivery in the patient's language — with a hard no-interpretation boundary

The pathologist signs the report at 11:20. A front-desk executive then opens the LIMS in one window and the shared Gmail inbox (reports@) in another, downloads the PDF, copies the patient's email from the LIMS demographics tab, attaches, types 'PFA report', and sends — one patient at a time, roughly two hundred of them, from a single browser tab. A peon carries the hard copies to the collection centres in a plastic folder. Then the phone starts: 'sir, is this bad?' — asked in Kannada or Hindi to whoever picks up, who is a receptionist, and who answers anyway because the caller is frightened and the queue is long.

Trigger: Webhook (report authorised/signed in the LIMS)

How the workflow runs

  1. Trigger

    Report is authorised. A Webhook fires ONLY when the pathologist has signed the report in the LIMS — a preliminary or unverified result can never enter this workflow. That single gate is the difference between automation and a medico-legal incident.

  2. Condition

    Deliverable by bot, or by a human?. A Condition node applies your release policy: reports your policy requires be given in person or by a clinician are routed to a human and never auto-sent.

  3. Tool (MCP)

    Secure link + language pick (user-defined SpEL tool). A tenant-authored tool `delivery_channel` (SpEL, e.g. input.consent.whatsapp ? 'WHATSAPP' : (input.consent.sms ? 'SMS' : 'EMAIL')) resolves the consented channel from the patient record, and a second expression formats the localised subject line. Consent routing is a rule the lab must be able to change on a Tuesday afternoon without a release — so it lives in an expression, not a prompt.

  4. Agent

    Compose the covering message only. An Agent node writes the covering message — patient name, panel, collection date, secure expiring link, and how to book a consultation — in the patient's registered language via Sarvam. It transmits the report; it does not summarise, quote or explain a single value.

  5. Approval

    Policy-gated releases are signed off. An Approval node gates any release the policy branch flagged — a human releases the clinical document, and the release is stamped with who did it.

  6. Output

    Deliver on the consented channel. An Output node sends on WhatsApp / SMS / Email per the SpEL-resolved consent, carrying the secure link rather than clinical content in the message body.

  7. Agent

    Answer only operational questions. A second Agent node handles replies inside a hard boundary: link expired, name spelt wrong, hard copy, appointment booking. For ANY question about what a result means it refuses to interpret and hands off — the receptionist's impossible position, removed by design.

  8. Approval

    Clinical questions reach a clinician. An Approval/hand-off node routes every interpretation request to a qualified human with the patient's context attached, in the same conversation thread the patient is already in.

Channels & connectors

  • Webhook
  • WhatsApp
  • SMS / Twilio
  • Email
  • Sarvam
  • Approval / HITL
  • Tool (MCP → LIMS / patient portal / appointments)

Outcome

Signed reports reach patients on a channel they use, in a language they read, without a front-desk executive attaching PDFs one at a time — and every 'is this bad?' lands with a qualified human instead of with whoever picked up.

Why it helps

Two mechanisms. Language: a report a patient cannot read is a report that generates a phone call, and a Sarvam-localised covering message removes that call at source. Safety: making refusal-and-handoff an explicit, tested path means the interpretation question gets routed rather than improvised — which is precisely the risk an untrained front-desk answer carries today.

Build spec

2 agents1 delivery composer (once per authorised report) + 1 reply handler bounded to operational Q&A. Channel/consent resolution is a deterministic SpEL tool; the sensitivity branch, the release approval and the clinician handoff are workflow nodes. · Pattern: Signed-only trigger → policy branch → SpEL consent routing → localised delivery → bounded reply agent with mandatory clinical handoff

System prompt (paste-ready)

You deliver an ALREADY-AUTHORISED laboratory report to the patient it belongs to. Compose a covering message containing ONLY: patient name, test/panel name, collection date, the secure report link, the link's validity, and how to book a consultation. Localise into the patient's registered language. You must NOT summarise, quote, interpret, grade or comment on ANY value in the report — not even to say the results look normal. If the patient asks what a result means, whether it is serious, what to do, or anything about medication, reply that a qualified clinician will answer and hand the conversation off immediately with the patient's context attached. Never diagnose, never reassure, never advise.

Agent roles & model tiers

  • Delivery composer (per report) Economy tier with a fallback model — one short templated localised message per report; volume tracks report count and delivery must not stall on a provider outage

    Compose the localised covering message: identity, panel, collection date, secure link, booking route. Zero clinical content — no values, no summary, not even 'looks normal'.
  • Bounded reply handler Premium/standard tier with fallback — sees few messages but must refuse reliably under emotional pressure, which is exactly what you are paying for

    Answer ONLY operational questions (link, format, hard copy, name correction, appointment booking). Classify any clinical or medication question as OUT_OF_SCOPE and hand off to a clinician with context — never attempt an answer, never soften it into general advice, never reassure.

MCP connectors

  • LIMS — via Tool (MCP): confirm the report is authorised and mint a secure, expiring report link for this patient and accession
  • Patient portal / demographics — via Tool (MCP): read registered language, consented channels and contact numbers; log the delivery against the report id
  • HIS / appointment system — via Tool (MCP): fetch the next available consultation slot so the covering message can offer a real booking route

Built-in tools

  • user-defined tool `delivery_channel` (SpEL): input.consent.whatsapp ? 'WHATSAPP' : (input.consent.sms ? 'SMS' : 'EMAIL') — consent-first channel routing as a formula the lab's compliance owner edits directly, so a change in consent policy is a one-line edit, not a release
  • user-defined tool `link_validity_line` (SpEL): 'Valid till ' + input.expiresOn + ' · Ref ' + input.accession — one consistently formatted line across every language template
  • knowledge_search (report-release policy, consent and channel rules, the sensitive-report list)
  • http_request (mint the expiring link; log delivery against the report id)
  • send_email (the Email arm of the consented-channel fan-out)

Guardrails

  • The workflow triggers ONLY on a pathologist-authorised report — preliminary results are structurally unable to enter it
  • Hard no-interpretation boundary: the agent transmits and never summarises, quotes, grades or explains a value — including refusing to say results look normal
  • Any clinical, prognostic or medication question is classified OUT_OF_SCOPE and handed to a qualified human with context; refusal-and-route is the tested path, not a fallback
  • Policy-flagged sensitive reports bypass automated delivery entirely and route to a human at the Approval node
  • Clinical content never appears in the message body — only an expiring secure link, on the SpEL-resolved consented channel; a patient with no consent on file receives nothing
  • Every delivery is logged against the report id, with the releasing human stamped wherever an approval applied

Cost strategy

The per-report composer is short, templated and localised — economy tier is its right home, and it is the term that scales with report volume. The reply handler sees only the fraction of patients who write back, so paying the higher tier there buys the thing that actually matters: dependable refusal and clean handoff on a clinical question. Do not economise on the reply handler to save on a small call count. Both roles carry a fallback model, because report delivery stopping for an afternoon is a queue at the collection centre.

Output & delivery

A signed-report Webhook starts the flow → the Condition node diverts policy-flagged sensitive reports to a human → the `delivery_channel` SpEL tool resolves the consented channel and language → an economy-tier agent composes a Sarvam-localised covering message with an expiring secure link → the Output node delivers on WhatsApp/SMS/Email → replies hit a bounded handler that answers logistics and routes every clinical question, via the Approval/handoff node, to a qualified clinician with full context.

4. Insurance / TPA pre-authorisation chased to a decision

The insurance desk is one executive with an Excel file called PREAUTH_TRACKER_final_v3.xlsx and a column headed 'follow up date' that is colour-filled yellow by hand. Each morning she logs into three different TPA portals with three different passwords kept on a sticky note under the keyboard, checks case numbers one by one, and re-uploads whatever document was queried — usually a referring note that was scanned crooked. A file goes quiet for three days because nobody refreshed that portal. On the day of the scan the patient is sitting in the waiting room, the MRI slot is held, and the case is still 'query raised'.

Trigger: Webhook (order flagged pre-auth-required in HIS/LIMS)

How the workflow runs

  1. Trigger

    Order flags pre-auth. A Webhook fires the moment an order is flagged as requiring pre-authorisation — the case starts when the order does, not when the executive reaches that row in the sheet.

  2. Agent

    Assemble + completeness-check the pack. An Agent node assembles the pack against that payer's documented checklist in Knowledge — policy details, referring note, indication, prior reports, tariff estimate — and returns {complete: false, missing[]} rather than submitting a file it already knows will bounce.

  3. Condition

    Complete enough to submit?. A Condition node routes an incomplete pack back for exactly the missing items — one specific request to the referring clinic or the patient, instead of a submission that fails a day later.

  4. Approval

    Insurance desk approves submission. An Approval node holds the submission — a pre-auth request commits clinical justification and a financial claim in the patient's name, so a human reviews and submits.

  5. Tool (MCP)

    Lodge it in the TPA portal. A Tool (MCP) node lodges the approved pack in the payer/TPA portal, keyed to the order id so a retry cannot open a duplicate case — the exact failure the manual re-upload habit produces.

  6. Loop

    Chase to a decision. A Loop node polls case status on your SLA cadence, replacing the colour-filled follow-up column. On a payer query it re-runs the completeness check for just the newly requested document rather than restarting the pack.

  7. Parallel

    Watch every payer at once. A Parallel node polls all open cases across all three payers in the same pass — the three-portals-three-passwords morning round, collapsed into one scheduled run.

  8. Output

    Keep patient and clinic informed. An Output node updates the patient (WhatsApp/SMS, Sarvam-localised) and the referring clinic (Email) on approval, query or denial — status and next step only, never a clinical opinion and never a coverage promise the payer has not given.

Channels & connectors

  • Webhook
  • WhatsApp
  • SMS / Twilio
  • Email
  • Sarvam
  • Approval / HITL
  • Tool (MCP → TPA portal / HIS / billing)

Outcome

Pre-auth packs go out complete on the first attempt and are then actively chased to an approval, query or denial — with the patient and the referring clinic told the status before the appointment day rather than in the waiting room.

Why it helps

The mechanism is the completeness gate plus the poll. Most pre-auth delay is a bounced file for one missing document followed by silence; checking against the payer's own checklist before submission removes the first, and a Loop polling on an SLA cadence removes the second — including on the days the executive is on leave, which is when the tracker stops being updated at all. The financial and clinical commitment still belongs to the human who submits.

Build spec

2 agents1 assembly/completeness agent (per case) + 1 query-response agent (only when a payer raises a query). The submission approval, the portal write and the multi-payer poll are workflow nodes. · Pattern: Completeness gate before submission → human approval → Tool(MCP) submit → Parallel polling Loop with query re-entry

System prompt (paste-ready)

You assemble an insurance pre-authorisation pack for a diagnostic order. Using THIS payer's checklist in Knowledge, gather {policy_no, payer, patient_ref, procedure/panel, indication_text, referring_clinician, prior_reports[], estimated_cost}. If ANY mandatory item is missing or unreadable, do NOT assemble a submission — return {complete: false, missing[]} so the workflow makes one specific request to the right party. Copy the clinical justification VERBATIM from the referring clinician's note; NEVER write, embellish or infer an indication yourself, and never state a diagnosis. Costs come only from the documented tariff via the `tariff_estimate` tool — no invented amounts. The pack is a draft: a human at the insurance desk reviews and submits it.

Agent roles & model tiers

  • Pack assembler / completeness checker (per case) Standard tier with a fallback model — payer checklists differ and a bounced file costs a day of turnaround, which dwarfs the token difference

    Assemble against the payer's own checklist; return {complete, missing[]} rather than a knowingly-incomplete submission. Clinical justification quoted verbatim from the referring note — never authored. Amounts only from the tariff tool.
  • Query responder (only on a payer query) Economy tier with fallback — narrow single-document turnarounds, many small runs across open cases

    Map the payer's query to the exact missing artefact, request that one item from the right party, and re-enter the completeness check. Do not re-open or re-argue the clinical justification, and never add new clinical text.

MCP connectors

  • Insurance / TPA pre-auth portal — via Tool (MCP): lodge the approved pack, poll case status, and upload the single queried document against the existing case number
  • HIS / LIMS — via Tool (MCP): read the order, the referring clinician's note and prior reports to attach to the pack
  • Billing system — via Tool (MCP): pull the current tariff for the procedure and post the approved/denied outcome onto the patient's estimate

Built-in tools

  • user-defined tool `tariff_estimate` (SpEL): input.baseRate * input.units + (input.urgent ? input.urgentSurcharge : 0) — the lab's own tariff arithmetic as a formula, so the estimate on a pre-auth is computed identically every time and updated by the billing manager when rates change, with no developer involved
  • user-defined tool `case_key` (SpEL): input.payerCode + '/' + input.orderId — a stable idempotency key so a retry or a re-triggered Webhook can never open a second case on the same order
  • knowledge_search (per-payer pre-auth checklist, documentation rules, tariff notes)
  • http_request (lodge the pack; poll case status; fetch prior reports)
  • send_email (the referring-clinic status update)

Guardrails

  • The agent never authors clinical justification — the indication is quoted verbatim from the referring clinician's note, and the agent never states a diagnosis
  • Nothing is lodged with the payer until the insurance desk approves at the Approval node — the submission is a financial and clinical commitment in the patient's name
  • Incomplete packs are never submitted; the completeness gate forces one specific request for the missing item
  • Amounts come only from the `tariff_estimate` SpEL tool over documented rates — no invented figures, and no coverage promise the payer has not given
  • Portal writes are keyed to `case_key`, so a retry or duplicate Webhook cannot open a second case
  • Patient-facing updates state status and next step only — never a clinical opinion, never an assurance of approval

Cost strategy

Volume is low (only flagged orders) but per-case stakes are high, so the assembler earns standard tier — a bounced file costs a day of turnaround. The query responder handles narrow single-document turnarounds and belongs on economy tier. The chase is polling, not inference: the Parallel/Loop pass costs HTTP calls and only re-invokes a model when a payer actually raises a query. Fallback models matter here because a stalled provider means a missed SLA window on someone else's portal.

Output & delivery

A pre-auth flag opens the case → a standard-tier agent assembles against that payer's checklist with `tariff_estimate` supplying the amount, and the Condition node blocks anything incomplete → the insurance desk approves at the Approval node → a Tool (MCP) node lodges the pack keyed to `case_key` → a Parallel polling Loop chases every open case across every payer to a decision, re-entering the completeness check on a query → an Output node keeps the patient (Sarvam-localised WhatsApp/SMS) and the referring clinic (Email) on status, with no clinical opinion and no coverage promise.

Related industries

Build one of these in minutes

The sandbox gives you a live agent workspace — no account, no card. Or head back to the full catalogue and compare patterns across every industry.

See how VegaDūta compares to n8n, Dify and BotpressWhy VegaDūta's architectureEstimate your WhatsApp API costs