A workflow is a flowchart
A workflow is a set of boxes joined by arrows. Each box is a node: one step, such as “call this API”, “run the tests” or “ask a model to classify this ticket”. Each arrow is an edge: “when this step is done, do that one.” Nodes come in three roles, and the role is visible in the shape of the chart:- A trigger starts things. It has no arrows going in.
- A processor does the work in the middle: transforms, calls out, decides.
- A terminal ends a branch. It has no arrows going out.
Steps have outcomes, and outcomes choose the arrow
A real step does not only “finish”. The tests passed, or they failed. The request returned 200, or 503. The ticket is a bug, or a question. Yukta models this with ports: named exits on a node. An edge can say “I only follow thesuccess exit”. One step can therefore send different outcomes down different arrows, and that is how a workflow branches.
Three details make ports pleasant in practice:
- An arrow with no port name follows every normal exit. A named arrow follows only that exit.
- Which ports a node offers depends on its plugin. A process node routes by exit code, an HTTP node can route by status, a branch node has one port per case.
erroris built in and separate. A message that fails all its retries can leave througherror, so failures go to a dead-letter step instead of leaking into the normal path.
Messages carry the data
What travels along the arrows is a message: the data (the payload) plus a few labels, such as where it came from and an id you can trace through the whole run. A trigger can emit one message or thousands. A step can turn one into several, or several into one. Two properties explain most of the behaviour you will see:- Messages are never edited in place. A step builds a new message from the one it received. Two branches that get the same message cannot disturb each other. The copy is shallow, so treat a received payload as read-only.
- A message keeps its identity as it moves. Transforming a payload keeps the message id and trace id. That is what lets you follow one input from trigger to terminal, and lets a step recognise a message it has seen before.
A run is one pass through the chart
Saving a workflow does nothing. Starting it creates a run: one live pass, with its own id and a status for the whole run and for every node. The same workflow can have many runs, and each remembers which version of the chart it used. (The API calls a run anexecution.)
Picture a token walking the chart. The trigger emits a message; each node receives it, does its work and emits on a port; the next node receives it, and so on until a terminal ends the branch. Nodes work in a stream, so a second message can be in step 3 while the first is in step 5.
A start request is admitted when a slot is granted, messages flow from node to node, terminals finish, and the result and history are kept.
Figure 1: The life of a run. Notice that admission comes first: a run gets its id only once the server has a slot for it, so a refused start never leaves a half-created run behind. Statuses only move forward. A finished node cannot reopen because a late event arrived. If something fails, only the node that failed shows a failure; the nodes behind it show that they never ran because of it. Runs covers the statuses in detail.What Yukta does around your steps
You describe the steps. Yukta wraps every one of them in the same machinery, so a plugin only has to do its own job:- Back-pressure. A slow step makes the steps feeding it wait, so memory stays bounded. See Delivery and back-pressure.
- Retries and error routing, per step. See The failure model.
- Time limits on the run and on each step. See Time limits.
- Pause, step, skip and breakpoints for any step of a live run.
Trade-offs you accept
Every model buys something by giving something up. Be clear-eyed about these:- No cycles. A workflow is a directed acyclic graph, checked before anything runs. You cannot draw an arrow back to an earlier step. Repetition is expressed differently: a step that loops over one call, a fixed number of unrolled rounds, or a sub-workflow run again. You get a hard upper bound and a chart that can always be read left to right. You lose open-ended “keep going until done” in the graph.
- Data, not code. A chart is simple to review and generate but is not a programming language. Complex logic goes into a step (an expression, a script, a program) rather than into the graph.
- At-least-once delivery. After a crash or a retry, a step may see the same message again. Make side effects safe to repeat.
- One server. A run’s state lives in one server at a time. See Durability and high availability.
Related
- Your first workflow: see the model run, in about ten minutes.
- Workflow playground: connect nodes in the browser and watch a simulated run.
- AI and deterministic work: what happens when some boxes are AI steps.
- Define a workflow and Route and branch: do it yourself.
- Workflow JSON reference and Messages reference: every field.