Orchestration

L4. Workflow, run, step, trigger and event. Five nouns that turn a decision into durable execution.

1 min read Updated Aug 12, 2026

Orchestration

L4. The layer that executes.

A decision that is not durable is a guess. This layer takes a plan and runs it, survives a crash, retries a failure, waits for a person, and records everything it did.

L4 ORCHESTRATION — the run state machine, from a trigger to a terminal state
L4 ORCHESTRATION — the run state machine, from a trigger to a terminal state
TRIGGERS
TRIGGERS
Manual
a person asks
Manuala person asks
Schedule
a time is reached
Schedulea time is reached
Event
company state changed
Eventcompany state changed
Webhook
an external system posts
Webhookan external system posts
Agent
a plan is delegated
Agenta plan is delegated
queued
queued
denied
nothing ran
deniednothing ran
admitted
admitted
running
running
awaiting_approval
the run consumes nothing
awaiting_approvalthe run consumes nothing
succeeded
succeeded
failed
retries exhausted
failedretries exhausted
cancelled
a person intervened
cancelleda person intervened
run events
append-only, and the audit trail
run eventsappend-only, and the audit trail
policy admits
policy admits
policy refuses
policy refuses
policy asks a person
policy asks a person
approved
approved
every step
every step
LEGEND
LEGEND
terminal success
terminal success
paused, or stopped by a person
paused, or stopped by a person
refused, or failed
refused, or failed
an ordinary state
an ordinary state
a grouping, not a state
a grouping, not a state
Text is not SVG - cannot display
L4 ORCHESTRATION — the run state machine, from a trigger to a terminal state
L4 ORCHESTRATION — the run state machine, from a trigger to a terminal state
TRIGGERS
TRIGGERS
Manual
a person asks
Manuala person asks
Schedule
a time is reached
Schedulea time is reached
Event
company state changed
Eventcompany state changed
Webhook
an external system posts
Webhookan external system posts
Agent
a plan is delegated
Agenta plan is delegated
queued
queued
denied
nothing ran
deniednothing ran
admitted
admitted
running
running
awaiting_approval
the run consumes nothing
awaiting_approvalthe run consumes nothing
succeeded
succeeded
failed
retries exhausted
failedretries exhausted
cancelled
a person intervened
cancelleda person intervened
run events
append-only, and the audit trail
run eventsappend-only, and the audit trail
policy admits
policy admits
policy refuses
policy refuses
policy asks a person
policy asks a person
approved
approved
every step
every step
LEGEND
LEGEND
terminal success
terminal success
paused, or stopped by a person
paused, or stopped by a person
refused, or failed
refused, or failed
an ordinary state
an ordinary state
a grouping, not a state
a grouping, not a state
Text is not SVG - cannot display
The run state machine. Five trigger kinds start it, policy admits or denies it, an approval pauses it, and every step emits an event.

Components

ComponentJob
WorkflowThe definition. An ordered set of steps, versioned.
RunOne execution of a workflow or of an agent.
StepOne durable unit inside a run. It is retried on failure, and it is not repeated on resume.
TriggerThe condition that starts a run.
EventOne append-only fact a run emitted.
SchedulerStart a run at a time, or on a repeat.
ReaperClose a run that stopped reporting. One reaper, for every run.

The five nouns

TEXT
Workflow          what should happen
   │
   ├── Run #001   what did happen, on Monday
   ├── Run #002   what did happen, on Tuesday
   └── Run #003   what is happening now

A workflow is a definition. A run is an instance. Confusing the two produces a system where you cannot answer "what did it do last week".

What a run holds

TEXT
run
  workflow or agent, and the version pinned at start
  trigger           what started it, and who the principal is
  input             the brief
  state             one of the states below
  steps             child runs, each with its own state
  output            the result
  error             the failure, if any
  retries           the count, per step
  cost              tokens and money
  artifacts         what it produced
  events            the append-only log

The run row is the single source of truth for execution. There is one run table for agent runs and for workflow runs. A workflow run is the parent of its step runs.

