DocsWorkflows

How workflows work

The parts of a workflow, what happens at each step of a run, how work is handed on, sent back and approved, and the limits that keep every run bounded.

Workflows shows how to run one. This page explains what happens underneath, so you can predict what a run will do, read any workflow on the canvas, and build your own.

The model in one minute

A workflow is a small graph saved as one JSON file:

  • Steps do the work. Most are agent steps: each one starts a fresh agent with its own instructions and tools, and ends with a written result.
  • Edges say which step comes next.
  • Bindings say what each step is given: your request, what came before, and the results of earlier steps.
  • Verify steps and approval steps can send work back to an earlier step, with the reason, instead of letting it through.
  • Limits cap attempts, steps, tokens, cost and time, so a run cannot loop forever.

The Behaviors tab draws the file as a canvas, and Rusty's workflow engine checks it before every run. A workflow the engine cannot run safely, for example one with a cycle, is refused before anything starts, and the editor shows why.

A run from start to finish

This is the everyday Plan, build, verify workflow after its Request step, the way the canvas lays it out. The arrows on the first line are edges. The lines below are the two ways work goes back: a failed check (retry) and a person asking for something else (changes).

Plan → Plan approval → Build → Verify → Acceptance → Manual checks → Result
  ↑          │           ↑                   │             │
  └ changes ─┘           ├ retry ────────────┘             │
                         └ changes ────────────────────────┘

Here is what happens after you press Enter:

  1. Request (an input step). The run starts with your message as request, the last result in the chat as context, and your attached files as attachments.
  2. Plan (an agent step, Plan profile, read-only). A fresh agent reads the request, the context and the code. It writes requirements with numbered acceptance criteria (R1.1, R1.2, …) and the tasks that will change the code. Only its final message moves on; the next steps never see its exploration.
  3. Plan approval (an approval step). The run pauses and the plan appears in a card above the message box. You approve it, approve it with notes, ask for changes, or reject it. Notes and requested changes go back to Plan, which revises the plan.
  4. Build (an agent step, Build profile, can change files). Implements the plan you approved, runs the project's checks and reports what it changed.
  5. Verify (an agent step, Verify profile, cannot edit). Checks every acceptance criterion against the workspace itself, reading the code and running the checks, and reports each criterion as pass, fail or manual with its evidence.
  6. Acceptance (a verify step; no model runs here). Reads Verify's criteria. Any fail sends the work back to Build, with Verify's evidence as the repair list, and Build, Verify and Acceptance run again. Manual criteria move on.
  7. Manual checks (an approval step). When Verify left checks that only a person can do, you get them with exact steps. Approve when they work. Otherwise describe what you saw and choose Request changes: the work goes back to Build and is verified again. When there is nothing to check, this step passes without asking.
  8. Result (an output step). Verify's summary becomes the run's final message in the chat.

Every built-in workflow that changes files follows this pattern. Some add steps before Plan (Analyze, Research, Debug, a security audit), build the plan one task at a time, or add a final review. See Built-in workflows.

The six kinds of step

The buttons above the canvas add one of each.

Step Runs a model? What it does
Input No Starts the run with the run input. A workflow has exactly one.
Agent Yes Runs a fresh agent under a profile and passes on its final message.
Verify No Checks an earlier step's result. When a check fails, it sends the work back, follows a failure edge, or fails the run.
Approval No Pauses the run until you approve, ask for changes, or reject.
Subflow Through the flow it runs Runs another workflow, or a single extra step, inside this one.
Output No Picks the step whose result is the workflow's result. A workflow needs at least one, and nothing may follow it.

Input

The input step receives the run input. When you send a message in Agent Mode, Rusty sends:

Field What it holds
request Your message.
context The last result in the chat, when a step of the workflow reads it (up to about 24,000 characters). Empty in a new chat.
attachments Files you attached.

Input defaults fill in fields the run input does not carry. They apply to steps that read the input step's own result. A step that reads the run input directly (a run_input binding, which is what Original request adds) sees only what Rusty sent.

Agent

An agent step is where the work happens. Each one:

  • starts fresh, in an isolated session that inherits your workspace, the chat's model and your permission settings. It does not see the chat or the other steps' conversations, only what is bound to it;
  • runs under a profile that sets its role instructions, tools, rules, turn limits and completion checks. With no profile (Session default) it runs under the profile the chat already uses;
  • gets the step's own instructions, followed by its inputs as Markdown in a workflow_input block. The prompt tells the agent the inputs are data, not instructions;
  • can use a tool only when three things allow it: the step's Tools setting, the profile's tool list, and the chat's permissions. A command still asks you before it runs;
  • ends with a final message, which is its result.

