Engineering1 min read
Designing a workflow engine you can watch run
Watching a workflow run live, and replaying it later, sounds like a frontend feature. It is mostly a backend design problem. These are the three decisions that make it work in Worfilo.
Oshadha VimukthiBuilder of Worfilo
One rule for every branch
The executor has no special case for any node type. It follows a single rule: an outgoing edge is active only if its source port appears in the node's result, and dead otherwise. A node whose incoming edges are all dead is skipped, and its own edges die too.
An If node fires true or false, so one branch dies. A node that fails with the continue error mode fires nothing, so everything downstream is skipped. A Merge waits until each incoming edge is settled. Branching, skip cascades and error ports all fall out of that rule, which is also why the canvas can explain every skipped node.
Every step is an event
As the run executes, the engine publishes events such as a node starting, streaming tokens, succeeding or failing. Each persisted event gets a sequence number within the run, and the editor subscribes over server-sent events.
GET /runs/{run_id}/events?after_seq=42If the connection drops, the client reconnects with the last sequence number it saw. It receives exactly the events it missed: none replayed twice, none lost.
Replay needs the exact graph
A run is only replayable if you know what ran. Worfilo stores a snapshot of the graph with every run, next to each node's resolved inputs (with secrets redacted) and outputs. Reopening a run renders that snapshot on a read-only canvas, so replay stays correct even after the workflow has been edited or republished.
The canvas never executes anything
The frontend renders a JSON graph and subscribes to events; the backend validates and executes graphs and never knows about pixels. That split keeps the engine testable on its own, with fake nodes that never call a model, and means a graph runs the same from the editor or from a JSON file.
Share this post
Build it on the canvas
Describe a workflow, watch every node run, and ship it as an API. Free to start.
More from the blog
All postsKeep reading
- Building AI agent workflows on the canvasHow Worfilo workflows are structured: triggers, nodes, ports, data edges and tool edges, branching and merging, and how the executor decides what runs.
- Execution controls: retries, timeouts, errorsControl how Worfilo runs AI workflows: per-node retries with backoff, timeouts and error modes, and run-wide parallelism, timeouts and token caps.
- Introducing a visual editor for AI agent workflowsWhy I built Worfilo, a visual editor for AI agent workflows you can watch run: what it does today and what comes next, from developer Oshadha Vimukthi.