# The flow assistant (/docs/agents/flow-assistant)

The flow assistant changes a flow from a sentence: "Wait 2 hours for a reply, then hand to a person". It writes the change as code and shows you what it would do. Nothing changes until you apply it, and even then it only changes your draft.

- **Who can use it:** Anyone who can open the builder can ask the assistant. Applying its changes needs the **Edit agents** permission (owners and admins by default); for other roles, a proposal says "Your role can't change this flow, so this stays a suggestion." See [Roles and permissions](/docs/settings/roles).
- **Before you start:** Open the flow in the builder. See [Flow builder basics](/docs/agents/flow-builder).

## Ask for a change [#ask-for-a-change]

<Steps>
<Step>

### Open the assistant [#open-the-assistant]

In the side panel, click the **Assistant** tab. If the side panel is folded, click the sparkles button on its rail; on a smaller screen, click **Flow assistant** in the top bar.

![The Assistant tab: Describe a change, with four suggestions (Filter out spam before anything else runs, Tell the deal owner about deals over 5000, Wait 2 hours for a reply, then hand to a person, Explain this flow) and the message box at the bottom](/screenshots/flow-assistant/01-assistant.webp)

</Step>
<Step>

### Describe the change [#describe-the-change]

Click a suggestion, or type what the flow should do in the box at the bottom (**Add a step, branch on a value, remove a step…**) and press <kbd>Enter</kbd>. <kbd>⇧</kbd> <kbd>Enter</kbd> starts a new line. While it works, the assistant shows "Writing the change".

</Step>
<Step>

### Review the proposal [#review-the-proposal]

The reply lists the **Proposed changes**, such as "Adds Wait up to 2 hours for a reply before Write to CRM and timeline". Click **Show the new steps' code** to read the YAML of the new steps.

![A proposal for Wait 2 hours for a reply, then hand to a person: Here are 2 changes. Nothing applies until you choose to, listing the new Wait and Hand to the deal owner steps, with Show the new steps' code, Apply to draft and Review in Code](/screenshots/flow-assistant/02-proposal.webp)

</Step>
<Step>

### Apply it, or review it in Code [#apply-it-or-review-it-in-code]

- **Apply to draft** adds the change to your draft straight away. The proposal says "Applied to your draft. Undo from the toolbar puts it back." The new steps appear on the canvas with a **New** badge.
- **Review in Code** opens the whole flow in the [Code view](/docs/agents/flow-code) with the change in it, marked **Not applied**. Read or adjust it, then click **Apply** (or switch views) to apply it, or **Discard edits** to drop it.

![The canvas after applying: the steps Wait up to 2 hours for a reply and Hand to the deal owner, both marked New](/screenshots/flow-assistant/03-applied.webp)

</Step>
</Steps>

Applying a proposal changes the draft only. A guardrail step the assistant adds starts with no rules, and the flow can't publish until you add some: select the step and use **Add rule**, or add rules from the Guardrails group of Blocks. Test the change with [Test run](/docs/agents/flow-test-run#test-the-draft), then [publish](/docs/agents/flow-test-run#publish-the-flow) to make it live.

![The Assistant tab in the Code view: the proposal for Tell the deal owner about deals over 5000, marked Opened in Code. It applies when you press Apply or switch views; Discard edits drops it](/screenshots/flow-assistant/04-review-in-code.webp)

## What you can ask for [#what-you-can-ask-for]

| Ask for | Example | What it proposes |
| --- | --- | --- |
| Filter spam | "Filter out spam before anything else runs" | A **Filter** ("Skip spam") after the message classifier, adding a **Classify message** step if the flow has none. |
| Pull out details | "Extract the budget and email address" | An **Extract fields** step. |
| Score or qualify | "Score the lead" | A **Score lead** step. |
| Branch on deal size | "Tell the deal owner about deals over 5000" | An If / else on the deal value, with steps on its path. |
| Wait or follow up | "Wait 2 hours for a reply, then hand to a person" | A **Wait** step, often with what happens next. |
| Notify | "Let the team know" | A **Notify a teammate** step. |
| Tag or move the deal | "Tag the contact", "Move the deal to Qualified" | **Add or remove tags**, **Change deal stage**. |
| Hand off | "Escalate to a person" | A **Hand to a person** step. |
| Post to another app | "Send it to n8n", "Post a webhook to Zapier" | A **Send webhook** step. |
| Call an API | "Open a helpdesk ticket" | An **HTTP request** step. |
| Payment | "Send a payment link" | A **Send payment link** step. |
| Summarise | "Summarise the thread for the owner" | A **Generate text** step. |
| Guardrails | "Check every draft before it sends" | A **Guardrail checks** step after the draft, with no rules yet: add them in its settings before you publish. |
| Remove a step | "Remove the wait step" | Removes the step with that title or id. |
| Start over | "Build a new flow from scratch for Instagram comments" | A new flow: the trigger you name (Instagram comment, a schedule, a payment or a deal stage change; a message otherwise), then knowledge, a draft, guardrail checks (with no rules yet) and a send. |
| Explain | "Explain this flow" | A plain-language walk through the flow. Nothing to apply. |
| Find problems | "Why can't I publish?" | The issues that stop publishing, or that nothing does. |

You can combine requests in one message, such as "wait 1 hour, then notify the team". If the assistant can't tell what you want, it says what it can do and suggests a way to ask.

The conversation stays with the flow while you work on it, so you can come back to a proposal later.

## Troubleshooting [#troubleshooting]

<Accordions type="single">
<Accordion title="The assistant says the code has a syntax problem">
It reads the flow from its code. If the Code view has edits with problems, fix or discard them first (see [Fix problems](/docs/agents/flow-code#fix-problems)), then ask again.
</Accordion>
<Accordion title="It couldn't find a step to remove">
Use the step's title as it appears on the canvas, or its reference name, for example "remove the wait step".
</Accordion>
<Accordion title="The reply says “No answer”">
The request didn't go through. Click **Try again**.
</Accordion>
<Accordion title="Applying a proposal fails">
If the flow changed since the proposal was written, the proposal may no longer fit. The reason shows under the proposal in red. Ask again, or use **Review in Code** to adjust it.
</Accordion>
</Accordions>

## Next steps [#next-steps]

<Cards>
<Card title="Edit a flow as code" href="/docs/agents/flow-code" description="Read and adjust what the assistant wrote." />
<Card title="Test, publish and version a flow" href="/docs/agents/flow-test-run" description="Try the change on a sample message, then make it live." />
<Card title="Blocks reference" href="/docs/agents/flow-nodes" description="What each step the assistant adds does." />
</Cards>