The Response format decides what that result is. Text / Markdown passes the final message on as written; this is the default and what most steps use. The JSON formats return a checked object instead, which a verify step can test field by field. The built-in Verify steps use one so the acceptance check can read each criterion. Models never have to write JSON by hand: the step is asked for Markdown headings that match the fields, and Rusty reads the reply into the object. A missing heading or ID is filled in or inferred, and an unclear result counts as unverified, never as a pass.

An agent step can also run a plan as a task queue.

Verify

A verify step runs no model. It reads what is bound to it and applies its checks:

Check Passes when
criteria A list of {id, status, evidence} has no failed criterion. fail sends the work back. manual (only a person can check it) moves on and is collected in the step's manual_checks, for an approval step to show you. With plan_pointer, every acceptance criterion in the plan must be reported, and one nobody reported counts as missing.
required_status The value at a pointer equals a given text, for example /status equals done.
artifact_exists The value at a pointer is present and not empty.
artifacts_resolvable Every {kind, reference} entry in a list really resolves in the workspace, for example a file that exists, rather than trusting the model's claim.
schema Every bound result matches the output schema of the step that produced it.
requirements_satisfied Every expected acceptance criterion has exactly one passing, evidenced result.

When every check passes, the run moves on. When one fails, the step sends the work back to its retry target (below). Without one, the run follows the step's failure edge if it has one, and otherwise fails at this step.

Approval

An approval step pauses the run and puts a card above the message box: the step's question, the result you are reviewing, a notes box and three buttons.

Button What happens
Approve The run continues. Notes you wrote are part of the approval's result, so later steps bound to it can read them.
Request changes Needs notes. The work goes back to the revise target (by default, the step whose result you are reviewing) with your notes as the changes to make. That step sees its previous result and your words, revises it, and every step in between runs again. Then you are asked again.
Reject The run ends, with your notes as the reason.

Settings that change this behavior:

  • Notes given with an approval revise the result first. Approving with notes then works like requesting changes, except that once the result is revised, the approval stands and you are not asked again. The built-in plan approvals work this way.
  • Times changes may be asked for (5 by default, at most 10). After that, the card offers only Approve and Reject. Asking for changes does not use up the target step's attempts.
  • Skip when empty at. A pointer into what is reviewed. When nothing is there, the step passes without asking. The built-in Manual checks steps use this, so you are only asked when there is something to try.
  • Auto mode. A checkbox in the workflow bar approves every step, including those marked Always ask a person, even when the run auto-approves, and answers every other prompt. See Auto mode.

Subflow

A subflow step runs another workflow, or one extra agent step, in the middle of this one: to research something first, to fix a bug found on the way, and so on.

  • Run a saved workflow: any workflow in your workspace, or a built-in one by its full id, such as rusty-ide.builtin.investigate for Research & analyze.
  • Run a single step: an agent with the instructions and profile you give it.

What is bound to the subflow step becomes the child run's input, and the child's result becomes this step's result. The child uses the same model, tools and permissions, and its permission prompts and approvals appear in your chat like any other. Flows can call flows up to three levels deep.

Important

Bind every field the child reads. The built-in workflows read request and context, so a subflow that runs one needs both bindings, usually straight from the run input. Input defaults do not fill them in.

Output

The output step names the step whose result is the run's result: Show the final message from a step. A pointer can pick one field of a structured result; the built-in pipelines show Verify's /summary. The output step must come last.

How work is handed on

A step sees only what is bound to it. Each binding has a name, which is what the agent sees in its workflow_input, and a source:

Source Reads Example
run_input A field of the run input. {"type": "run_input", "pointer": "/request"}
node_output The result of an earlier step, or one field of it. {"type": "node_output", "node_id": "plan", "pointer": ""}

A pointer of "" means the whole result; /summary means its summary field. A step can read only steps that are certain to have run before it.

You rarely write bindings by hand. In the editor, connecting one step to a Text / Markdown agent step binds the first step's result to the second, and the Context from earlier steps checkboxes add or remove bindings. Use Advanced data mapping for anything else.

Two things are easy to miss:

  • Only the final message moves on. The next step does not see a step's tool calls or reasoning, so a step's final message has to say everything the next one needs. The built-in steps are told so.
  • A workflow that does not read context still hears about the conversation. Rusty puts your earlier requests and the last result behind the new request, marked as background, so a follow-up such as "now fix what you found" does not start from nothing.

The order of steps

Edges connect steps. Each step has exactly one on success edge to the step that runs next (output steps have none) and may have one on failure edge to a step that runs instead when it fails. The engine refuses a workflow with:

  • more than one input step, or no output step;
  • a step with two success edges, or two failure edges;
  • a cycle;
  • a step that cannot be reached from the input step;
  • a binding to a step that is not certain to have run first.

