Overview
A flow consists of:- Begin — which node starts the conversation and who speaks first
- Nodes — individual steps (conversation, tool call, logic branch, transfer, etc.)
- Edges — connections between nodes that define transitions and conditions
Flow Definition Reference
Top-Level Structure
Begin
Node Types
Every node has the following base fields:Conversation
The core node type. The agent speaks and/or listens based on an instruction. Type:"conversation"
Example:
Function (Tool Call)
Invokes one of your agent’s custom tools during the flow. Type:"function"
Each entry in
outputVariables:
Example:
Logic Split
A branching node with no data of its own — all logic is defined by its outgoing edges (conditions and an else fallback). Type:"logic_split"
The logic split node must have:
- One or more
conditionedges (evaluated in order) - Exactly one
elseedge (fallback if no conditions match)
Call Transfer
Transfers the call to another phone number. Type:"call_transfer"
Example:
End Call
Terminates the call, optionally speaking a closing message. Type:"end"
Example:
Press Digit (DTMF)
Waits for the caller to press a phone keypad digit. Useful for IVR-style menus or entering account numbers. Type:"press_digit"
Example:
Extract Variable
Uses the LLM to extract structured data from the conversation and store it in flow variables for downstream use. Type:"extract_variable"
Each entry in
variables:
Example:
Edges
Edges connect nodes and define how the flow transitions between steps.Condition edges can be attached to any node type, not just logic split nodes. For example, you can put condition edges directly on a conversation node to branch based on the caller’s response — no logic split needed.
Edge Fields
Edge Kinds
Conditions on Any Node
You can attach condition edges to any node type. This is particularly useful on conversation nodes — branch directly based on the caller’s response without needing a separate logic split node. For example, a greeting node that routes callers to different paths:Conditions
Conditions determine whether acondition edge is followed. There are two types:
Prompt Conditions
The LLM evaluates a natural language question against the conversation context.Equation Conditions
Variable-based conditions that compare flow variables against values. No LLM call required.
Each equation:
Available operators:
==, !=, contains, not_contains, contained_in, not_contained_in, >, <, >=, <=, exists, not_exists
Global Nodes and Edges
Global nodes can be triggered from any point in the conversation, not just from a specific predecessor node. This is useful for handling requests that can happen at any time, such as “transfer me to a human” or “I want to cancel.” To make a node global:- Set
isGlobal: trueon the node - Add one or more edges with
source: "__global__"targeting that node - Global edges must have a
condition— typically a prompt condition
Transition Behavior
After each user reply, the agent evaluates edges in this priority order:- Global edges — checked first, across all global nodes. If a global condition matches, the flow jumps to that global node regardless of where the conversation currently is.
- Condition edges on the current node — evaluated in
order, first match wins - Else edge — taken if no condition edges matched
- Default edge — unconditional, taken if present
- No match — the agent stays in the current node and continues the conversation
Validation Rules
When submitting a flow via the API, the following rules are enforced:schemaVersionmust be1- Every node must have a unique
id begin.startNodeIdmust reference an existing node- All edge
sourceandtargetvalues must reference existing nodes (except"__global__"as source) logic_splitnodes must have exactly oneelseedgeskipResponseconversation nodes must have exactly oneskipedge and no other outgoing edges- Global nodes (
isGlobal: true) must have at least one__global__edge targeting them __global__edges must target nodes withisGlobal: trueconditionedges must have anordervalue, unique per source node- Prompt conditions must have non-empty
promptText; equation conditions must have at least one equation - Total flow size must not exceed 48 KB
Complete Example
Here is a complete flow for an order status hotline:- Greets the caller and asks for their order number
- Extracts the order number from the conversation
- Calls a tool to look up the order status
- Branches based on whether the status is
"shipped"or anything else - Responds with the appropriate message
- Ends the call
- At any point, if the caller asks for a human, the call is transferred (global node)
Importing Flows via API
Agentmode is set at creation time and cannot be changed afterwards. To use conversation flows, create an agent with mode: "conversation_flow".
Creating a flow agent
Use the Create Agent endpoint withmode set to "conversation_flow" and the flowDefinition field set to your flow JSON:
Updating a flow
To update the flow on an existingconversation_flow agent, use the Update Agent endpoint with just the flowDefinition field:
mode is immutable after creation. You cannot convert a single_prompt agent to conversation_flow — create a new agent instead.Using Variables in Flows
Flow nodes support{{variable}} syntax in instruction text. Variables can come from:
- System variables (
{{current_time}},{{user_number}}, etc.) — see Prompting & Variables - Default variables configured on your agent
- Dynamic variables passed via the API or pre-call webhook
- Extracted variables from
extract_variablenodes - Tool output variables mapped via
outputVariablesin function nodes