Workflows API Reference
Graph-based workflow orchestration for building complex multi-agent systems.This page provides an overview of the workflows API. For complete type signatures and implementation details, refer to the source code in
agent_framework/_workflows/ or the Building Workflows guide.Overview
Workflows enable you to orchestrate multiple agents and functions in complex patterns:- Sequential execution: Run agents one after another
- Concurrent execution: Run multiple agents in parallel
- Conditional routing: Route to different agents based on conditions
- Group chat: Multiple agents collaborating in a conversation
- Handoffs: Transfer control between agents
- Checkpointing: Save and restore workflow state
Core Concepts
Workflow
A graph-based workflow definition that connects agents and functions.WorkflowBuilder
Fluent API for building workflows.Orchestrators
Pre-built workflow patterns for common use cases:- SequentialOrchestrator: Run agents in sequence
- ConcurrentOrchestrator: Run agents in parallel
- GroupChatOrchestrator: Multi-agent conversation
- MagenticOrchestrator: Dynamic agent selection
- HandoffOrchestrator: Agent handoff patterns
Example: Sequential Workflow
Example: Group Chat
Example: Conditional Routing
Key Features
Checkpointing
Save and restore workflow state:State Management
Workflows maintain state across agent invocations:Event Streaming
Stream events as the workflow executes:Workflow Patterns
Sequential Pattern
Parallel Pattern
Conditional Pattern
Loop Pattern
Best Practices
- Start Simple: Begin with sequential workflows before adding complexity
- Clear Agents: Give each agent a focused, well-defined role
- State Management: Keep state minimal and well-structured
- Error Handling: Add error handling at workflow level
- Checkpointing: Use checkpoints for long-running workflows
- Testing: Test individual agents before composing into workflows
Advanced Topics
Custom Executors
Create custom execution logic:Workflow Composition
Compose workflows from smaller workflows:Dynamic Workflows
Build workflows dynamically at runtime:Coming Soon: Detailed API reference for all workflow classes and methods will be added in a future update. For now, refer to the source code in
agent_framework/_workflows/ for complete type signatures and implementation details.