Run states

TEXT
queued → admitted → running ──→ succeeded
            │          │  │
            │          │  └──→ awaiting_approval ──→ running
            │          │
            │          ├──→ failed        (retries exhausted)
            │          └──→ cancelled     (a person intervened)
            │
            └──→ denied  (policy refused at admission; nothing ran)

denied and cancelled are separate states on purpose. One means the system refused. The other means a person stopped it. A single "stopped" state loses the difference, and that difference is the first question anyone asks.

Triggers

Five kinds start a run. The run does not know which one it was, beyond one field.

TriggerStarts a run whenPrincipal
ManualA person asks in Mission ControlThat person
ScheduleA time or a repeat is reachedA service principal
EventA company state change matches a patternA service principal
WebhookAn external system posts, and the signature verifiesA service principal
AgentAn agent delegates a planThe agent's own principal, itself derived from a person

Policy admits every run, whatever the trigger. A scheduled run for an account over budget is stopped before it dispatches.

A webhook trigger always has a schedule beside it. External delivery is at-least-once and a message can be missed, so a slower schedule re-reads the same window. The steps must be idempotent, which makes the repeat harmless. A webhook on its own is data that is quietly incomplete.

The ingest workflow

Any pull from an external system uses one shape, and no model runs inside it.

TEXT
fetch  →  normalize  →  upsert  →  emit

fetch calls a vendor tool. normalize discards the payload and keeps only what we model. upsert writes through an internal tool, keyed so a re-run overwrites rather than duplicates. emit writes the run event that a downstream trigger may match. The worked example is Metrics and connectors.

Rules

  • A step is the unit of durability. A crash resumes at the last completed step. It does not restart the run.
  • A step is idempotent, or it carries an idempotency key. A retry must not send a second email.
  • A run pins its definition version at start. An edit to a workflow never changes a run in flight.
  • A wait is a state, not a loop. A run that waits for an approval or for an external event consumes nothing.
  • Every run has a deadline. The reaper closes a run that stopped reporting, and it records the reason.
  • Events are append-only. A correction is a new event. Nothing in the log is edited.
  • The engine sequences. It does not reason. A branch in a workflow is a condition over data, never a model call. A decision that needs a model is a step that runs an agent.

Events

One stream leaves this layer, and three consumers read it.

TEXT
run event
   ├── Mission Control activity feed   L6
   ├── trigger matcher                 L4, an event can start another run
   └── the accrual checkpoint          policy plane, cost adds up here

An event carries the run, the step, the kind, the severity and the payload. It never carries a secret.

Data model

TableHolds
workflowsThe versioned ordered steps, and the trigger bindings.
runsOne execution. A workflow run is the parent of its step runs.
run_eventsOne append-only fact from a run.
triggersThe start condition: kind, pattern, filter, target, input template, enabled flag.
artifactsOne file or record a run produced, and the step that produced it.

Risks

RiskMitigation
A trigger loop starts runs without end, and it costs moneyA budget per domain, a concurrency cap, a debounce, and an enabled flag on every trigger row
A retry repeats a side effectEvery side-effecting step carries an idempotency key, enforced at the tool layer
Run history grows until the table is slowA retention window, and a rollup of old runs to a summary row
A run waits for an approval that never comesEvery approval carries a TTL, and expiry fails the run with a clear reason
Two engines appear, one for agents and one for workflowsOne run table and one status model. This is checked in review

Open questions

  1. Does a workflow support a parallel branch in version 1, or only a sequence? Parallel is where most of the complexity lives.
  2. How long is the default run retention, and what is kept after it?
  3. Can a person edit the input of a waiting run and resume it, or must they cancel and restart?
  4. Does a step failure fail the whole run by default, or does the workflow declare the policy per step?

Diagram source. ac-docs/diagrams/mission-control-layers.drawio, page mission-control-orchestration. Edit that page, then run ./scripts/export-diagrams.sh mission-control-layers. Update this page and the diagram together.