DEV Community

Dinesh Singh Panwar
Dinesh Singh Panwar

Posted on • Originally published at apmn.kshetra.studio

Agentic AI in Clinical Processes

Your Clinical Processes Already Know Where AI Belongs

A technical guide to converting existing BPMN healthcare workflows to APMN for agentic AI


Most healthcare AI programmes start by asking the wrong question.

"Which AI platform should we adopt?" "What should we pilot?" "Let's build something new and see what sticks."

Meanwhile, sitting in a process repository, is a BPMN diagram for patient preadmission. Another for prior authorisation. Another for clinical triage. Each one represents years of institutional knowledge -- every compliance requirement codified, every exception path tested against real patients.

That knowledge gets ignored. Teams reinvent from scratch. Pilots stay as pilots.

There is a better starting point.


What BPMN Cannot Express

BPMN 2.0 handles deterministic healthcare processes well. Sequential care steps, parallel workstreams, human tasks, service calls, exception handling -- it covers all of this.

The problem is that AI agents are not deterministic. Three specific gaps matter for health:

Probabilistic outputs. A radiologist returns a diagnosis. An AI model returns a probability distribution. BPMN has no way to say "proceed if confidence exceeds 90%, escalate to clinician if below". Teams hack this into service task variables and exclusive gateways. It works but makes the decision trail hard to audit.

AI-specific failure modes. BPMN handles system failures well. It handles AI failures badly. There is no boundary event for hallucination, no error handler for model drift, no standard catch for "the model was confident but the output was clinically implausible".

Transition states. A hospital cannot flip a switch and hand clinical decisions to AI. BPMN has no concept of "run AI alongside human for six months, compare outcomes, then decide". A task is either human or automated. Nothing in between.


What APMN Adds

APMN -- AI Process Model and Notation -- is an open extension of BPMN 2.0 that addresses these gaps while remaining fully backwards compatible with existing BPMN tools and diagrams.

It uses BPMN 2.0's official extension mechanism. Your existing diagrams remain valid.

The key constructs for healthcare:

agentTask -- an AI model performs clinical reasoning, document analysis, or administrative processing. The model, version, prompt context, and output schema are explicit in the diagram.

ragTask -- retrieve clinical context before reasoning. Patient history, previous imaging, medication records, clinical guidelines. The retrieval step is a first-class process node, not hidden inside a service call.

confidenceGate -- route based on AI confidence score. Thresholds are configurable per process and per risk appetite. High confidence proceeds. Mid-range flags for clinician review. Low confidence falls back to the human task.

humanInLoopTask -- structured clinician review of AI output before the process continues. Designed specifically for AI oversight -- the clinician sees the AI recommendation, the confidence score, the source documents, and the key factors driving the output.

escapeGate -- automatic safety net. If AI confidence drops below a minimum floor, if the model times out, or if output fails structural validation, the escapeGate catches it and routes to the deterministic fallback. The reliable process that was running before AI was introduced.

modelVersionGate -- run two model versions in parallel on a percentage of cases and compare outcomes before committing to an upgrade across the full patient population.

Full spec at apmn.kshetra.studio/spec/apmn-v0.1

APMN Flow for Patient pre-admission


The TwinTrack Architecture

The architectural principle behind APMN adoption is foundational separation between AI infrastructure and deterministic infrastructure, joined by lightweight orchestration ramps.

Your existing clinical process -- the one that passes audits, that clinicians trust -- runs on the reliable track. It does not change.

AI runs on the innovation track in parallel. On-ramps divert selected cases to the AI track based on routing criteria you define. Off-ramps return cases to the reliable track if confidence drops or an escapeGate fires.

The separation means a failure in the AI track cannot propagate to the reliable track. Governance of AI decisions is isolated from governance of deterministic decisions. Clinicians trust the reliable track unconditionally -- which is the prerequisite for AI adoption in clinical settings.

As evidence accumulates, the routing criteria widen at a pace determined by your risk appetite.


A Worked Example: Patient Preadmission

Standard BPMN: receive referral, verify insurance, review medical history, assess clinical priority, schedule, confirm. Steps 2, 3, 4 are human tasks.

In APMN with TwinTrack:

Verify insurance: ragTask retrieves policy documents. agentTask verifies eligibility. confidenceGate routes on confidence score. escapeGate catches failures and returns to human task.

Review medical history: ragTask retrieves EHR records and clinical guidelines. agentTask summarises and flags risk factors. escapeGate validates output before it reaches the clinician. humanInLoopTask presents the AI summary alongside source documents for clinician sign-off.

Assess clinical priority: agentTask applies urgency scoring. confidenceGate routes high-confidence scores to expedited scheduling, borderline scores to consultant review, low confidence to the human task on the reliable track.

Steps 1, 5, 6 are unchanged. The business logic and compliance requirements are unchanged. Three bottlenecks now have AI handling preparation work, with human oversight calibrated to confidence level and clinical risk.

Full worked example with before/after diagrams at apmn.kshetra.studio/examples/patient_preadmission


Getting Started

Upload your existing BPMN to TwinTrack. It identifies every human task where AI can act, scores conversion confidence, and generates APMN output plus deployment-ready Orkes Conductor JSON.

You control the confidence thresholds, the routing criteria, and the pace of adoption.

APMN spec v0.1 (Apache 2.0): apmn.kshetra.studio/spec/apmn-v0.1
APMN visual modeller (MIT): apmn-modeler.kshetra.studio
TwinTrack, free to try: bpmn2ai.kshetra.studio

Full article with regulatory context and governance framework: apmn.kshetra.studio


Dinesh Singh Panwar, founder of Kshetra Studio. Creator of APMN and TwinTrack.Former Head of Technology, Westpac Group.

Top comments (0)