Skip to main content

Migrating from Workflows 1.0

Workflows 2.0 is a completely new approach to agent automation, and requires an upgrade from the Workflows 1.0 implementation. It introduces a new, more flexible and powerful way to build workflows.

Key Differences

Workflows 1.0Workflows 2.0Migration Path
Linear onlyMultiple patternsAdd Parallel/Condition as needed
Agent-focusedMixed componentsConvert functions to Steps
Limited branchingSmart routingReplace if/else with Router
Manual loopsBuilt-in LoopUse Loop component

Migration Steps

  1. Assess current workflow: Identify parallel opportunities
  2. Add conditions: Convert if/else logic to Condition components
  3. Extract functions: Move custom logic to function-based steps
  4. Enable streaming: For event-based information
  5. Add state management: Use workflow_session_state for data sharing

Example of Blog Post Generator Workflow

Lets take an example that demonstrates how to build a sophisticated blog post generator that combines web research capabilities with professional writing expertise. The workflow uses a multi-stage approach:
  1. Intelligent web research and source gathering
  2. Content extraction and processing
  3. Professional blog post writing with proper citations
Hereโ€™s the code for the blog post generator in Workflows 1.0:
To convert this into Workflows 2.0 structure, either we can break down the workflow into smaller steps and follow the development guide. Or for simplicity we can directly replace the run method to a single custom function executor as mentioned here. It will look like this:
For more examples and advanced patterns, see here. Each file demonstrates a specific pattern with detailed comments and real-world use cases.