Skip to main content
This example demonstrates Workflows 2.0 router pattern for dynamically selecting between image and video generation pipelines. It uses Steps to encapsulate each media type’s workflow and a Router to intelligently choose the pipeline based on input analysis.

Key Features:

  • Dynamic Routing: Selects pipelines (Steps) based on input keywords (e.g., “image” or “video”).
  • Modular Pipelines: Encapsulates image/video workflows as reusable Steps objects.
  • Structured Inputs: Uses Pydantic models for type-safe configuration (e.g., resolution, style).

Key Features:

  • Nested Logic: Embeds Condition and Parallel within a Steps sequence.
  • Topic-Specialized Research: Uses Condition to trigger parallel tech/news research for tech topics.
  • Modular Design: Encapsulates the entire workflow as a reusable Steps object.
selector_for_image_video_generation_pipelines.py