Skip to main content

POST /api/flow

Generates or edits a Voiceblox flow using Claude. Returns a list of operations to apply to the canvas.

Request

{
  "messages": [
    { "role": "user", "content": "Build a customer support agent" }
  ],
  "currentGraph": {
    "nodes": [],
    "edges": []
  },
  "webSearchEnabled": false
}
FieldTypeRequiredDescription
messagesChatMessage[]Conversation history with the AI
currentGraph{ nodes, edges }Current graph state (SimpleNode[] + SimpleEdge[])
webSearchEnabledbooleanEnable web search for the AI generator

Response

{
  "done": true,
  "message": "Added a customer support flow with triage and two branches.",
  "operations": [
    { "type": "add_node", "nodeType": "framework", "provider": "livekit", ... },
    { "type": "add_edge", "source": "node_1", "target": "node_2", ... }
  ],
  "versionName": "Added support flow",
  "thinking": "..."
}
FieldTypeDescription
donebooleantrue when operations are ready; false when AI is asking a question
messagestringAI response text to display to the user
operationsEditOperation[]List of graph operations to apply (only when done: true)
versionNamestringShort description of the change for the version history
thinkingstringClaude’s reasoning (extended thinking output)

Operation types

type EditOperation =
  | { type: "add_node"; id: string; nodeType: string; provider?: string; [key: string]: unknown }
  | { type: "update_node"; id: string; [key: string]: unknown }
  | { type: "remove_node"; id: string }
  | { type: "add_edge"; source: string; sourceHandle: string; target: string; targetHandle: string }
  | { type: "remove_edge"; source: string; target: string }

Error responses

StatusDescription
400Missing messages field
500Anthropic API error or graph validation failure