Skip to main content
Flows are the legacy authoring surface. The default engine is the Playbook runtime, and a flow graph runs compiled onto it by default - Playbook.load detects flow JSON and converts it (compile_flow). Reach for a hand-authored graph when you need an enumerable, lintable spec for compliance or strict determinism. New conversational agents should start with Thinking in Playbooks.

What is a Flow?

A Flow is a directed graph: nodes (states) connected by edges (transitions), with metadata at each node (prompts, tool references, slot definitions). It’s the static definition of what your dialog can do. By default, DialogMachine runs a flow compiled onto the Playbook engine - you pass the flow and get checkpoint semantics for free. To run the original graph runtime (one turn() at a time, every transition authored), pass engine="flow":
SuperDialog flow graph diagram showing states connected by conditional edges, including fallback and retry paths.

Building from a prompt

The fastest way to get started. create_dialog_flow makes one LLM call and generates the graph for you.
Tips for prompts:
  • Describe the goal and each step in plain language
  • Mention what data you need to collect (slots)
  • Describe any branching logic (“if they decline, escalate to an agent”)

Building by hand

For precise control over graph structure, construct nodes and edges directly:

Saving and loading

Flows support JSON and YAML formats - commit them to source control alongside your code.

React Flow editor support

Flows exported from the React Flow visual editor (camelCase JSON) are automatically detected and normalized:

Multiple flows with FlowSet

A FlowSet holds several named flows. Use it when a conversation may branch across distinct sub-flows (e.g. main flow → escalation, billing, or FAQ).
FlowSet and switch_flow are graph-engine features - construct the machine with engine="flow". On the Playbook engine, use multiple journeys and advance rules instead (see Playbooks).
Switch flows at runtime:

Validating and inspecting flows

Use the legacy flow CLI sub-tree to lint and visualise a flow graph:

Migrating a flow to a playbook

A flow already runs on the Playbook engine by default. To make the conversion explicit - and to keep authoring in the playbook format going forward - compile it:
compile_flow is lossless by construction; coverage_report lists anything that didn’t map (any entry is a compiler bug). Run it in CI next to the compiled artifact. See the API Reference for the full mapping table.

Flow versioning

Because flows are plain JSON files, they work naturally with git:
Pin a specific flow version by checking out a commit hash - useful for A/B testing different flow designs against the same eval corpus.