---
title: Generate a flow
description: "Write a description of the conversation and let the editor lay out the nodes and edges, or ask it to improve the flow you already have."
---

<Badge variant="accent">Flow agents</Badge>

The **Generate** button on the flow toolbar drafts a whole flow from a description,
or rewrites the current one. It is the fastest way to a first version; edit the
result node by node rather than starting from the 3 default nodes.

:::note[Before you start]
You need a flow agent. In **Create Agent**, pick the <Term>modality</Term>, then **Conversation
Flow**. The agent opens in its workspace; choose **Flow** in the sidebar. See
[Choosing a prompt type](/build/choosing-a-prompt-type).
:::

## Generate from instructions

1. **Open the Generate menu**

    On the toolbar at the bottom of the canvas, choose **Generate**. The menu has
    two items: **Custom Instructions** (generate with your input) and **Enhance
    Current Flow** (improve the existing flow with AI).

2. **Choose Custom Instructions**

    The **Generate Flow with Instructions** dialog opens with one text field.

3. **Describe the conversation**

    Write the stages in order, the branches, and where the call should end or be
    transferred. For example:

    ```text
    Create a flow for a dental clinic receptionist. Verify the caller's full name
    and date of birth. Then find out whether they want to book, move or cancel an
    appointment and handle each case. If the caller asks a medical question, offer
    to book a consultation instead. If they ask for a person, transfer the call to
    the front desk. Otherwise summarise what was agreed and end the call.
    ```

4. **Generate Flow**

    Choose **Generate Flow**. The canvas is replaced by the generated nodes and
    edges, laid out top to bottom. This takes a few seconds. With the field empty,
    nothing is generated and **Instructions Required** appears instead.

5. **Review and save**

    Open each node and read its **Conversation Goal**; open each edge and read its
    condition. Adjust, then choose **Save** at the top of the page. Nothing is kept
    until you save.

<video src="/media/build/generate-a-flow.mp4" autoplay loop muted playsinline></video>

*Generating a flow from a description.*

:::warning
Generating replaces the current canvas. If the flow already has work in it, save
first so the previous state is a version you can roll back to, or use **Enhance
Current Flow** instead.
:::

## Enhance the current flow

**Generate** then **Enhance Current Flow** sends the flow as it is on the canvas,
unsaved edits included, and rewrites it in place: clearer conversation goals,
tighter edge conditions, missing fallbacks.
There is no dialog; the canvas shows **Enhancing flow…** and updates when it is
done. Review the result the same way and **Save** to keep it, or leave the page to
discard it. On a flow that is only the **Start Call** node, it stops with **No Flow
to Enhance**.

![The Generate menu.](/media/build/generate-menu.webp)

## What the generator does not do

- It does not set tools. Add [Global Tools](/build/flow-agents/flow-editor#the-settings-panel)
  or per-node tools yourself.
- It does not attach a knowledge base. Use the **KB** tab of a **Prompt** node or
  the [Knowledge Base tool](/build/tools/knowledge-base).
- It does not fill transfer targets or webhook URLs; open those nodes and complete
  them.
- It does not save. **Save** is always yours.

## Verify

- **Fit View** shows every generated node; there is one **Start Call** and at least
  one **End Call**.
- Every **Prompt** node has at least one outgoing edge, and every branch has a
  fallback edge.
- A **Call** under **Testing** walks the flow from the opening message to an End
  Call node.

## Troubleshooting

- **The generated flow is one long Prompt node.** The description listed goals, not
  stages. Rewrite it as a sequence (`First…, then…, if…`) and generate again.
- **The conversation never leaves a node in Chat.** An edge condition is never
  satisfied. Open the edge, loosen the condition or add a **None (Always)** edge to
  the next node.
- **The result disappeared.** The page was left without **Save**. Generation is not
  saved automatically.

## Related

- [Flow editor](/build/flow-agents/flow-editor)
- [Nodes](/build/flow-agents/nodes)
- [Edges and conditions](/build/flow-agents/edges-and-conditions)
- [Generate with AI](/build/prompting/generate-with-ai)
