How-to guide

Generate workflows with AI

Create a workflow from a plain-language description, then refine it with follow-up prompts. Every change is recorded.

Flow Current 2 min read Updated

Prerequisites

  • An AI assistant configured on the server, and the AI generation entitlement on your licence

AI-assisted authoring is optional. Build entirely by hand, entirely by prompt, or mix the two.

Generate#

In Studio choose Generate with AI, describe the process, review the result on the canvas and edit it as usual. From the CLI:

bash
kiwi flow ai-generate --prompt "Authenticate with the customer API, fetch the customer, run a fraud check and a credit check in parallel, then route to approval or manual review" --out customer-check.json

Use --file to read the prompt from a text file, --assistant to pick a specific AI assistant (the server default is used otherwise), and --out to save the generated JSON instead of printing it.

Enhance an existing workflow#

Describe what should change and Kiwi Flow produces a targeted modification, leaving the original preserved:

bash
kiwi flow ai-enhance --workflow-id <id> --prompt "Add retry with delay to the HTTP calls and post to Slack if everything fails"

Enhance keeps a short trail of recent intents, so follow-ups like "make that timeout 10 seconds" refer to the right activity without replaying a whole chat.

What the generator checks#

Generated JSON is validated before you see it. The rules cover required top-level fields, unique activity ids across the whole workflow (including nested parallel branches and loop bodies), registered activity types, that every next, branch, switch default and onError target exists, valid flow-control shapes (an if_else has branches, a switch has on and cases, a parallel has two or more branches, a js_script has a body), and that fields belong in inputs[] rather than invented config blocks. If validation fails, the model is asked to correct its answer, a limited number of times.

Mandatory values such as URLs and connection details are deliberately left as placeholders for you to fill in, in Studio, after generation.

Always review#

Important

Treat generated workflows like code from a colleague: read them, fill in placeholders, test them with workflow-validate and a trial run, and only then publish.

History and audit#

Every AI-assisted change is appended to the workflow's generationHistory (prompt, mode and affected activities), so you can see who changed what, when and why.

Providers#

Generation works with OpenAI, Azure OpenAI, Anthropic and Ollama, using your own keys. See Use LLM activities for configuring assistants.

Expected result

  • A valid workflow JSON you can review, edit and run
  • A generation-history entry for each AI-assisted change