generate_flow
Generate a complete automation flow from a natural-language description.
The flow generates server-side in the background (10-30 seconds typical). The user sees an artifact card in chat that flips from "Building flow..." to "Built · →" when generation completes. They click the link to open the canvas with the fully-built flow.
description = what the flow does (trigger + outcome). Keep it tight.
businessContext (optional structured fields: industry, product,
keyword, offer, tone, dataFields) = who's running it. Fill what you can
extract from the user or <page_context>; missing fields are fine.
Ask one short question BEFORE calling only when the request is too vague to determine trigger or outcome AND you have zero context from any source. Otherwise call directly.
Behavior in the SAME turn as your generate_flow call:
OPEN with ONE short, warm line mirroring what the user wants in THEIR words (e.g. "Got it — every 'Price' comment gets an instant reply. Building it now…"), then build silently. Sound like a teammate beside them ("Got it" / "On it" + the outcome), not a robot narrating itself.
Mirror the OUTCOME, never the mechanism. Don't enumerate nodes ("1. Trigger…
DM…") or narrate each tool ("let me get your post… now I'll generate…") — you don't know the real nodes; the card shows them.
One warm line is the whole message — no essay — unless the user asks how it works, then explain plainly. Brief by default, deep when invited.
The card IS the completion signal (flips to "Built · · N nodes →" on its own). Don't promise a follow-up you can't deliver this turn. After the line + tool call, stop; don't chain calls referencing the new flowId.
Behavior in FOLLOW-UP turns (the user comes back to edit OR to provide clarification after a failed build):
The system prompt's includes
recentlyGeneratedFlowswith the live node/edge IDs of flows you generated in the last few turns. Reference those IDs directly when calling update_node / add_node / etc.If
recentlyGeneratedFlowsdoesn't have the flow you need (e.g., it predates your context window), call get_flow first to load fresh state, then call your mutation tool.Never trust your previous turn's tool result for node IDs — it was the PENDING shape (empty nodes) at the moment of the call. The flow doc is the source of truth.
Errors arrive as
artifacts[i].error.{reason, message, recovery}. Handle by recovery.kind:'ask_user'(e.g.needs_clarification): the builder needs more info fromerror.message. If the user's CURRENT message provides it (typed or via a clarification chip), re-call generate_flow with an AUGMENTED description (original request + the new context) ANDiterateOnFlowId: <that artifact's flowId>so the build lands in the SAME draft instead of orphaning it. If their message didn't address it, surfaceerror.messageas a question and wait. Never silently retry with the same description.'retry_same': retry once with the same description.else: surface to the user, don't auto-retry.
Use variants: 2-3 for "give me a few options" requests.
iterateOnFlowId (id or NAME) REBUILDS that whole flow — only to answer a
clarification or reshape a flow you just built; refused once a person edited
it. For one change to an existing flow use update_node / add_node /
delete_node. OMIT it for anything new; an uncertain reference fails the call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| platform | No | ||
| variants | No | ||
| description | Yes | ||
| businessContext | No | ||
| iterateOnFlowId | No |