The Last Application · Part V — Technical Appendices
Chapter 20 — Workflows: Process, Agentic, and Hybrid
6 min read
A workflow is not a second product. It is a typed object in whose payload is itself a graph of steps. This chapter gives that graph a mathematics covering process (BPM-class), agentic orchestration, hybrid composition, runs, and loops.
Workflow as an object in
Definition 20.1 (Workflow object). A workflow is an object with schema in the workflow family and payload containing a workflow graph . Write .
Definition 20.2 (Workflow graph).
where:
- is a finite set of nodes (steps).
- is a finite set of arcs (control-flow edges), each optionally gated by a predicate .
- assigns a kind from a finite kind alphabet .
- assigns finite metadata (forms, adapters, orchestration, waits, …).
- is the entry node.
Kind alphabet (representative).
Catalog facet. A workflow object also carries a facet tag
used for authoring and cataloguing. Facet is not a second graph format: both process and agentic workflows are instances of Definition 20.2.
Run state
Definition 20.3 (Run). A run is a tuple
where:
- identifies the workflow object,
- is status,
- is the set of active tokens (marking),
- is a finite run data map (keys to values),
- is a finite history of step events.
Definition 20.4 (Waiting modes). When , a mode
records which external agency must resume the run.
Firing a step
Definition 20.5 (Step effect). Firing node in run against product graph produces:
- An optional product mutation ,
- An updated data map ,
- A next marking ,
- A status (possibly waiting).
The product update, when present, is always through Chapter 19:
A step that would violate integrity does not commit; the run records failure or routes to repair according to .
Definition 20.6 (Sequential advance). On an ordinary arc with gate :
Process (BPM-class) structure
Process workflows emphasize business control flow.
Definition 20.7 (Decision). If , metadata supplies a finite branch map
and a key extraction . The successor is when defined; otherwise a default or failure arc.
Definition 20.8 (Gateway). A gateway node implements AND/OR split or join. For a parallel split with successors :
For a join of predecessors , the gateway fires when , then emits a single successor token.
Definition 20.9 (Human / collect / integration).
- — binds a form schema; completion writes fields into and may seal secrets into a vault handle (never into chat).
- — sets ; resume requires an authorized actor.
- — invokes a sealed connector; effects outside are mediated by handles recorded in and events.
Definition 20.10 (Domain of a step). The write-domain is the set of product objects may modify. Two steps are write-disjoint when
Proposition 20.1 (Parallel safety). If a parallel split fires write-disjoint steps and each child proposal is validated, the merged mutation
may be validated atomically; under write-disjointness, then coincides with when both orders pass .
Proof sketch. Disjoint writes imply commuting updates on ; integrity on the merge is the conjunction of local typing/referential obligations plus shared structural constraints.
Agentic structure
Agentic substance lives inside agent nodes, not as a parallel BPM of specialists.
Definition 20.11 (Orchestration). If , metadata may include an orchestration
where:
- is the pattern,
- is a finite set of specialist agents (roles, tools, prompts as data),
- is the handoff relation (who may call whom),
- is a finite set of interrupt points (HITL mid-orchestration),
- is a budget (step cap, token cap, time cap).
Definition 20.12 (Agentic step as an operator). Executing with orchestration induces a finite interaction trace
and a proposal . Interrupts pause with or when an IDE-capable agent node is declared.
Definition 20.13 (IDE-capable node). A node may declare . Then the run may enter ; an external IDE agent fetches a task, performs work, and submits a result that resumes — still through and , never as an ungated side channel.
Axiom 20.1 (One audit trail). Whether the muscle of an agent step is hosted inference, an IDE agent, or an external executor, the run and product mutations remain the system of record. Executors are pluggable; and are not.
Hybrid
Definition 20.14 (Hybrid workflow). when contains both BPM-class control nodes (collect, gateway, human, integration, …) and at least one agent node (possibly with ). Formally:
Hybrid is the product claim in one sentence: business process and agentic judgment share one governed graph and one run.
Loops (governed iteration)
Definition 20.15 (Loop). A loop is a subgraph pattern with a distinguished decision node carrying
where is a fail budget and names a boolean in set by a deterministic verifier (not by model self-assessment).
Branches:
with counter incremented on each fail. Exhaustion routes to HITL.
Formal reading. A loop is with an explicit validate stage: body proposes, verify evaluates a predicate , pass commits onward, fail repairs, exhausted escalates.
Composition of workflows
Definition 20.16 (Subprocess). If , metadata references another workflow . Firing spawns a child run whose completion writes outputs into and returns a token to the parent.
Definition 20.17 (Sequential composition of workflows). is the workflow that runs after completes, either by arc or by subprocess. Product mutations accumulate as
along the run.
Definition 20.18 (Intent composition, informal). When two product intents share typed structure and the same gated store, their composition is the pushout of their subgraphs in (shared identifiers glue). When they do not share , composition degenerates to integration by convention — outside .
Soundness obligations
| Obligation | Statement |
|---|---|
| Graph SoT | lives in ; runtime does not keep a shadow process definition |
| Gated effects | Every product write uses and |
| Parallel safety | Parallel tokens respect write-disjointness or merged validate |
| Agentic enclosure | Specialists live in , not as ungated side graphs |
| Loop honesty | Pass/fail from deterministic , not model self-grade |
| Waiting integrity | Resume from human/IDE/external re-enters the same |
The point
Process and agentic work are one mathematics: workflow graphs, markings, gated mutations. Hybrid is their conjunction. Loops are governed . Architecture chapters next place these objects among pillars and projections.