Skip to main content
This advanced pattern combines intelligent path selection with iterative execution, allowing workflows to dynamically choose between simple paths or deep-dive iterative loops based on task complexity. Ideally suited for adaptive workflows where processing depth needs to match content complexity.

How it works

  • Topic Analysis: The Router evaluates the input complexity to determine the appropriate research strategy.
  • Path Selection: Simple topics are routed to a single research step, while complex topics trigger a specialized Loop.
  • Iterative Deep-Dive: The Loop step performs multiple passes of research, checking quality criteria at each iteration.
  • Unified Output: Regardless of the path taken (single step or loop), the results flow into a final publishing step for consistent formatting.

Example

Adaptive research workflow that switches between quick finance research and deep iterative tech research:
router_with_loop_steps.py