Skip to content

Sub Graph

Reuse an existing flow inside your current flow. Great for shared auth, validation, FAQs, or any logic you want to maintain once and call many times.

When to use

  • You have a reusable mini-flow (e.g., "Collect Contact Info", "Auth & Fetch Profile").
  • You want consistency across bots without copy-pasting nodes.
  • You need versioned building blocks you can upgrade centrally.

What it does

  • Invokes another flow (the "child" flow) from the current ("parent") flow.
  • Passes inputs into the child, waits for it to finish, and continues the flow

Fields

Field Description Example
Node ID * A unique identifier for this node within your flow. Must be unique. SubGraph_6
Input Parser Defines how data from the parent flow is passed into the subgraph. Takes state and config as parameters and returns a dictionary. def input_parser(state, config): return {'messages': state['messages']}
Nodes * The list of internal nodes that make up the subgraph. Written in JSON format. { "nodes": [ { "node_id": "START" }, { "node_id": "END" } ] }
Edges * Defines the logical connections between nodes inside the subgraph. Each edge specifies how one node transitions to another. { "edges": [ { "source": "START", "target": "Model_1" }, { "source": "Model_1", "target": "END" } ] }