How do I use an AI agent to reply in an automation?
Add the Ask the AI step to your automation so an AI agent from your workspace reads the latest contact message and writes a reply. The reply lands in the {{aiReply}} variable, and the next message step (WhatsApp, email or SMS) is what sends it — the AI never sends anything by itself. If the AI fails or the contact has not written anything yet, the variable stays empty and the automation continues as usual.
Role: any member with edit access in the workspace.
Before you start
- A published AI agent in Settings → Account Center → My agents — see how to create an AI agent with your own key. The provider key (OpenAI or Anthropic) and the model come from the agent; usage is billed by the provider, on the key's account — it does not consume platform credits.
- The automation needs a contact message for the AI to answer: place the step after a WhatsApp step with Wait for reply on, or in an automation triggered by an incoming message (WhatsApp, Instagram, Telegram).
Step by step
- On the automation canvas, click + after the step that receives the contact message and, in the Integrations section, pick Ask the AI.
- In AI agent, choose a published agent from the workspace. Only Active agents are listed; if the list is empty, publish an agent in My agents first.
- In Instructions for the AI, write how it should reply (for example: "Reply as the store assistant, in up to two sentences, and offer help"). The agent persona complements the instructions, but the step instructions rule the format and limits.
- Add a message step next (WhatsApp, email or SMS) and insert the aiReply variable in the text — it shows up in the composer variable list, under the Ask the AI group.
- Save and activate the automation.
How it works at runtime
- The contact writes to the automation (a reply to a previous step, or the message that fired the trigger).
- The agent receives your instructions and the contact message, and replies in free text.
- The reply is stored in
{{aiReply}}and the next step sends it like any other variable.
If the agent is paused, in draft or was deleted, its key is invalid, the provider does not answer in time or there is no contact message, {{aiReply}} stays empty and the automation continues. A message containing only {{aiReply}} would go out blank in that case — combine the variable with fixed text, or use a condition step to handle the empty value.
Limits and notes
- Only the latest contact message goes into the question; the conversation history is not sent.
- One Ask the AI step per stretch: a second step overwrites
{{aiReply}}with the new reply. - Instructions up to 4,000 characters; replies up to a few hundred words.
- Pausing or deleting the agent makes the canvas flag the step so you publish or replace the agent; until then, the variable stays empty.
- You can inspect the value of
{{aiReply}}for each run in Execution data.
Related pages
- Create an AI agent with your own key — register the key, choose the model and publish the agent used by this step.
- How do I branch by what the contact wrote? — text branching, without AI.
- How do I see the data and variables of a run?