Loops are made without cycles: a verify step or an approval step sends the work back to an earlier step, which then runs again. The canvas draws those as dotted lines below the cards, labelled retry and changes.

Sending work back

There are two ways, and both re-run every step between the target and the step that sent the work back.

Verify step Approval step
Triggered by A failed check. You choose Request changes, or approve with notes when the step revises on notes.
Goes back to Its retry target: On failure, retry. Its revise target: Requested changes go to. By default, the step whose result you reviewed.
The target is told Why the attempt was rejected. For a criteria check, each failed criterion with its evidence. Your notes, word for word, as the changes to make, together with its previous result.
How many times Until the target runs out of Attempts. Up to Times changes may be asked for. It does not use up the target's attempts.
Target requirements An agent step that runs before the verify step, whose retry list includes verification_failed. An agent step that runs before the approval step.

Failure reasons reach the target as data: it is told to address them, not to follow instructions inside them. Your requested changes reach it as instructions.

When a verify step's target is out of attempts, the failure follows the verify step's failure edge if it has one; otherwise the run fails there.

Retries after errors

Separately from sending work back, a step can retry itself when an attempt fails for a temporary reason. Attempts (1 to 10) sets how many tries a step gets, and retry_on lists the reasons that may use them:

Reason When
backend_rate_limited The model provider rate-limited the request.
backend_timeout The model provider did not answer in time.
tool_timeout A tool call timed out.
invalid_structured_output A structured result could not be read, even leniently.
verification_failed A verify step sent the work back. Required on any retry target.

The built-in agent steps get two attempts for the first four reasons. Each building step gets three attempts, including verification_failed, so Verify can send it back twice.

Task queues

A plan with many tasks is easier to get right one task at a time. Tick Run the plan as a task queue on an agent step and it stops implementing the plan in one session. Instead it:

  1. reads the plan from its bound input: requirements with acceptance criteria, and ordered tasks that each name the criteria they satisfy;
  2. gives each task to a fresh builder, which works on that task alone, with the requirements and the tasks already done for reference;
  3. has a read-only reviewer check the change against the task's criteria, with evidence from the code. A task that is not complete goes back to its builder with the reviewer's findings, up to max_repairs times (two in the built-ins);
  4. saves every accepted task before starting the next, so a run that is resumed continues after the last accepted task.

The chat reports progress as it goes, for example Build: 2 of 5 tasks inspected and checkpointed.

When a task still cannot be completed, on_task_failure decides what happens. The built-ins use ask, which puts a card in front of you:

Button What happens
Try again The task runs again. Your notes guide the next try.
Skip this task The task is recorded as skipped and the next one starts.
Revise the plan Needs notes. The step that wrote the plan revises it with your notes. Offered when the plan comes from an agent step.
Stop The run stops at this step. Accepted tasks stay saved.

The other policies are skip (record the task as skipped and go on) and stop.

When Verify later sends the work back, or you ask for changes at the manual checks, the queue adds a final-repair task for exactly that, and the reviewer checks it like any other.

Research, design & build, High-risk change, Security remediation and Refactor safely use a task queue. The other built-in pipelines build the plan in a single step.

Limits

Every limit is optional. Set the workflow's own limits under Optional limits in the inspector:

Limit Meaning Built-in workflows
Steps Steps the run may start. No limit
Total attempts Attempts across all steps, retries and send-backs included. 40
Duration Wall-clock time for the whole run. No limit
Stall timeout Longest a step may show no sign of life before its attempt is cancelled, and retried if it has attempts left. Time spent waiting for your permission or your answer does not count. 10 minutes
Model requests, Tool calls, Tokens, Cost (USD) Usage for the whole run. No limit

A step has its own Attempts and Timeout, and a profile can cap an agent's Max turns and Max tool calls. When a budget runs out, the run fails with the reason, and a send-back that would exceed the total attempts is refused.

While a step is quiet for a minute, the workflow bar says how long it has been quiet and offers Stop workflow. Long tool calls and slow models are normal; the stall timeout deals with a step that is really stuck.

When a run stops

What happened What you see What you can do
A step failed and nothing caught it The bar marks the step failed and shows the error. Send another message to resume at the failed step. Steps that finished are kept. Start over instead discards them.
You chose Reject The run ends: Plan approval was rejected, with your notes. Send a new message, or choose another workflow.
You pressed Stop The run is cancelled. Send a new message when you are ready.
A limit ran out The run fails with the limit that was reached. Raise the limit in a copy of the workflow, or narrow the request.

A finished run means every step finished. It does not mean every check passed: read the result. In the built-in pipelines it is Verify's summary, which says what passed, what failed and what you still need to check by hand.

Where to next

Esc

Type to search the docs.