Overview
TaskFlow
is a flexible, agent-based orchestration utility designed for chaining and executing multiple AI agents in a structured, sequential, or parallel fashion.
It supports:
- Step-based and parallel execution of agents
- Dynamic input mapping with references to prior outputs
- Retry policies per step or globally
- Output tracking and structured result return
- Optional callbacks on step completion
TaskFlow
is a powerful orchestration engine designed to coordinate multiple AI agents and tools in a structured sequence or parallel execution pattern. It enables complex LLM pipelines with dynamic input resolution, retries, and step-by-step control.
β¨ Features
- Step-by-step agent orchestration
- Input templating using
{{agent_name.key}}
- Parallel execution support
- Retry policy for each step
- Optional callbacks after steps
- Full flow trace access
π§ Example Use Case
Letβs define a flow to extract information and summarize it.1. Define Agents
2. Compose the TaskFlow
3. Run It
π§© Dynamic Input Mapping
You can reference any previous stepβs output using:{{input}}
: Original input{{agent_name.key}}
: Output from a specific agent
π Retry on Failure
Set retry policy for resilience:β‘ Parallel Execution
Run steps concurrently if independent:π Callbacks
Hook into each step:π§ͺ Output Structure
π New Features
π Advanced Step Controls
Eachstep()
now supports fine-grained execution control:
step_name
: Define a custom name for the step (useful for reusing agents).timeout
: Set a timeout in seconds for the step.on_start
,on_complete
,on_error
: Step-level hooks for better control and observability.condition
: A boolean-returning function to decide whether the step should run.depends_on
: Specify other steps that must complete before this one runs.
π·οΈ Alias Creation
You can now define aliases for specific keys in a stepβs output. This makes your input mappings cleaner and more maintainable. Usage:{{summarizer.text}}
, you can now use the simplified {{summary}}
.
β Best Practices
- Keep agents focused (1 purpose per agent)
- Reuse tools through agents
- Use retries on weak/volatile steps
- Combine TaskFlow with UI or APIs
π Tool-Based Agent Example
π Interface Summary (TS)
π― Use Case Ideas
Use Case | Description |
---|---|
Research Bot | Search β summarize β report |
Support Assistant | Classify β fetch KB β reply |
Market Analysis | Scrape β analyze β visualize |
Workflow Engine | Multi-agent automation with retries |
TaskFlow
brings composability and robustness to AI-based systems. Use it to turn isolated agents into scalable intelligent workflows.