Mocks
vellum.workflows.nodes.mocks.MockNodeExecution
Mocks allow you to override node outputs during local execution, which is useful for testing specific scenarios without calling external services or APIs.
MockNodeExecution
The MockNodeExecution class provides fine-grained control over when and what outputs to mock.
Attributes
A condition that determines when this mock should be applied. Supports expressions using workflow inputs and node execution counters.
Note: Currently, the only when_condition supported by the Vellum UI is the same node’s execution count greater than or equal to 0.
The outputs to return when the condition is met. Must be an instance of the node’s Outputs class.
Set to True to disable this mock without removing it from the dataset.
Simple Mocks
For simple cases, you can pass a node’s Outputs instance directly to the mocks list:
Conditional Mocks
For more complex scenarios, use MockNodeExecution with conditions:
Condition Operators
The when_condition supports various comparison operators: