Skip to main content
Scenarios define test cases for workflows. They provide simulated events (mocking LLM and tool interactions) and expectations (assertions about what should happen).

Scenario

Scenario defines a complete test case for a workflow. A scenario provides simulated events that mock external interactions (LLM calls, tool executions) and expectations that verify the workflow behaves correctly. Example - Basic LLM response test:
Example - Agent loop with multiple iterations:
Example - Partial testing with state:

Fields


SimulatedEvent

SimulatedEvent represents a single mocked event in a test scenario. Events target specific nodes and provide mock outputs. There are two modes:
  1. Raw output mode: Set Output directly with the activity’s output structure
  2. Typed mode: Set Type with typed fields (text, tool_calls, tool_output)
Typed mode is automatically converted to the appropriate output structure. Example - LLM response with text:
  • node: call_llm
Example - LLM response with tool calls:
  • node: agent_loop.call_llm
  • name: bash
Example - Tool result:
  • node: agent_loop.execute_tools
Example - Raw output mode:
  • node: custom_node

Fields


SimToolCall

SimToolCall represents a tool call in a simulated LLM response. Example:

Fields


Expectation

Expectation defines what to verify after a scenario runs. All fields are optional - specify only what you want to assert. Node references support qualified IDs for inner loop and workflow nodes. Example - Assert completion and reached nodes:
Example - Assert error state:
Example - Assert specific output values:

Fields


Targeting Nodes

The node field on events targets specific nodes by ID:
  • Top-level nodes: node: "call_llm"
  • Inner loop nodes: node: "loop_id.inner_node_id" (dot-separated)
  • Inner workflow nodes: node: "workflow_id.inner_node_id" (for type: workflow with inline:)
  • Nested structures: node: "outer.inner.node_id"
For inline loops and inline workflow nodes, the simulator executes each inner node individually, evaluates conditions, and tracks skipped nodes with their qualified IDs. For ref-based nodes, the default is black-box mocking with the ref name. If the runner can resolve the reference and the scenario targets qualified inner nodes, the simulator executes the referenced workflow internally instead. Event matching:
  • Events with a node field are matched to that specific node
  • Events without a node field are consumed sequentially in order
  • Multiple events with the same node are consumed in order per-node (use for multi-iteration loops)

Event Types


Complete Example