Skip to content

Dynamic Workflows

In a dynamic workflow there is no fixed graph. Instead, a router agent decides what runs next. The executor calls the router at the start and again after each batch of nodes completes; the router looks at what has happened so far and returns the next nodes to run, or signals that the workflow is complete.

How Dynamic Workflows Run

On every call the router receives the initial input, the history of executed nodes, all outputs so far, and the outputs of the most recent batch. It returns one of:

Return value Meaning
[{ "nodeID": "...", "input": {...} }, ...] Run these nodes next, in this order, then call the router again
[] or None The workflow is complete — return the outputs map
A dict with more than one key The workflow is complete — return this dict as the final output

Because the router sees real results, it can branch on content, loop, retry a step that produced a poor result, or stop early.

Good Fits

  • Triage and routing — send a case down different paths depending on what earlier steps found.
  • Iterative refinement — repeat a draft → review cycle until a quality bar is met.
  • Agentic processes where an LLM-backed router plans the next step.

Building One

Follow the authoring guide, choosing dynamic at step 5, then write the router: