1. Dropped home visit → covered, with the dispatch human-approved
06:20, and a nurse messages the coordinator: fever, can't come in. Her six visits today include a dressing change, an insulin administration and two frail clients who cannot be left. The coordinator opens the roster — a Google Sheet printed every Sunday and stuck on a whiteboard with magnets — and starts down a WhatsApp group of forty carers, typing 'anyone free in Jayanagar 11am?' Some reply, some don't, some are already double-booked on a row of the sheet she hasn't scrolled to. She phones four people. By 09:00 half the day is covered, three families have been told, and she genuinely cannot remember which three.
Trigger: WhatsApp from the carer, or Webhook (rostering app marks unavailable)
How the workflow runs
- Trigger
Carer reports unavailability. The carer's own WhatsApp/SMS message, or a Webhook from the rostering app, opens the gap — the same message she already sends, now starting a workflow instead of a scroll.
- Knowledge
Load acuity and skill rules. A scoped Knowledge collection supplies YOUR documented client-acuity tiers, the skill/qualification matrix and the travel and shift-hour rules — the things currently held in the coordinator's head.
- Agent
Rank the affected visits by care need. An Agent node ranks the affected visits: which are clinically unskippable, which are skill-gated (injection, catheter, wound), which can shift by hours. It applies the written rules and makes no clinical judgement of its own.
- Parallel
Check the whole pool at once. A Parallel node evaluates candidate carers simultaneously — qualification match, travel feasibility from their previous visit, shift-hour limits — replacing the serial phone round and the 'anyone free?' broadcast that reaches forty people and answers nobody.
- Tool (MCP)
Hard skill gate (user-defined SpEL tool). A tenant-authored tool `skill_gate` (SpEL, e.g. input.visitSkills.contains('INJECTION') ? input.carerQualifications.contains('RN') : true) enforces qualification matching deterministically. A skill gate must never be a model's judgement call — as an expression it is auditable, testable, and editable by the nursing lead when a qualification rule changes.
- Condition
Anything still uncovered?. A Condition node splits covered from uncovered. An unskippable visit with no qualified carer escalates to the nurse-in-charge instead of being quietly rescheduled to tomorrow.
- Approval
Nurse-in-charge dispatches. An Approval node holds every reassignment — sending a specific carer to a specific frail client is a clinical staffing decision with a duty of care attached, so a qualified human confirms each dispatch and each skill match.
- Output
Tell carers, clients and families. On approval, an Output node messages assigned carers with the visit detail, and clients/families on WhatsApp or an ElevenLabs Voice call (Sarvam-localised) with who is coming and when — the step that silently fails today.
- Tool (MCP)
Write the roster and any extra-visit charge. A Tool (MCP) node updates the rostering system; where cover triggers a chargeable out-of-cycle visit, an approved Razorpay UPI payment link goes to the family. Nothing is auto-debited, ever.
Channels & connectors
- Webhook
- SMS / Twilio
- Voice / Call
- ElevenLabs
- Sarvam
- Razorpay (UPI)
- Approval / HITL
- Tool (MCP → rostering / billing)
Outcome
A dropped shift becomes a ranked, skill-matched cover proposal within minutes, and once the nurse-in-charge dispatches it, every carer, client and family is told automatically — no whiteboard, no forty-person broadcast, no trying to remember who was called.
Why it helps
The mechanism is parallel search plus guaranteed notification. The coordinator's slow step is a serial phone round against a printed sheet; evaluating the pool in parallel against documented skill and travel rules collapses that to a single decision. And the step that fails most often — telling the family who is now coming — becomes an automatic consequence of the dispatch rather than a task someone has to remember at 09:00 on a bad morning.
Build spec
2 agents — 1 acuity/priority agent (once per gap) + 1 cover-matching agent invoked across the pool by the Parallel node. Qualification matching is a deterministic SpEL tool; the dispatch approval, the notifications and the roster write are workflow nodes. · Pattern: Priority ranking → Parallel candidate matching with a SpEL skill gate → human dispatch approval → guaranteed multi-party notification
System prompt (paste-ready)
You are a home-nursing roster assistant for {{provider}}. Given the affected visits of an unavailable carer, rank them using ONLY the client-acuity tiers and skill rules in Knowledge. Return strict JSON per visit {visit_id, client_ref, acuity_tier, required_skills[], skippable, latest_safe_time, candidate_carers[{carer_ref, skill_gate_result (copied from the `skill_gate` tool), travel_feasible, within_shift_limits}]}. You propose cover — you never dispatch, never message a client, and never mark a visit skippable unless the documented rules say it is. You must NOT make any clinical judgement about a client's condition, and must NOT alter the care plan or medication. If no qualified carer exists for an unskippable visit, return escalate=true for the nurse-in-charge.Agent roles & model tiers
Acuity ranker (per gap) — Standard tier with a fallback model — this ranking decides which frail client is seen first, and a 06:20 outage cannot mean no ranking at all
Rank affected visits strictly by documented acuity tiers and skill gates. Never infer clinical need beyond the written rules; unskippable-with-no-cover ⇒ escalate=true.
Cover matcher (per candidate carer, run in Parallel) — Economy tier with fallback — many short mechanical checks per gap
For ONE candidate carer, take the `skill_gate` verdict as authoritative, then check travel feasibility from their prior visit and shift-hour limits, returning a structured verdict with reasons. Roster facts only — never assume willingness or availability.
MCP connectors
- Rostering / home-care management system — via Tool (MCP): read today's roster and carer availability, then write the approved reassignment against the visit id
- Carer HR / qualification register — via Tool (MCP): fetch each candidate's current qualifications and expiry dates to feed the skill gate
- Billing system — via Tool (MCP): raise the out-of-cycle visit charge once approved, and attach the Razorpay UPI payment reference to the client's account
Built-in tools
- user-defined tool `skill_gate` (SpEL): input.visitSkills.contains('INJECTION') ? input.carerQualifications.contains('RN') : true — the agency's own qualification rule as a deterministic expression, so a skill gate is never a model's opinion and the nursing lead can update it the day a qualification policy changes
- user-defined tool `visit_fee` (SpEL): input.outOfCycle ? (input.baseFee + (input.afterHours ? input.nightSurcharge : 0)) : 0 — the extra-visit charge computed by formula, so the family sees the same number the agency's price list says
- knowledge_search (client-acuity tiers, skill/qualification matrix, travel and shift-limit rules)
- http_request (read roster and availability; write approved reassignments; issue an approved payment link)
Guardrails
- No dispatch happens without the nurse-in-charge's approval — the agent proposes cover, a qualified human sends a carer to a client
- The agent makes no clinical judgement about a client and never touches the care plan or medication; it applies only the documented acuity and skill rules
- Skill gates are enforced by the `skill_gate` SpEL expression as hard filters, never soft preferences a model can trade away against travel time
- A visit is skippable only if the written rules say so — an unskippable visit with no qualified carer escalates rather than being rescheduled
- Money movement is gated twice: a human approves the charge, and the family receives a Razorpay UPI link — nothing is ever auto-debited
- Roster writes are keyed to the visit id, so a re-trigger cannot double-assign a carer or double-charge a family
Cost strategy
The matcher is the multiplied term — once per candidate carer per gap — so it stays on the economy tier and hard-capped; the Parallel node buys wall-clock speed, not extra cost per check. The acuity ranker runs once per gap and is where standard tier earns its keep, because that single ranking decides which frail client is seen first. Both carry a fallback model: a 06:20 provider outage is exactly the morning you cannot afford to be back on the whiteboard.
Output & delivery
The gap opens by the carer's own WhatsApp message or a Webhook → a standard-tier agent ranks affected visits on documented acuity rules → a Parallel node runs cheap per-carer checks across the pool with the `skill_gate` SpEL tool as a hard filter → the Condition node escalates any uncovered unskippable visit → the nurse-in-charge dispatches at the Approval node → an Output node notifies carers, clients and families (WhatsApp and ElevenLabs Voice, Sarvam-localised) → a Tool (MCP) node writes the roster and, only if approved, issues a Razorpay UPI link for a chargeable extra visit.