# AI-powered flows

Let a flow write its own copy instead of sending the same template to everyone.

## The Draft with AI action

**Draft with AI** is a flow action like any other. It writes a piece of text from
what the run already knows (the customer, the subscription, the event that fired)
and saves it as a variable for a later step to use.

It has one field:

- **What should it write?** the instruction, for example "a short win-back email
  explaining what they will lose access to".

The draft is stored under the step's own name, which it is given automatically
when you add it — `run_ai_agent` for the first one in a flow. A later step
reads it as `{{steps.run_ai_agent}}`, and the **Insert variable** button on any
text field offers it by name, so there is nothing to type from memory.

## It never sends anything

This is the important part: the action only produces text. Nothing leaves the
workspace until a later step sends it. The usual shape is two steps:

1. **Draft with AI**.
2. **Send email**, with `{{steps.run_ai_agent}}` in the body.

That split is deliberate. You keep the deterministic send (right template, right
sender, right suppression rules) and let the model handle only the wording.

## When to reach for it

Use a fixed template when the message is the same every time. Reach for a draft
step when the wording should reflect the specific run:

- a win-back email that names what the customer actually used
- an internal note summarising why an account looks at risk
- a Slack message that says what changed, not just that something changed

## Related

- [Flow actions](actions.md)
- [Using agents in Flows](../ai/using-in-flows.md)
- [Testing, runs & debugging](testing-and-runs.md)
