Skip to main content

Flow builder

Sellable product

This capability is granted by an API key scoped to the `` product (product face). See the product reference below.

A conversational flow ENGINE as a shared capability. Author a flow as a JSON graph (nodes + edges); POST /v1/flows stores it (versioned); POST /v1/flows/{id}/execute advances one turn (walk the graph from the current node, applying the user input — emit message outputs, follow each routing decision, record tool/handoff actions — until it lands on a collect node that waits for input or a terminal). Edges route deterministically (offline) or by an LLM branch classifier for natural-language conditions (advisory to the default edge — fail-closed). POST /v1/flows/{id}/validate does static graph analysis.

  • Group: Governance & platform
  • Contract: contracts/flow-builder/v1/openapi.yaml
  • Public base: https://api.vagarylabs.com (the consolidated API gateway — one host, per-brand sibling api.<zone>)
  • Auth: a product API key (vgk_…) issued from the console — Authorization: Bearer vgk_…
  • Product face (customer-keyed):
    • https://api.vagarylabs.com/product/v1/flows

Endpoints

MethodPathSummary
POST/v1/flowsCreate a flow from a JSON graph (validated; a graph with errors is rejected)
GET/v1/flowsList an org's flows (heads only — no definitions)
GET/v1/flows/&#123;flow_id&#125;Fetch a flow (head, or a specific immutable version)
PATCH/v1/flows/&#123;flow_id&#125;Versioned upsert — append a new immutable version
POST/v1/flows/&#123;flow_id&#125;/executeAdvance the flow one turn
POST/v1/flows/&#123;flow_id&#125;/validateStatic graph validation (an inline definition, or the stored flow)
GET/v1/flows/&#123;flow_id&#125;/versionsThe version ledger (newest first), each row tagged is_draft / is_published — the console's version-history and rollback picker.
POST/v1/flows/&#123;flow_id&#125;/publishMove the publish pointer — the draft→production gate
DELETE/v1/flows/&#123;flow_id&#125;/publishClear the publish pointer — the flow returns to draft-only
GET/v1/flows/&#123;flow_id&#125;/diffStructural diff between two versions of a flow
POST/v1/flows/&#123;flow_id&#125;/duplicateClone a flow into a NEW artifact (new flow_id) at version 1, unpublished
GET/healthliveness + store/classifier readiness
GET/metricsPrometheus exposition (fleet observability SDK — fail-open)

Schemas

Node

A typed flow node. type selects behavior (aliases accepted). message/say emits text; collect/input emits prompt and captures the next user turn into variable; branch/condition is a pure routing node; tool/action emits an action (tool name + args); autonomous/agent delegates to a bounded agentic loop (a goal + a bounded tool-set) then follows the edge; handoff + end are terminal. The DECLARATIVE lifecycle/config types (global/trigger/webhook/qa) carry configuration + graph-cardinality rules and round-trip through the store, but are NOT part of the one-turn walk (consumed out-of-band). Any node may declare an extraction schema (a per-node LLM variable-extraction pass), a graph_constraints override, and tools/documents/mcp bindings.

