---
title: AI steps in automations
description: Add an AI step or an AI switch to an automation so a flow can read the event with a model, take reversible actions, or route down one of your cases.
---

Automations have two AI nodes, mirroring the AI steps in campaign sequences: an **AI step** that reads the event and transforms or acts on it, and an **AI switch** that routes it down one of your cases. Both are built-in, needing no integration. Add one from an action node: **Warmbly (built-in)** under **Run**, then **AI step** or **AI switch**.

## The AI step

Every mode takes a plain-language **instruction**, templated so you can drop event fields in with `{{.field}}`. The step also sees the rest of the event data, so you need not list every field.

| Mode | What it does | Result lands in |
| --- | --- | --- |
| Agent | Follows your instruction and takes the reversible actions you allow | The contact / event |
| Generate text | Writes a short piece of text | `ai_text` |
| Classify | Picks exactly one of your labels | `ai_class` |
| Extract fields | Pulls the fields you name out of the event text | One variable per field |

**Agent** is the default. Check which reversible actions it may take: add or remove a tag, label the email, create a task, create a deal, move a deal stage, set variables, and unsubscribe. It decides which fit, can chain several, and writes the details itself (task title, deal name, variable value). It only ever takes the actions you enable, and **never sends email or replies**. Billed one credit per step it takes.

For tag and label actions, an optional **pool** limits which tags it may choose. An empty pool lets it use any of yours, and optionally create a new one when nothing fits.

On a Reply received trigger, an instruction like "If they ask about pricing, tag them and open a follow-up task; if they ask to stop, unsubscribe them" with those three actions enabled handles all three outcomes in one step.

**Classify** needs at least two labels and returns exactly one, stored in `ai_class`. A non-exact answer resolves to the closest match; if none is close, the raw answer is stored so you can see what happened in run history.

**Extract fields** returns one value per output key you name, each in a variable of that name, turning free text into structured fields like `company_size` or `budget`. An unfillable key is stored as an empty string, so a later condition can test whether it was found.

<Callout type="warn" title="Generated text is never sent on its own">
A generate step only writes text into a variable. To use it you connect a later step you control (a Slack message, a task, a webhook). Warmbly never sends outreach email from an AI step.
</Callout>

## The AI switch

Routes the event down exactly one of your **cases** (at least two), each its own dot on the node, with the bottom dot as the "otherwise" fallback. Put ordinary action steps on a path to make things happen for events routed down it.

| Decided by | How | Cost |
|-----------|-----|------|
| **AI prompt** | The model reads the event and picks one case | 1 credit per event |
| **Value** | A template under **Value to match** (`{{.intent}}`) is rendered and matched to case names, ignoring casing and extra spaces. Wrap a case in slashes for a regex (`/^(vip\|enterprise)/`); first match wins | None |

An unmatched value, or a model picking no case, takes the fallback.

## Capabilities

Both nodes can enable **extended thinking**, routing to the stronger model with a larger reasoning budget, metered by usage rather than a flat credit.

The AI switch in prompt mode can also enable **web search**: it looks up the event's company before deciding. The query is built only from event fields such as company name or corporate email domain, **never from the reply text**, and costs one extra credit only when it returns results.

## The Ask AI branch

A condition node can ask the model directly. Pick **Ask AI (yes/no)** and write a question about the event ("Is this reply asking about pricing?"): yes takes the right path, no takes the bottom.

- Templated, so `{{.subject}}` and `{{.snippet}}` work inside it.
- One credit per evaluation, refunded if the provider call fails.
- **Fails safe**: if the model can't answer, you are out of credits, or the answer is ambiguous, the **no** path runs and the reason is recorded.
- Use an AI switch when you need more than two outcomes.

## Using the result downstream

Classify, extract, and generate write into the flow exactly like a **Set variables** step, so every later step can read them:

- **Conditions**: test the variable in an IF node (`ai_class equals interested`, `budget exists`).
- **Action text**: reference `{{.ai_class}}`, `{{.ai_text}}`, or `{{.your_key}}` in any templated field.

If two AI steps would both write `ai_class` or `ai_text`, set an **output variable name** on one so they do not overwrite each other.

## Cost, failures, and safety

| Topic | Behavior |
|-------|----------|
| Credits | Single-shot steps (classify, extract, generate) cost 1; the agent costs 1 per step taken; an AI switch costs 1 in AI mode, nothing in value mode. Provider failures refund automatically |
| Out of credits | The step fails with a clear message and the run continues down the normal path. Nothing is half-charged. Connect the **on error** branch for a specific fallback |
| Auto-pause | An automation whose AI steps keep failing for lack of credits is switched off, so it stops trying against an empty balance |
| Timing | Each step is bounded to a few seconds so a slow model never stalls the flow |
| Sending safety | **No AI step ever sends email or contacts anyone.** The agent takes only the reversible actions you enable; other modes only write a variable |

## Testing

**Test** dry-runs the flow, but AI steps and Ask AI branches run **for real** so you see actual output and the branch it drives, which spends credits. The agent reports what it would do without applying it. The trace panel shows each step's output beside its node. See [Testing and history](/guides/automations/).

## See also

- [Automations](/guides/automations/) for the builder, triggers, and conditions.
- [Sequences](/guides/sequences/) for the same two steps run per contact in campaigns.
- [AI credits](/guides/ai-credits/) for costs and balances.
- [Personalization and expressions](/guides/expressions/) for each trigger's variables.
