How It Works
The scenario simulator executes your workflow’s node graph, but instead of calling real activities, it uses your mocked events to produce node outputs. It follows the same edge routing, condition evaluation, and loop logic as the real executor.Scenario Structure
A scenario YAML file defines:Event Types
| Type | Fields | Description |
|---|---|---|
llm_response | text, tool_calls | Simulates an LLM returning a response |
tool_result | tool, output | Simulates a tool returning results |
tool_error | tool, error | Simulates a tool failing |
llm_error | error | Simulates an LLM API error |
user_input | user_text | Simulates user sending a message |
Event Fields
Targeting Nodes
By default, events are consumed sequentially — the first triggered node gets the first event, and so on. Use thenode field to target a specific node:
Inner Nodes (Loops and Sub-Workflows)
For workflows with inline loops or inline sub-workflows usingtype: workflow with inline:, you can target individual nodes inside them using dot-separated qualified IDs:
How inline simulation works
For inline loops with aninline: definition, the simulator:
- Creates a sub-state-machine for the inline workflow
- Executes each inner node individually per iteration
- Evaluates conditions on inner nodes and skips those with false conditions
- Evaluates edges within the loop to determine node ordering
- Calls the mocker with qualified IDs like
loop_id.inner_node_id - Evaluates the
whilecondition after each iteration - If the sub-workflow declares
outputs:, evaluates them for thewhilecondition
type: workflow and inline:, the simulator:
- Creates a sub-state-machine for the inline workflow
- Evaluates conditions on each inner node and tracks false conditions as skipped
- Executes inner nodes using qualified IDs like
workflow_id.inner_node_id - Evaluates the sub-workflow’s
outputs:expressions if declared
ref: to an external workflow, the simulator mocks the entire node as a black box using the ref name as the mock ID, since external workflows cannot be loaded in the simulator.
Expectations
Theexpect section defines assertions:
Partial Testing
Usestart_at and state to test from a specific point in the workflow:
Loop Testing Patterns
Single Iteration (Exit Immediately)
Multi-Iteration Loop
Provide events for each iteration. The simulator consumes events per-node sequentially:Testing Loop Output Routing
When a loop’s inline workflow declaresoutputs:, those evaluated outputs are available for downstream edge conditions:
Using Scenario Tools
In the workflow builder, use these tools to manage scenarios:| Tool | Usage |
|---|---|
list_scenarios | See all scenarios and their status |
view_scenario | Examine a scenario’s full YAML |
create_scenario | Create a new scenario and run it automatically |
edit_scenario | Make targeted edits to a scenario |
run_scenario | Re-run a scenario after workflow changes |