Building Blocks
The core building blocks of Agno Workflows are:Component | Purpose |
---|---|
Step | Basic execution unit |
Agent | AI assistant with specific role |
Team | Coordinated group of agents |
Function | Custom Python logic |
Parallel | Concurrent execution |
Condition | Conditional execution |
Loop | Iterative execution |
Router | Dynamic routing |
Workflow Patterns
1. Basic Sequential Workflows
When to use: Linear processes where each step depends on the previous one. Example Steps: Research → Process research data in a function before next step → Content CreationFor more information on how to use custom functions, refer to the Advanced page.
- Sequence of Functions and Agents - Complete workflow with functions and agents
StepInput
and StepOutput
provides standardized interfaces for data flow between steps:
So if you make a custom function as an executor for a step, make sure that the input and output types are compatible with the StepInput
and StepOutput
interfaces.
This will ensure that your custom function can seamlessly integrate into the workflow system.Take a look at the schemas for StepInput
and StepOutput
.2. Fully Python Workflow
Keep it Simple with Pure Python: If you prefer the Workflows 1.0 approach or need maximum flexibility, you can still use a single Python function to handle everything. This approach gives you complete control over the execution flow while still benefiting from workflow features like storage, streaming, and session management. Replace all the steps in the workflow with a single executable function where you can control everything.- Function-Based Workflow - Complete function-based workflow
3. Step-Based Workflows
You can name your steps for better logging and future support on the Agno platform.This also changes the name of a step when accessing that step’s output inside a
StepInput
object.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
name | Optional[str] | None | Name of the step for identification |
description | Optional[str] | None | Description of the step's purpose |
executor | Optional[Callable] | None | Custom function to execute for this step |
agent | Optional[Agent] | None | Agent to execute for this step |
team | Optional[Team] | None | Team to execute for this step |
Example
4. Conditional Steps
When to use: Conditional step execution based on business logic. Example Use-Cases: Topic-specific research strategies, content type routing
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
evaluator | Union[Callable[[StepInput], bool], bool] | Required | Function or boolean to evaluate the condition |
steps | WorkflowSteps | Required | Steps to execute if the condition is met |
name | Optional[str] | None | Name of the condition step |
description | Optional[str] | None | Description of the condition step |
Example
5. Parallel Execution
When to use: Independent tasks that can run simultaneously to save time. Example Use-Cases: Multiple research sources, parallel content creation
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
steps | WorkflowSteps | Required | List of steps to execute in parallel |
name | Optional[str] | None | Name of the parallel execution block |
description | Optional[str] | None | Description of the parallel execution |
Example
6. Loop/Iteration Workflows
When to use: Quality-driven processes, iterative refinement, or retry logic. Example Use-Cases: Research until sufficient quality, iterative improvement
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
steps | WorkflowSteps | Required | Steps to execute in each loop iteration |
name | Optional[str] | None | Name of the loop step |
description | Optional[str] | None | Description of the loop step |
max_iterations | int | 3 | Maximum number of iterations for the loop |
end_condition | Optional[Callable[[List[StepOutput]], bool]] | None | Function to evaluate if the loop should end |
Example
7. Branching Workflows
When to use: Complex decision trees, topic-specific workflows, dynamic routing. Example Use-Cases: Content type detection, expertise routing
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
selector | Callable[[StepInput], Union[WorkflowSteps, List[WorkflowSteps]]] | Required | Function to select steps dynamically |
choices | WorkflowSteps | Required | Available steps for selection |
name | Optional[str] | None | Name of the router step |
description | Optional[str] | None | Description of the router step |
Example
8. Steps: Grouping a list of steps
When to use: When you need to group multiple steps into logical sequences, create reusable workflows, or organize complex workflows with multiple branching paths. Better Routing: Use with Router for clean branching logicParameters
Parameter | Type | Default | Description |
---|---|---|---|
steps | WorkflowSteps | Required | List of steps to execute sequentially |
name | Optional[str] | None | Name of the steps step |
description | Optional[str] | None | Description of the steps step |
Basic Example
Steps with Router
This is whereSteps
really shines - creating distinct sequences for different content types or workflows:
workflow_using_steps.py
workflow_using_steps_nested.py
selector_for_image_video_generation_pipelines.py