What Are Workflows?
Workflows are programmable execution pipelines that orchestrate step-by-step processing with explicit control flow. The following line creates an empty workflow, ready for steps to be added:Building Blocks of a Workflow: Steps
Steps are the core units of work, which can process data, perform actions and pass results onward.Adding Steps to the Workflow
Use.step() to add steps to workflows. Any Runnable is valid to create a step.
Step Names and Reusing Functions
Each step in a workflow must have a unique name. Like all Runnables, steps are identified by their names, which must be distinct within the workflow. To use the same function multiple times in a workflow, wrap it in a new Tool with a distinct name for each usage:Running the Workflow
The workflow’s final output is automatically determined by the last executed step in the dependency graph. To run the workflow and receive directly the final output, use thecollect() method:
.input: Dictionary of parameters passed to the step.output: Value(s) returned by the step. Can be a single value, dictionary, array, or custom class.
Key Features
- Composition: Workflows can contain other workflows
- Parallel Execution: Independent steps run concurrently
- Type Safety: Automatic parameter validation via Pydantic
- Error Isolation: Failed steps skip dependents, others continue