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"
Scenarios run on the real workflow runtime; only activities (LLM calls, tool execution, …) are mocked. Inline loops and inline workflow nodes always execute their inner nodes, evaluating conditions and tracking skipped nodes by qualified ID. A ref-based node (ref: builtin://agent) is black-boxed by default: an event on the node itself (node: "review") supplies its whole output. If the scenario targets qualified inner nodes (node: "review.agent_loop.call_llm"), the referenced workflow executes for real instead. A loop node can be black-boxed the same way with black_box: true — the event then supplies the loop’s aggregate output (_results, _iterations, declared outputs). Events are always keyed by node path, never by ref URL: node: "builtin://agent" is a validation error. 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