For everyone — An order's journey, step by step

Order a package, and you know the scenario: payment, packing, shipping, delivery. Each step must happen in order and leave a trace; if the package goes missing at the warehouse, the chain resumes at that exact step, with no need to start everything over, and there is a known way to make it up to the customer. A workflow engine (process engine) is the software that plays this role for a machine: it walks through a pre-defined series of steps, remembers where it is, resumes after a failure, and knows how to "undo" cleanly what has already been done when a problem arises.

The need is everywhere: in factories, banks, public administrations — anywhere a file moves from desk to desk. Without it, a simple power cut would lose everything.

For Yokul, same logic: bringing a virtual world to life means running long series of steps that must be able to pause, leave a trace, and resume without losing the thread. With one extra idea, whose full value the rest of this article shows: you describe what must happen without ever prescribing the means. At runtime, the engine makes do with what exists — and fills in what is missing, one adapter at a time, like a stage manager who mounts the play with the theater's own equipment, substitutes a prop when one is missing, and writes it all down so the performance can resume after the intermission. This article presents the tool that manages these processes in the project.

It also has its human history, which the full text details: the engine was born in 2011, alongside the project's first memory and decision modeling, designed through successive versions and discussions — and, to express its execution graphs on a whiteboard, in meetings, out of a small hand-drawn UML derivative. A tool born first as a language for understanding each other.

The full text

What a workflow is

A workflow is a step-based process, described in advance: each step receives inputs, produces outputs, and advances the process from one state to the next. Three requirements distinguish a workflow engine from a mere sequence of instructions:

  • Persistent state. Where the process stands (which step, which intermediate data) is recorded outside the program: you can interrupt the execution, reboot the machine, and resume exactly where you left off.
  • Error recovery. A step that fails doesn't cancel the process: the engine records the failure, suggests a corrective action or retries the step, and the chain restarts from that precise point.
  • Compensations. Some steps cannot be "cancelled" in the strict sense — a payment has been sent, an object has been moved. The engine then knows how to run the reverse action, or the action that makes up for the situation: undoing, in the only sense in which that is possible.

On top of these three requirements comes a structuring choice: the process description is declarative. The steps, their conditions, and their sequences are described as data; the engine itself handles the execution. It is the same principle as for Yokul's behaviors (see Behavior Model): separating the description from the execution allows changing one without touching the other.

A minimal example

Take our package delivery, the way you would describe it to the engine:

  1. Pay — if the payment fails, the process stays blocked at this step, ready to be retried; it never moves on to the next one "by mistake";
  2. Prepare — the "in preparation" state is persisted before the work starts: a failure during preparation erases nothing;
  3. Ship — the sensitive point:

if shipping fails after the payment, the payment is not replayed: the engine triggers the planned compensation (refund, or a new shipping attempt);

  1. Deliver — final step, the process closes with the complete trace of its journey.

The key point is visible at step 3: a compensation is not a magic "cancel". It is an action described, in turn, to restore an acceptable situation — and it is the engine that knows when it must be run.

Why an engine in a simulation

A continuous world simulation is not just the reactive behaviors of individuals. Much of what brings it to life is long-running process work: an individual travels over several simulated days, a construction advances in phases, a resource is produced, transported, and then consumed, the awakening of an intelligence unfolds step by step. Each of these threads must survive interruptions — the simulation can be paused, slowed down, moved to another machine, or simply hit by a technical incident.

The workflow engine provides that backbone: it carries the state of running processes, advances them when their conditions are met, and handles recoveries and compensations when something goes wrong. It thereby complements the project's other planes — behaviors on one side, processes on the other — in the same spirit of separation of concerns: what an individual wants to do (the intention, described) and the technical sequence that realizes it (the implementation, executed) remain two distinct things.

An early story in the project