FieldTypeDescription
idstring
typestring
textstringmessage/end utterance ({{ var }} interpolated)
promptstringcollect prompt ({{ var }} interpolated); global: the persona/system prompt
variablestringcollect: the variable the answer is captured into
caststringcollect: coerce the answer (default string)
toolstringtool: the action name emitted to the caller
argsobjecttool: structured args ({{ var }} interpolated recursively)
output_varstringtool: the variable the caller writes the tool result into; autonomous: the var the agent outcome is merged into (default agent_result)
goalstringautonomous: the agent's objective ({{ var }} interpolated) — delegated to a bounded agentic loop
toolsarrayautonomous: the bounded function-calling tool-set; any node: a declarative tool binding
tool_dispatchobjectautonomous: name -> {url, method?, headers?} customer HTTP endpoint each tool dispatches to (I5)
documentsarraydeclarative KB binding — knowledge-base document ids (threaded into an autonomous spec)
mcpobjectdeclarative MCP binding (object or list) — MCP server/tool filter (threaded into an autonomous spec)
add_global_promptbooleanautonomous: when not false (default true), the flow's global-node prompt is prepended to this node's system
extractionobjectper-node variable-extraction schema (dograh-shape). When a collect node captures an answer and an extractor is available, the typed variables are merged into the bag.
graph_constraintsobjectper-node override of the canonical-type GraphConstraints default (enforced in /validate)
max_iterationsintegerautonomous: loop-cap bound (exit condition)
turn_budgetnumberautonomous: wall-clock budget in seconds (exit condition)
context_varsarrayautonomous: variable names handed to the agent as prior flow state
targetstringhandoff: the destination the caller routes to
reasonstringhandoff: a human reason ({{ var }} interpolated)
messagestringend/handoff final utterance ({{ var }} interpolated)

Edge

A directed edge carrying the routing decision. DETERMINISTIC = {variable, op, value} (offline, no LLM). NATURAL-LANGUAGE = {nl: "<intent description>"} (resolved by the provider-gateway branch classifier). DEFAULT = no condition or {default: true} (the fallback). From a node, deterministic edges are tried first (declared order), then NL edges (one classifier call), then the default edge.

FieldTypeDescription
sourcestringthe node this edge leaves (must be a declared node)
targetstringthe node this edge routes to
variablestringdeterministic: the variable compared (or 'user_input')
opstringdeterministic comparison operator
valueobjectdeterministic: the expected value (string
nlstringnatural-language condition — classified via provider-gateway
conditionstringalias for nl (dograh-compatible edge label)
labelstringoptional human label (also a classifier hint)
defaultbooleanmark the fallback edge taken when no condition matched

FlowDefinition

the flow graph — nodes + edges + an optional explicit start node id.

FieldTypeDescription
flow_idstring
namestring
startstringthe entry node id; defaults to a node id 'start' else the first node
nodesarray
edgesarray

FlowRequest

FieldTypeDescription
organization_idstringproduct-tier end-customer tenant (I6). OPTIONAL — derived from the verified identity token; when supplied must MATCH the token claim (mismatch = 403).
flow_idstringidempotent key; generated when omitted
namestring
definitionobject

FlowHead

FieldTypeDescription
flow_idstring
namestring
latest_versioninteger
created_atnumber
updated_atnumber

StoredFlow

FieldTypeDescription
flow_idstring
namestring
versioninteger
latest_versioninteger
definitionobject
validationobject
created_atnumber
updated_atnumber

ExecuteRequest

FieldTypeDescription
session_idstringa correlation label — the engine stores no session (stateless)
current_nodestringthe node to resume at (the prior turn's next_node); null = start
user_inputstringthe user's utterance this turn
variablesobjectthe running variable bag (carried back each turn)

Action

a side-effect the caller executes or records (a tool call, an autonomous-agent delegation, or a handoff). An autonomous action carries the delegated bounded-loop outcome (when the flow ran it in-process) OR the run spec (goal + tools + tool_dispatch) for out-of-band dispatch.

FieldTypeDescription
typestring
toolstringtool action: the action name
argsobjecttool action: interpolated args
output_varobject
goalstringautonomous action: the agent goal (interpolated)
statusobjectautonomous action: goal_reached
iterationsobjectautonomous action: loop iterations spent
tool_callsobjectautonomous action: tool calls the agent executed
toolsarrayautonomous action (out-of-band): the tool-set to run the loop with
tool_dispatchobjectautonomous action (out-of-band): the tool dispatch endpoints
targetobjecthandoff: destination
reasonobject

Generated by scripts/gen-capability-docs.py from contracts/flow-builder/v1/openapi.yaml — the contract IS the source of truth; edit the contract, not this page.