Orchestrating AI Workflows
Design, connect, and control multi-step AI pipelines using Workflows—Timbal's flexible workflow engine.
What Are Workflows?
Workflows are programmable execution pipelines that orchestrate step-by-step processing with explicit control flow.
This is the initial step to create a workflow. Once created, you can build your workflow by adding components as building blocks.
Building Blocks of a Workflow
Steps
Steps are the core units of work.
Each step can be:
- a function
- a Tool
- another workflow
Steps process data, perform actions, and pass results onward.
Links
Links define execution dependencies between steps.
Links can be:
- explicit (manual)
- implicit (automatic via data references)
Links ensure proper execution order and create a DAG.
DAG-Based Execution
Workflows form a Directed Acyclic Graph (DAG) where:
- Steps can run in parallel when dependencies allow
- No circular dependencies (prevents infinite loops)
- Automatic dependency resolution and execution ordering

Adding Steps to Your Workflow
Workflows use .step()
method to add steps. Each step can be:
- Functions: Direct function references
- Tools: Tool objects with handlers
- Dictionaries: Tool configurations
- Other Workflows: Nested workflow components
Adding Steps with Parameters
You can pass fixed parameters to steps using keyword arguments:
Connecting Steps
Use get_run_context().get_data("step_name.output")
to access outputs from previous steps:
In the above example, you don't need .link()
because step2 uses step1's output. When a step depends on another step's data, they run sequentially (implicit linking).
To force sequential execution, use .link()
:
Without .link()
, steps run in parallel:
Integrating LLMs
You can add LLMs as steps. Timbal provides llm_router
function that set as a Tool can work as an step.
Default Parameters
Look in the above example that the parameter of the function openai_llm
comes from default_params
('model' and 'system_prompt') and runtime parameters (messages).
Default parameters in Timbal allow you to set predefined values that are automatically injected into your runnable components, providing flexibility and reducing boilerplate code.
Default parameters are defined when creating a runnable and are merged with runtime parameters. Runtime parameters always override default parameters.
Running Your Workflow
Once your workflow is defined, you can execute it in two main ways:
Get the final output:
Stream events as they happen:
If a function in your flow needs a value per run (e.g., x), pass it when you call the workflow:
- Inputs are routed only to steps that declare those parameters
- Runtime inputs override step defaults
- The same input name can feed multiple steps unless a step overrides it
Key Features
- Parallel Execution: Independent steps run concurrently
- Error Isolation: Failed steps skip dependents, others continue
- Type Safety: Automatic parameter validation via Pydantic
- Composition: Workflows can contain other workflows
For more, see the Advanced Workflow Concepts, and Examples.