This need did not come out of a theory: it asserted itself from the first prototypes. The foundations of the memory & decision modeling — that is, the actors' memory and decision-making — were laid in 2011 by Eric F. and Jacques S., as the vibe coding chronicle tells. Managing long-running processes is its natural extension: a decision is rarely expressed in a single instant, but as a sequence of steps stretched across simulated time — which must be interruptible and resumable. And it was at that very same spot in the project that, in parallel, work on the workflow engine itself began: Eric F. designed it and wired it through successive versions, with the engineering of Mickael B. on the first implementations — well before Apache Quarkus entered the landscape.

Describing the process, without ever prescribing the means

The first design decision — apparently the most arbitrary, the most rewarding in practice — is that a process definition is written with no implementation constraint whatsoever. It says what must follow what; it never says by which means. Nothing in the definition mentions, for example, whether data flows in a push fashion (the emitter deposits it) or in a pull fashion (the receiver goes and gets it).

The building blocks — components — fall into three families:

  • Sources: a sensor of the environment, a message queue, a table of the world state… A source can produce continuously or be queried on demand.
  • Transformers: computations, filters, decisions — often themselves behaviors of the project.
  • Destinations: the world state, a queue, a simulation log.

You wire sources to transformers, and transformers to destinations — a bit like the visual assembly boards of n8n or Apache NiFi. The fundamental difference, at Yokul, is that these wirings remain plain data for a human: readable as such, drawable on a whiteboard, versionable in the repository.

At wiring time, capabilities are negotiated

The concrete means of fetching or receiving, exposing or emitting, does not appear in the definition. It is at wiring time, when the definition becomes real execution, that each component brings its capabilities: active or passive, pushes or polls, waits or queries — and both ends of a wire come to an agreement. None of these transactions ever needs to be written into the definition: it is the separation of concerns, applied all the way through — the description stays readable and evolvable without ever being hostage to the plumbing.

Today's visual tools live the same reality — the diagram is simple, the plumbing is negotiated — but the negotiation often remains hidden inside a configuration stack. Here, it is an explicit moment in the lifecycle of the process.

Compiling into an execution graph: the adapter that fills the gaps

It is a compilation/instantiation mechanism that performs the passage from definition to concrete reality. At each wiring — at process startup, then every time a definition changes during the simulation — it looks at what is actually available in the execution environment: classes, libraries, components already in place. And it produces a functional execution graph:

  • it starts threads when the chain requires it;
  • it injects what is missing: two passive components need to talk? The engine places a liaison component between them — a small matching pump that nobody explicitly asked for;
  • it connects everything and then supervises: interruptions, recoveries, compensations.

The injected adapter illustrates the idea: the definition held only an intention (these two components exchange), the execution composes the arrangement that realizes it — out of the capabilities actually available. The same logic holds for behaviors: an actor being born or a modified inheritance tree triggers a recompilation of the relevant parts, while the rest keeps running.

Here is the complete movement, from definition to functional graph — including when the definition changes while the simulation is running:

From a defined workflow (source, transformer, destination) to the execution graph that actually runs.

Drawing the graphs: the whiteboard UML derivative

There is a fun corollary: to design and share these complex graphs, back then we had invented a lightweight UML derivative — drawable on a whiteboard in a meeting, yet precise enough to represent real execution graphs. The most demanding case was the dynamic compilation of behaviors: when a definition changes — a modified behavior, a new entity type appearing in the inheritance tree, or simply a definition file replaced on disk while the simulation is running — the execution graph migrates, and these migrations must be drawable relative to one another, not just a single frozen state.

The exercise left a mark that goes beyond the anecdote: whatever the whiteboard found readable, the engine's definition format had to remain readable too.

Key takeaways

  • A workflow engine runs step-based processes with persistent state: interruption and resumption without losing the thread.
  • Error recovery and compensations handle incidents where they occur, without replaying the whole process.
  • The process is described declaratively; the engine executes it — the same description/execution separation as for behaviors.
  • The definition never prescribes the means: at wiring time, capabilities are negotiated, and the compilation into an execution graph injects what is missing (threads, adapters).
  • In Yokul, it carries the long-running processes of the simulated world, a role proven useful as early as 2011 in the first memory & decision prototypes.

See also