Skip to content

Simulate a workflow run without side effects

Simulation runs a compiled workflow step by step with fixed inputs, mocked action results, and a virtual clock. It uses the same runtime reducer as real runs, but it never calls a connector, worker, secret provider, or network. Use it to see which path a run takes, what each step produces, and how waits, signals, and human decisions behave, before you publish anything.

Who it is for. Process designers simulating in Studio, and authors and integrators who script simulations from the CLI or Python. What you need. A compiled artifact: follow workflow authoring, which creates .local/tutorial/compiled/compiled-artifact.json and .local/tutorial/simulation-request.json. The CLI needs only the base installation. Allow 15 minutes.

What simulation does not prove. A successful simulation does not show that workers are running, connections are ready, or external systems behave as your mocks claim. For a durable run with a database and history, use the local platform or the standalone tutorial.

Simulator commands distinguished by execution, signal queuing, and virtual time movement

Read the diagram as a control panel, not a sequence. Choose what you want to change: observe, take one step, continue, queue a signal, or move virtual time. Queuing a signal and moving time do not advance the graph by themselves; follow either with a step or continue. Virtual time and a server session's real-time expiry are independent. Open diagram at full size

Execute in Studio's new editor

In the new editor (on by default), Studio simulates on its own host, on this computer, instead of on the platform: Execute step, Execute previous steps and Execute workflow (see the Studio guide).

  • What it compiles against. What ships with Weave (the HTTP, email and file connectors, the AI action and the AI agent's turn action), the actions this workflow uses that Studio has (the ones it owns, before they are published), and, when connected, the project's catalog, read once with your session and kept for 30 seconds. Actions none of them has run on read-only stubs; decision tables are never stubbed. A definition on this computer with the same name and version as a different one in the catalog is refused.
  • What it uses as data, in order. For a step that calls something, its pinned output (for one iteration, then for the step), otherwise its last result. The test input, or a sample of the input fields. The test answers of signals and human tasks, and the saved turns of AI tasks and AI agents (see Simulate AI agents). Executing one step sends only the test data of the steps it runs, and a later step never stops it.
  • When it stops. A step with no data blocks with "Step ID needs test data."; a signal or a person without a test answer blocks with "Send signal name" or "Decide for ID"; an AI agent's review or question without a test answer under its own instance key blocks with the task's title, such as "Review cancel_order for support"; a step the test data doesn't reach says which path was taken; a deadline that passes fails the run at that step. Waits advance by themselves.
  • Secrets. Test input, step mocks (in this workflow and in called workflows), AI agent tool mocks, the arguments of saved tool calls, signal payloads and decisions are checked against their schemas before anything runs; a value marked secret is refused with its location only, and never appears in an answer.
  • Step-through sessions. With breakpoints, the host keeps a session in memory that the run log steps through with Next and Continue. A session's answers are checked the same way.
  • Limits. One execution at a time, 30 seconds each; at most 4 sessions, each up to 16 MiB and closed after 30 minutes without use. Sessions end when you sign in, switch or sign out.
  • What reaches the platform. Only the catalog read. Executing never starts a run or an activation, never publishes, and needs no simulate permission.

Simulate in Studio

In the classic designer (with Use the new editor off), in Studio, select Simulate on a workflow. Studio needs a connected platform and an account with permission to simulate (the developer role grants it), because it creates a real debug session on the platform (see Server sessions).

  1. In Simulate this workflow, enter the run input under Workflow input. When the workflow calls actions, enter under Action results the result each action should return (its mock). Select Skip this action to leave an action without a result; the simulation stops when it reaches it.
  2. Select Start simulation. The Simulation panel opens beside the canvas, in the inspector's place, and shows the status, the simulated time, and the current steps after Now at. The canvas highlights the current step, draws the path taken in color, marks finished steps with a check, and dims steps not reached. Editing is paused until you select Stop simulation.
  3. Use Step and Continue to move on. To stop at chosen steps, open Breakpoints and check them; Continue pauses before each one. When the run waits, the panel's main button matches the wait: Submit decision for a human task, the send button under Send a signal, or a duration under Advance time.
  4. Read Step results, Workflow output, and Activity. Start over returns to the setup.

Simulate is unavailable until Studio is connected to a platform and your account may simulate in the workspace; select it and Studio says why under the toolbar.

This panel is new in 0.1.0a7; an alpha6 or earlier Studio does not have it. The Studio guide describes the panel; the rest of this page explains the commands it sends and how to run them yourself.

Run the echo artifact from the CLI

  1. Simulate to the end. The request file holds the exact compiled artifact, the mocks, the input, and a timezone-aware starting time now:

    # Run the echo artifact until it finishes; nothing outside this process is called.
    weave workflow simulate .local/tutorial/simulation-request.json
    

    Expected: Simulation succeeded; 1 accepted facts; 4 boundaries. and exit code 0. Without a command file, the CLI continues until a breakpoint, a wait, a suspension, or the end.

  2. Pause, step, and continue. A breakpoint pauses before a named node so you can inspect its input and the current variables. Save this as .local/tutorial/commands.json:

    [
      {"kind": "breakpoints", "node_ids": ["echo"]},
      {"kind": "continue"},
      {"kind": "next"},
      {"kind": "continue"}
    ]
    
    # Apply the commands in order within one invocation and print the final view as JSON.
    weave workflow simulate .local/tutorial/simulation-request.json \
      --commands .local/tutorial/commands.json --output json
    

    Expected: "status": "succeeded" and "output": {"message": "Hello, Weave"} inside variables. The first continue pauses before echo, next executes it, and the last continue runs to the end.

  3. Try a failure. Change input.message in the request to a number and run step 1 again. Expected: exit code 1 and WV-DEBUG-REQUEST: Invalid or over-budget simulation request., because the input violates inputSchema. Restore the string afterward.

With a command file, the CLI applies only your commands; it does not continue on its own first. It exits 1 when the request is invalid or over budget, or when the final status is failed, suspended, or timed_out.

Mock actions, send signals, decide tasks, and move time

A mock is the fixed result an action returns instead of running. The onboarding example from workflow authoring calls an action, then waits for a customer-approved signal for up to one day.

  1. Compile it from the repository root:

    # Compile the onboarding workflow against its teaching catalog and export the artifact.
    weave workflow compile examples/definitions/customer-onboarding.workflow.yaml \
      --catalog tests/fixtures/catalog/onboarding.lock.json --strict \
      --directory .local/onboarding --output json
    

    Expected: ok: true and .local/onboarding/compiled-artifact.json.

  2. Create the request with Python 3.12 or later. Save this as .local/make-onboarding-simulation.py and run it with python3 .local/make-onboarding-simulation.py:

    import json
    from pathlib import Path
    
    request = {
        "artifact": json.loads(Path(".local/onboarding/compiled-artifact.json").read_text()),
        "mocks": {"action:onboarding.check-customer@1.0.0": {"eligible": True}},
        "input": {"customerId": "demo"},
        "now": "2026-01-01T00:00:00Z",
    }
    Path(".local/onboarding-request.json").write_text(json.dumps(request))
    Path(".local/onboarding-approve.json").write_text(json.dumps([
        {"kind": "continue"},
        {"kind": "signal", "name": "customer-approved", "payload": {"approved": True}},
        {"kind": "continue"},
    ]))
    
  3. Stop at the wait. Without commands, the simulation continues until the signal step waits:

    # Continue until the run waits for the customer-approved signal.
    weave workflow simulate .local/onboarding-request.json --output json
    

    Expected: "status": "waiting" with "active_nodes": ["approval"]. A wait is not a failure.

  4. Send the signal, then continue:

    # Queue the approval at virtual now, then let the run consume it.
    weave workflow simulate .local/onboarding-request.json \
      --commands .local/onboarding-approve.json --output json
    

    Expected: "status": "succeeded" and "output": {"accepted": true}.

  5. See a timeout. Replace the signal command with {"kind": "advance_time", "seconds": 86400} and run step 4 again. Expected: "status": "timed_out" and a timed_out event, because the signal did not arrive strictly before its one-day deadline.

You explored the declared contract without installing the action's implementation.

Command reference

Command Fields Effect
breakpoints node_ids: complete node IDs or instance keys Replace the breakpoint set; use IDs from weave workflow explain, including synthetic ones such as @join:ID. Inside a loop, a step ID stops every iteration and an instance key such as send[2] stops one. Inside a called workflow, prefix the call: notify/record (see Simulate workflow calls)
next — Process one boundary: one admitted event or one node, in the most deeply called workflow that has work
continue — Run until a breakpoint, a wait, a suspension, the end, or the command's work ceiling, through called workflows too
step_out frame (optional) Run until the called workflow returns its outcome to its caller; breakpoints still stop on the way. Without frame, the called workflow of the next boundary
signal name, payload, frame (optional) Validate the payload against the signal's schema and queue it at virtual now, in the called workflow frame names
human_decision name: the human task step ID, or an AI agent's review or question key such as support#1.1.review; payload: {"decision": ..., "data": {...}}; frame (optional) Validate the decision and form data, then queue the completion
advance_time seconds: whole number, zero or more Move virtual time forward
resolve incident_key; resolution: retry_safe, accept_reconciled_result, accept_reconciled_failure, or terminate; payload (with accept_reconciled_result only); frame (optional) Apply a person's resolution of a transaction in doubt (see Simulate transactions)
cancel skip_undo (optional) Queue a cancel of the simulated run; its open transactions are undone first

signal, human_decision, advance_time, and cancel return the current view without advancing the graph. Follow them with next or continue. The CLI's --help lists every command except human_decision, which works the same way.

Mock keys. Use action:EXACT_REFERENCE, such as action:onboarding.check-customer@1.0.0, for every call to that action, or node:NODE_ID for one action node. Inside a loop, node:NODE_ID answers every iteration of the step, and node:INSTANCE_KEY, such as node:send[2], answers one iteration (see Simulate loops). The most specific key wins: node:INSTANCE_KEY, then node:NODE_ID, then action:EXACT_REFERENCE. Unknown keys and results that violate the pinned action or implementation output schema are rejected before the simulation starts. A JSON list is one ordinary result. There is no scripting of retry outcomes and no live fallback: an action without a mock stops the simulation with WV-DEBUG-MISSING_MOCK, whose hint lists the keys that would answer it.

Calls to other workflows. A simulation never starts a real run of another workflow. A waiting Call a workflow step takes a node: mock for its whole result, or runs the called workflow inside the simulation when the request carries its artifact; see Simulate workflow calls.

Read the debugger view

Every command returns a view:

Field How to use it
status queued, running, paused (at a breakpoint), waiting, succeeded, failed, suspended, cancelled, or timed_out
selected_node The next ready node, or null when none is ready
active_nodes Outstanding waits and tasks
current_nodes selected_node and active_nodes together
variables Current run data: input, step outputs under steps, and the final output
diagnostics Debugger errors, such as a missing mock
events Accepted facts, such as started, task_completed, or signal_received
boundary, boundaries The last boundary processed, and all of them in order
now Virtual time; waiting in your shell does not change it
loops Workflows with loops only: one entry per loop instance (see Simulate loops)
selected_scope Inside a loop body only: the item, index and loops values the selected step reads
frames Workflows whose calls ran in the simulation only: one entry per call (see Simulate workflow calls)
selected_frame Only while the next boundary belongs to a called workflow: that call's frame key
transactions Workflows with transactions only: each transaction's state, cause, incident_key, and steps, without values; each frame carries its own (see Simulate transactions)

Node IDs in selected_node, active_nodes, current_nodes, boundaries and events are instance keys: the step ID outside loops, send[2] for iteration 2 of send. To continue from a wait, send the expected signal or decision, or advance virtual time, then continue. An unknown breakpoint ID is rejected.

Simulate loops

A Loop over items (forEach) step runs its body once per element. A simulation runs it exactly as a real run does: each iteration's steps have their own instance keys (send[0], send[1]), at most concurrency iterations run at a time, and the results are collected in element order.

  • Mocks per iteration. node:send answers every iteration of send; node:send[1] answers iteration 1 only and wins over node:send and over action: mocks. A key must give one position per enclosing loop, each below that loop's maxItems: node:send[1][0] for a step in one loop, or node:send[10] in a loop with maxItems: 10, is rejected with WV-DEBUG-MOCK-KEY.
  • Breakpoints per iteration. A breakpoint on send stops before every iteration of send; a breakpoint on send[1] stops before iteration 1 only. The same position rules apply (WV-DEBUG-BREAKPOINT).
  • Loop progress. loops lists every loop instance in definition order, an outer loop before the loops in its body:

    Field Meaning
    node_id The loop's step ID
    instance_key The loop's instance key inside an outer loop (cells[1]), or ""
    count Elements in this run of the loop
    completed Iterations whose results are collected
    running Iterations started and not yet collected
    next_index The position of the next iteration to start
    status running, joined (all results collected), or terminated

    An inner loop's entry disappears when its outer iteration finishes. - The item in scope. When the selected step is inside a loop body, selected_scope holds what its expressions read: item and index of the innermost loop, and loops with {item, index} for every enclosing loop by its step ID.

For example, this request mocks every iteration of send with 7 and the second one with 70, and the commands stop before the second iteration:

{"mocks": {"node:send": 7, "node:send[1]": 70},
 "commands": [{"kind": "breakpoints", "node_ids": ["send[1]"]}, {"kind": "continue"}]}

The view then shows "selected_node": "send[1]", "selected_scope": {"item": 20, "index": 1, "loops": {"each": {"item": 20, "index": 1}}} for the input [10, 20, 30], and a loops entry with "completed": 1. In text output, the CLI prints one line per loop, such as Loop each: 1 of 3 items finished, 1 running.

Simulate workflow calls

A waiting Call a workflow step (mode: wait, the default) needs the called workflow's result. A simulation gets it in one of two ways, and the first one that applies wins:

  1. A mock for the whole call. node:CALL_ID answers every run of the call, and node:INSTANCE_KEY, such as node:notify[2], one iteration inside a loop. Under onFailure: stop (the default) the mock is the called workflow's output; under onFailure: continue it is the whole envelope the step returns, such as {"status": "failed", "runId": "...", "error": {"code": "NO_CUSTOMER", "message": "Unknown customer."}}. A success carries output and any other status carries error. action: keys never answer a call.
  2. The called workflow itself. When the request's workflows gives the compiled artifact of the version the call names, the simulation runs that workflow in a frame: a simulated run with the call's input, its own mocks, signals and deadlines, and the session's virtual time. Its outcome reaches the caller as in a real run: the output, or the envelope; a failed run fails a caller that stops, and a cancelled or timed-out one opens WV-CALL-INTERRUPTED on it. A succeeded output is checked against the call's output schema first, as on a platform: a secret or unclassifiable value opens WV-SCHEMA-SECRET_VALUE or WV-SCHEMA-CLASSIFICATION on the caller instead. Sessions hold no files, so the platform's step of handing the child's files to its caller is skipped.

Without either, the simulation stops with WV-DEBUG-MISSING_MOCK, whose hint names both. A detached call (mode: detach) never needs a mock: it continues at once with null, and its frame runs when the artifact is given, even after the caller finished; otherwise the call is listed with status not_simulated. A caller that ends cancels the frames it waits for, and theirs.

The request. workflows maps each called version to its artifact and the mocks used inside it. In this sketch, send-receipt@1.0.0 stands for a called workflow whose send-mail step runs an action:

{"workflows": {"send-receipt@1.0.0": {"artifact": {"executable": "..."}, "mocks": {"node:send-mail": {"id": "m-9"}}}}}

Each artifact must be the version the call names, with the input and output schemas the calling workflow was compiled against, and each entry must be a version some call reaches (WV-DEBUG-WORKFLOW). Mocks inside a frame use the same keys as top-level mocks, and apply to every run of that version. On a platform, "resolve_workflows": true loads the published version of every called workflow the request gives no artifact for, following the calls of supplied and published versions alike; each must be the definition its caller was compiled against. It needs the catalog.read capability as well as simulate. From the CLI, pass each artifact with --workflow REF=ARTIFACT.json.

Stepping in and out. Frames have keys: the call's instance key, joined with / through nested calls (notify, notify[2], notify/audit). next takes one boundary in the most deeply called workflow that has work, so stepping past a call steps into it. A breakpoint notify/record stops before record in every run of the call notify, and notify[2]/record in one. step_out continues until the called workflow's outcome reaches its caller, then stops before the caller's next step.

For example, this compiles the two workflows under examples/language/ and simulates order-intake, whose notify call waits and whose audit call is detached. Save it as .local/make-call-simulation.py and run it from a source checkout with uv run python .local/make-call-simulation.py:

import json
from pathlib import Path

import yaml

from firefly_weave.compiler.api import compile_source
from firefly_weave.compiler.catalog import CatalogSnapshot
from firefly_weave.contracts.definitions import load_definition

examples = Path("examples/language")
called = (examples / "notify-customer.workflow.yaml").read_text()
calling = (examples / "order-intake.workflow.yaml").read_text()
catalog = CatalogSnapshot.from_definitions([load_definition(yaml.safe_load(called))])
notify = compile_source(called, format="yaml", catalog=CatalogSnapshot.empty()).artifact
orders = compile_source(calling, format="yaml", catalog=catalog).artifact
folder = Path(".local/calls")
folder.mkdir(parents=True, exist_ok=True)
(folder / "notify-customer.json").write_bytes(notify.to_bytes())
request = {
    "artifact": json.loads(orders.to_bytes()),
    "input": {"customerId": "c-1", "orderId": "o-7", "tags": ["new", "web"]},
    "now": "2026-01-01T00:00:00Z",
}
(folder / "request.json").write_text(json.dumps(request))
(folder / "step-in.json").write_text(
    json.dumps([{"kind": "breakpoints", "node_ids": ["notify/record"]}, {"kind": "continue"}])
)
# Run both calls inside the simulation.
weave workflow simulate .local/calls/request.json \
  --workflow notify-customer@1.0.0=.local/calls/notify-customer.json

Expected: exit code 0 and

Simulation succeeded; 2 accepted facts; 14 boundaries.
Called workflow notify (notify-customer@1.0.0): succeeded.
Called workflow audit (notify-customer@1.0.0): succeeded.

boundaries counts the boundaries of every frame; accepted facts counts the calling workflow's own events. Without --workflow, the command exits 1 with WV-DEBUG-MISSING_MOCK at notify. With --commands .local/calls/step-in.json, it stops inside the called workflow and prints Ready: notify/record; adding {"kind": "step_out"} to the commands returns to order-intake with steps.notify.output set to {"status": "succeeded", "runId": "59475034-e4de-5a95-9d2e-23035f9fa906", "output": {"customerId": "c-1", "delivered": true}}. A frame's runId is fixed by its key, so it is the same in every simulation.

The view. Top-level fields keep describing the simulated workflow. The caller's events include a call_completed event for each outcome a call received, and frames lists each call that ran, in the order the calls started:

Field Meaning
key The frame key, such as notify or notify[2]/audit
workflow The called version, such as notify-customer@1.0.0
call_node The call's instance key in its caller
mode wait or detach
run_id The simulated run's ID, which the envelope's runId repeats; omitted when not simulated
status The simulated run's status, or not_simulated
selected_node The next node to reduce in this frame, or null
active_nodes The frame's outstanding waits and tasks
variables The frame's run data: its input, step outputs, and output
loops The frame's loop instances, as for the simulated workflow

Boundaries inside a called workflow carry frame. In text output, the CLI prints one line per frame, such as Called workflow notify (notify-customer@1.0.0): succeeded., and exits 1 when a called workflow its caller waits for is suspended, because that caller would wait forever. A suspended detached call does not fail the command.

Make steps fail on purpose

errors sits next to mocks in a session request and uses the same keys: node:<step> for every instance, node:<instance key> for one, and action:<reference> for every step that uses the action. Each entry is {"code": "RATE_LIMITED", "outcome": "failed", "attempts": 1}; outcome and attempts are optional. One lookup decides each step, in this order: the instance key, the step, the action. The first key found in either mocks or errors wins, and a key in both is refused (WV-DEBUG-MOCK-CONFLICT).

  • A step with an On error setting handles the failure as a platform run would: its error path runs, or it continues with null.
  • A step without the setting stops behind the incident recovery would open: WV-TASK-RETRIES-EXHAUSTED for an action that is safe to repeat, WV-TASK-AMBIGUOUS for one that is not. An unknown outcome of an action that changes data and is never retried stops the session too, whatever its setting.
  • A transform or decision table with a setting fails without being evaluated.
  • Signals and human tasks with a setting fail when they start waiting; moving time past their timeout fails them too, as on a platform.

For steps in a transaction, see Simulate transactions. Scripted failures apply to the simulated workflow itself, not inside called workflows. With the local simulation, repeat --error KEY=CODE:

weave workflow simulate request.json --error 'node:send[2]=RATE_LIMITED' --output json

Simulate transactions

A simulation runs a workflow's transactions as a platform run does: the same rules decide when a step is confirmed, cancelled, or undone, and when a transaction is in doubt. Nothing outside the session changes. For what transactions are, see the transactions guide.

Answer each confirm, cancel, and undo. A step that takes part in a transaction can have a confirm, a cancel, or an undo. Each one has its own keys, never its step's: node:add answers add, not add#undo.

Key Answers
node:add[2]#undo That phase of one loop iteration
node:hold#confirm, node:hold#cancel, node:add#undo That phase of every instance of the step
action:EXACT_REFERENCE Every step and phase that uses the action

The first key in the table that holds a mock, a failure, or a pending entry wins. A phase without one completes with an empty result, {}, when its output schema accepts it; otherwise the session stops with WV-DEBUG-MISSING_MOCK, and the hint lists the phase's keys. An undo by a called workflow runs that workflow in the simulation when workflows carries its artifact. A mock for it is the called workflow's plain output, checked against its output schema. A breakpoint can't name a phase: a phase is a result, not a step.

Script failures with their effect. A scripted failure of a step in a transaction can say whether the step may have applied anything: effect is none or unknown. Without it, the session uses none when outcome is not_started or the action lists the code in definiteFailures, and unknown otherwise. effect: none with outcome: unknown is refused (WV-DEBUG-MOCK-OUTPUT). A step that failed with effect: none is skipped; one with unknown is undone with the others, in reverse order. A scripted failure of a confirm, cancel, or undo makes it stuck, so the transaction is in doubt; attempts sets the incident's key, such as add#undo:10.

{
  "errors": {
    "node:add": {"code": "UNAVAILABLE", "effect": "unknown"},
    "node:add#undo": {"code": "UNAVAILABLE", "attempts": 10}
  }
}

Leave results pending. pending lists keys whose result never arrives in the session, keyed like mocks: at most 1,000, each once. In the CLI, repeat --pending KEY. Move time to see what a platform does when a result doesn't come:

  • a rollback waits for a pending step until its settle deadline, then the transaction is in doubt with WV-TXN-SETTLE-TIMEOUT;
  • a transaction whose step that can't be undone is pending stays deciding, and a cancel or a failure waits for that step;
  • a reservation's hold runs out while the body waits, such as at a wait step, and the transaction is cancelled. With a step still pending, the rollback waits for it, as in the first point.

Resolve a transaction in doubt. The resolve command applies a person's resolution. It changes only the session: it needs the session's own access, not the permissions to resolve a real incident, and no run or incident of the project changes. Use incident_key as the view's transactions shows it, put the reconciliation record or the output in payload, and name a called workflow's frame with frame.

Incident code retry_safe accept_reconciled_result accept_reconciled_failure terminate
WV-TXN-UNDO-STUCK, WV-TXN-CANCEL-STUCK, WV-TXN-CONFIRM-STUCK, WV-TXN-AFTER-PIVOT-STUCK Retry Mark as reconciled: payload is the record, such as {"as": "compensated", "participants": [{"instance_key": "add", "outcome": "undone"}]} — Force end
WV-TXN-SETTLE-TIMEOUT Wait again under a new deadline Mark as reconciled — Force end
WV-TXN-PIVOT-UNKNOWN — It happened: payload is the step's output It didn't happen Force end

A retried attempt skips its scripted failure and takes the next key that holds a mock, or the empty result of a phase. A transform or decision table after the point of no return fails again when retried; mark it as reconciled to see the transaction end well. The session checks every record and output as a platform does: a resolution it refuses changes nothing and answers WV-DEBUG-INCIDENT. The steps a resolution releases run on the next next or continue.

[
  {"kind": "continue"},
  {"kind": "resolve", "incident_key": "add#undo:10", "resolution": "retry_safe"},
  {"kind": "continue"}
]

Cancel a simulated run. The cancel command cancels the simulated run as a person's cancel does: its open transactions are undone first, or force ended with "skip_undo": true. Follow it with next or continue.

What a simulation can't show. A platform's own retries of a confirm, cancel, or undo before it is stuck; a result that arrives after its deadline; a step a rollback revokes before a worker takes it, because a session treats every dispatched step as taken (script "outcome": "not_started" to see it skipped); and a called step that can't be undone and never started.

Simulate AI agents

An AI agent step runs in a simulation without a model and without its tools: saved turns stand for the model, and mocks stand for each tool. Nothing leaves the simulation, and the agent's output reports no model usage.

Saved turns. An agent: mock holds one entry in the saved AI turns format: turns, each either toolCalls (a name and arguments per call) or a final answer, with an optional text. Each turn of an activation replays the entry's turn at the same position. The simulator fills in what a model would: the profile's provider and model, no usage, and the kernel's call IDs. In Studio, the aiTurns test data become these mocks.

{
  "agent:support": {
    "turns": [
      {"toolCalls": [{"name": "lookup_order", "arguments": {"id": "A-17"}}]},
      {"final": "Order A-17 has shipped."}
    ]
  },
  "tool:support/lookup_order": {"status": "shipped"}
}

Tool mocks. A tool:AGENT/TOOL mock is the result of every call to that tool: what an Action returns, what a called workflow returns, or a person's answer to a question. {"sequence": [...]} gives one value per call, in the order the calls run. A call that finds the sequence used up stops the simulation with WV-DEBUG-MISSING_MOCK.

Conversation seeds. An agent with conversation memory asks for its conversation before its first turn. The simulator answers with the memory of the agent's saved turns: up to 200 {"role": "user" | "assistant", "content": …} messages, at most 256 KiB, checked when the session starts (WV-DEBUG-MOCK-OUTPUT). The instance key's entry wins over the step's, and without a seed the conversation starts empty. The simulator never reads a stored conversation, and an agent's completed exchange changes nothing in the session, so a second agent with the same key needs its own seed. An entry may hold only a seed ("turns": []) when a pin answers the agent's turns.

{
  "agent:support": {
    "turns": [{"final": "You asked about order A-17."}],
    "memory": [
      {"role": "user", "content": "What is the status of order A-17?"},
      {"role": "assistant", "content": "A-17 has shipped."}
    ]
  }
}

Which key answers. AGENT is the agent's step ID (every activation) or an instance key such as support[2] (one activation inside a loop). The most specific key wins:

What runs Keys, most specific first
A turn node:INSTANCE_KEY, node:STEP_ID (the agent's pinned output), agent:INSTANCE_KEY, agent:STEP_ID
A tool call node:CALL_KEY (one call, such as node:support#1.1), tool:INSTANCE_KEY/TOOL, tool:STEP_ID/TOOL, action:EXACT_REFERENCE for a tool that runs an Action

A pinned output answers the agent's first turn with its result and text, so no tool runs and the saved turns are never read; the output's usage reports what the simulation used, which is nothing. A Call a workflow tool without a mock runs the called workflow inside the simulation when the request carries its artifact, as a call step does.

Checks before anything runs. Saved turns may call only the agent's tools, with arguments that fit each tool's parameters, and every turn must pass the agent's turn checks. A tool mock must fit every schema a live run checks the tool's result with: what the tool returns and, for a tool that runs an Action, the Action's output and its connector action's or worker task's. A mock of one call must fit one of the agent's tools, and it's checked for secrets by every schema of every tool, whether it fits that tool or not, because the saved turns decide which tool the call runs: a value any of them marks secret is refused. So when one of the agent's tools marks its whole result secret, mock the other tools by their tool: keys rather than by call. Anything else is refused with WV-DEBUG-MOCK-OUTPUT. A key that names no agent, no tool of it, a turn, a review, or a call the agent can't make (past its maxIterations, or past 16 calls in a turn) is refused with WV-DEBUG-MOCK-KEY. An agent with no saved turns, or saved turns that end before the agent does, stops the simulation with WV-DEBUG-MISSING_MOCK on that turn, such as support#2, and the hint names the agent's node: and agent: keys.

Reviews and questions. A call that needs a review waits at its review key, such as support#1.1.review, and a question to a person waits at its call key, until human_decision answers it. A review takes approve or reject with {"comment": ...} or {} as data; the approval runs the input the review showed, which the simulation copies from the review, never from the answer. A rejection is a result the model reads. Set "autoApprove": true in the saved turns to approve every review at once; a question with a tool mock is answered by the mock.

Failures and results that never arrive. Scripted failures (errors) and results that never arrive (pending) can't name an agent's turn or call by its own key. Under action:EXACT_REFERENCE they reach every call of a tool that runs that action, as they reach its steps: a failure is a result the model reads (or fails the agent, with onToolError: incident), and a pending call keeps the agent waiting.

Not simulated yet. An entry's memory isn't read: a simulated agent starts with the memory its run holds.

Only simulations read these mocks. Saved turns, tool mocks and autoApprove belong to debug sessions and to Studio's Execute. A live run never reads them: its turns go to the model and its reviews to people, whatever the workflow's test data holds.

Use the Python library

Embedders use the Simulator class. Run this from a source checkout with uv run python, after creating the echo artifact:

from datetime import UTC, datetime
from pathlib import Path
from firefly_weave.compiler.api import import_artifact
from firefly_weave.operations.debug.simulator import Simulator

artifact = import_artifact(
    Path(".local/tutorial/compiled/compiled-artifact.json").read_bytes()
)
sim = Simulator(artifact, mocks={}, input={"message": "Hello, Weave"},
                now=datetime(2026, 1, 1, tzinfo=UTC))
sim.set_breakpoints({"echo"})
paused = sim.continue_until_breakpoint()
assert paused.status == "paused" and paused.selected_node == "echo"
stepped = sim.next()
saved = sim.serialize()
sim = Simulator.restore(saved)
finished = sim.continue_until_breakpoint()
assert finished.status == "succeeded"
print(finished.variables["output"])

Expected: {'message': 'Hello, Weave'}. serialize() and restore() preserve progress and virtual time; restoring starts no worker and changes no real run.

The methods are inspect, set_breakpoints, next, continue_until_breakpoint, signal, human_decision, advance_time, command (one command object), serialize, and restore. Creating a simulator and inspecting it execute no nodes. Signal and decision data is validated before it is queued.

Server sessions

A debug session is a simulation stored on the platform, so Studio and other clients can drive it across requests. Routes are project-scoped under /api/v1/tenants/{tenant}/projects/{project}:

Request Body Result
POST /debug/sessions The same {artifact, mocks, input, now} request, with optional workflows and resolve_workflows {id, revision, created_at, expires_at, view}, starting at revision 1
GET /debug/sessions/{id} — The current session
POST /debug/sessions/{id}/commands One command from the table above The next revision; requires If-Match with the current revision, for example "1"

From the CLI, the typed commands are weave runs debug create --request FILE, weave runs debug read ID, and weave runs debug command ID --revision N --request FILE. They use your saved platform and workspace; see how remote commands choose a platform. Saved platforms are new in 0.1.0a7; with an alpha6 or earlier CLI, these commands use explicit mode only.

Who may use a session. Only its creator, with a current project simulate capability (the developer role). No environment, activation, connection grant, or worker release is needed. Each command locks the session, reloads current grants, checks expiry by database time and the revision, then commits exactly one new revision.

Rule Value
Lifetime One hour from creation; virtual time and reads never extend it
Live sessions At most 4 per creator and 16 per project; 1,000 retained per project
Stale revision HTTP 409 WV-DEBUG-REVISION
Expired session HTTP 410 WV-DEBUG-EXPIRED
Session size 64 MiB serialized

A new process restores the stored session; the server keeps no in-memory simulator. The exact source envelope and source map are pinned, and filenames are labels, never server file access. Expired sessions are retained until an operator removes them with retention; nothing purges them automatically.

How execution advances

  • Boundaries. Each next either admits one simulated event or reduces one node. Start, end, branch-output, and join nodes are visible boundaries too. Admitting an event increases the accepted sequence once; nodes never create extra receipts.
  • Actions. Reducing an action node prepares an isolated task. The mocked completion is a later event, released only after that event's node queue has drained.
  • Breakpoints use complete node IDs, including synthetic ones, or instance keys, and stop before effects. Continuing from a breakpoint consumes that stop once.
  • What is saved. Ordered ready queues, event IDs, virtual timestamps, and boundary history survive serialization. Server IDs and wall-clock metadata are outside the comparable view.
  • Rollback. If evaluation fails or an output is classified, every partial node change and command from that event is rolled back, while the prepared overall deadline is kept. Real runs drain this same reducer atomically; there is no second implementation of mapping or control flow.
  • Time order. When several deadlines are due, the overall timeout wins, then signal timeouts, then duration waits ordered by due time and node ID. A signal must be accepted strictly before its deadline; at the deadline it is too late. Duration waits never wake early.
  • Suspension. A suspension keeps the same deferred-event barrier as real runs. Kernel incidents leave the session suspended; a missing mock is a debugger failure and never creates a real worker incident.

Limits

These operator-owned defaults (DebugLimits) apply to the CLI, the library, and server sessions:

Limit Default
Node reductions 10,000
Simulated events 10,000
Commands 10,000
Pending signals 1,000
Boundaries per continue 10,000
Total virtual time 366 days
Depth of called workflows 8
Serialized session (artifact, mocks, state, queues, histories) 64 MiB

Source, compiler, and payload limits still apply. Authors cannot change these limits through the workflow or a request; local embedding can pass its own DebugLimits.

Frames share these limits with the simulated workflow: their boundaries, events, signals and data count toward the same totals. A call deeper than the depth limit refuses the command whole with WV-DEBUG-LIMIT.

Every command ends with a full check of these limits. While continue runs, the serialized size is checked every 64 boundaries, or sooner once 1 MiB of new step output and accepted facts has accumulated, so long loops simulate in time proportional to their length. A command over a limit is refused as a whole and keeps its starting state.

Simulation can need more room than a real run. A valid workflow can exceed the session budget: in a measured case, 80 transforms copying a 900,002-byte input reached 65,767,814 serialized bytes after 37 boundaries, and the next command was rejected by the 67,108,864-byte ceiling. WV-DEBUG-LIMIT is a debugger capacity error, not a sign that the workflow is invalid. A rejected command keeps its starting state and server revision; continue that reaches its work ceiling returns its progress so another command can resume.

Secrets. Secret-marked values are rejected at the same admission points as in real runs; no masked value is executed. Unmarked data remains the author's to classify and the operator's to protect. Errors never include rejected payloads or fingerprints.

Next steps

Troubleshooting

What you see Why What to do
WV-DEBUG-REQUEST from the CLI The request file is not valid JSON, misses a field, or its input or mocks violate a schema Check artifact, mocks, input, and a now with a time zone
WV-DEBUG-COMMAND The command file is not a JSON array, or a command lacks the field its kind needs, such as a signal without name, or carries one it doesn't take: a payload on a resolve other than accept_reconciled_result, skip_undo on a command other than cancel, or frame on a cancel Check each command against the command reference
WV-DEBUG-MISSING_MOCK, status failed An action has no mock (in Studio, Skip this action was selected) Add a mock under one of the keys in the diagnostic's hint
WV-DEBUG-MISSING_MOCK at a Call a workflow step The step waits for another workflow, and the request has neither a mock for the call nor the called workflow's artifact Add a node: mock for the call, or the artifact under workflows (--workflow in the CLI); see Simulate workflow calls
WV-DEBUG-MISSING_MOCK at an AI agent's turn or call The saved turns end before the agent does, or a tool's mock sequence is used up Add a turn under the agent: key, a value to the sequence, or pin the agent's output; see Simulate AI agents
WV-DEBUG-MISSING_MOCK at a confirm, cancel, or undo The phase has no mock, and its output needs fields Add a mock under one of the hint's keys, such as node:add#undo; see Simulate transactions
WV-DEBUG-MOCK-KEY A mock key names no action node or waiting call in this artifact, or no iteration of it (detached calls and action: keys for calls take no mocks); a phase key names a confirm, cancel, or undo its step doesn't have; or an effect is set on a key that names no step of a transaction Use action:EXACT_REFERENCE, node:NODE_ID or node:INSTANCE_KEY with one position per enclosing loop, below its maxItems, and #confirm, #cancel, or #undo only for a phase the step declares
WV-DEBUG-WORKFLOW A workflows entry is not a version any call reaches, has no artifact, or its artifact is another version or has other input or output schemas; resolve_workflows reached a version this project never published, or one whose published definition differs from the one its caller was compiled against; resolve_workflows was set in a request to the CLI, which has no published versions; or a stored session has a frame of a version it does not carry Compile the exact version the call names; on a platform, publish it or pass its artifact; from the CLI, pass --workflow
WV-DEBUG-FRAME step_out, signal or human_decision named a frame that does not exist or is not simulated, or step_out had no called workflow to leave Use a key from frames
WV-IR-UNSUPPORTED (HTTP 422 on a server) The workflow uses a language feature this version does not run; a server names it in result.missing_features, and weave workflow simulate in its message (Missing language features: flow.forEach.) Upgrade the platform or CLI, or simulate on one that runs the feature
WV-DEBUG-MOCK-OUTPUT The mock does not match the action's output schema; or an AI agent's saved turns call a tool it doesn't declare, with arguments that don't fit, or break the saved turns format; or a tool mock doesn't fit what the tool returns Fix the mocked result or the saved turns; see Simulate AI agents
Status waiting The run waits for time, a signal, or a person Send the signal or decision, or advance time, then continue
WV-DEBUG-SIGNAL No step waits for a signal with that name Use the name declared on the Wait for signal step
WV-DEBUG-HUMAN-TASK That human task is not waiting for a decision now Continue until it is active, and use its step ID as name
WV-DEBUG-STATE The simulated run already finished, or the session ended with a diagnostic Start a new simulation
WV-DEBUG-INCIDENT A resolve named no open incident of a transaction in doubt in that run or frame, a resolution its code doesn't take, or a record or output the session refused; or another run was in the middle of an event Use incident_key from transactions and a resolution from the table in Simulate transactions, or continue first
WV-DEBUG-BREAKPOINT A breakpoint names a node that does not exist, or no iteration of it, or a path through a step that is not a call or a call whose workflow the session does not have Use complete IDs from weave workflow explain, or instance keys with one position per enclosing loop, prefixed with the frame keys of the calls
WV-DEBUG-TIME advance_time was negative or not a whole number Use whole seconds, zero or more
WV-DEBUG-LIMIT A simulation limit was reached Use a smaller input, or advance time in smaller amounts
HTTP 409 WV-DEBUG-REVISION The session changed in another window or request Read it again and send the current revision
HTTP 410 WV-DEBUG-EXPIRED The session is older than one hour Start a new session
HTTP 429 WV-OPERATION-CAPACITY when creating a session You already have 4 live sessions, the project has 16, or the project retains 1,000 sessions, expired ones included Wait until a live session expires, at most one hour after it was created; at the 1,000 limit, ask an operator to remove expired sessions with retention