The AI Agent element in chatbots

Accept marketing cookies to play this video or watch it on YouTube.

With the AI Agent element, you can incorporate AI into your chatbot flows to branch them based on user actions or goal completion and save data for personalized responses.

To give you an idea, you can analyze client needs and conversation tone, process user responses, guide your subscribers toward a purchase, and share personalized recommendations.

Let's talk about how to use the AI Agent element.

Add the element

Go to the flow builder and add the AI Agent element. You can place it anywhere in your flow, including the start, the middle, or the end.

Choose an agent

In the Use AI Agent list, choose how to set up the AI in this element:

Custom agent

Configure a new AI agent in this element, including its prompt, AI model, and exit conditions.

The following article explains how to configure this option.

A saved agent

Choose an agent you created in the AI Agents section, either from scratch or from a template.

Its settings come from the agent. To change a setting in this element only, hover over the field and click Edit. You can also add your own exit conditions and choose variables to save information.

Read more: Create and reuse AI agents in your chatbots.

Write bot instructions

In the Bot instructions field, enter a prompt outlining your company, products, or services. Define the response format and include examples of popular questions and desired answers. You can also add variables to personalize messages.

Your prompt can include business specifics, limitations, and communication style. You can instruct the AI to analyze customer intent and preferences and offer different options based on their responses. This will make chatbot interactions personalized and drive more results.

Here's how your chatbot can approach conversations based on customer tone:

  • If the customer is feeling positive, offer a bonus or special deal.
  • If their mood is neutral, offer helpful information.
  • If they seem upset, respond with empathy and offer assistance.

If you enable additional tools, such as web search, MCP servers, or file search, include instructions on when and how the agent should use them. Specify which tasks require these tools and what information the agent should retrieve.

For example, if your agent has access to a product catalog through an MCP server, instruct it to check product availability and prices before recommending items.

Configure the AI model

To customize the AI model, click its name next to the Bot instructions field and fill in the fields.

In Model, select an AI model to generate responses. In API key, decide how to authorize requests (inherit the token from your settings or use a dedicated token for this chatbot).

Optionally, you can add more tools to help your AI agent look up information outside the prompts. To enable a tool, turn on its toggle:

Web search Enable this tool to let your AI agent search the web for current information before it replies. Your AI provider bills search requests in addition to tokens.
MCP servers Enable this tool to connect your AI agent to external tools and data sources, such as your product catalog. Choose a server from the list or click Add a new MCP server.
File search Enable this tool to let your AI agent reply based on the files you upload, such as price lists or return policies.

After filling in all the fields in the modal window, click Save.

Select a step type

In the Step type field, select an element execution mode. Relevant settings will appear based on your selected type.

One-time execution

This mode is suitable for simple flows where your chatbot needs to generate and send a response immediately. For instance, it can calculate an expression or translate a piece of text.

In the Execution behavior field, select one of the following actions:

Send a reply from AI to the subscriber as a message Use this action to respond as soon as the user reaches this element.
Continue the flow without a response Use this action to pass data to the next element.
You can process the user's response and add it to your next Message element using the {{last_ai_response}}shortcode.

Conditional exit

This mode makes your chatbot wait until a specific goal is achieved within a set timeframe before the user exits the element and continues down the flow.

If another chatbot trigger is activated, the user will exit the AI Agent element, and the AI will stop waiting for a response.

In the When the block is triggered field, decide when to activate the AI.

The AI bot writes first Use this option to initiate chatbot conversations immediately, for example, to send a welcome message or offer to take a test.
Waiting for incoming message Use this option to make your chatbot wait for the first user message. This can help process requests or gather more information before starting an interaction.

In the Set goals as exit conditions field, define what constitutes a completed goal for the user to move to the next flow element. To add another goal, click Add condition. Each condition becomes a dedicated exit point of the element.

You can also add variables to create a dynamic goal. Every user will have a unique value based on variables available at the time they reach the AI Agent element.

This way, you can determine user needs and purchases they are ready to make. These goals help the AI understand user intent and offer relevant solutions.

Your AI model should understand which user intentions or actions to track and what data to collect and save.

To avoid false triggers, it's essential to use clear and specific data collection conditions and criteria. General and vague descriptions can lead to errors in the flow execution.

✅ Clear: "When the user shares a phone number in international format, or their phone number is already known."

❌ Too vague: "Phone number received."

Condition and variable description clarity determine your flow accuracy, so take the time to write them out and minimize the risk of false triggers.

To make your chatbot save specific user data points to a variable and use them in other flow elements, click Save data from user reply. In the first field, define the data to be retrieved from the user's response. In the second field, select a variable from your chatbot audience. To save more details, click Add data to save.

Describe the data you want to save as clearly as possible. Specifics help the AI find exactly what you're looking for and format it as intended.

Suppose a user chooses a product and delivery method. Here's how you can describe this:

✅ Clear: "Product names listed using commas, quantities shown in [square brackets]."
❌ Too vague: "Product."

✅ Clear: "Delivery address, including city, postal code (optional), street, and building."
❌ Too vague: "Delivery address."

When selecting variables, be mindful of their types. To save numbers that may need future updates, use the Number variable type. To record dates, select Date, and for text data, use String. Data will be automatically converted based on your variable's data type.

In the Maximum time in block field, set the time during which the element should remain active, up to 24 hours. Suppose you set it to 1 hour, and the user sends their first message after 59 minutes. In this case, they will exit the AI Agent element after 1 minute, and their next messages will no longer be processed by it.

In the Execution behavior upon exit condition trigger field, select one of the following actions:

Send a reply from AI to the subscriber as a message Use this action to respond as soon as the user reaches this element.
Continue the flow without a response Use this action to pass data to the next element.
You can process the user's response and add it to your next Message element using the {{last_ai_response}}shortcode.

Save the element

After filling in all the fields, click Apply to save your element settings.

To reuse the element's settings in other flows and chatbots, click Save as new agent. The agent will appear in the AI Agents section. You can also select it in the Use AI Agent list of any AI Agent element.

Continue your flow

Branch your flow using exit points to adapt it to user actions and make chatbot interactions more natural.

If the AI Agent element reaches its goal, use the green exit point to continue your flow. For example, when the user accepts an offer, shares their data, or signs up for a webinar, you can extend your flow using other elements to send a confirmation, offer product recommendations, or request payment.

If the waiting time expires and the user does not complete the target action, they will automatically reach the red exit point. This allows you to properly move on from the current step or send a notification to re-engage the user.

Flow branching helps your chatbot account for user actions and adjust your flow to the conversation context.

Next, add elements to every flow branch. For instance, if the user wants to sign up for a demo and you've saved this information, you can send them a confirmation message and add a tag using an action. To personalize this conversation, add a filter and set its conditions.

Optionally, add another AI Agent element to clarify the user's queries or offer multiple options based on their request. You can also send an API request or integrate with Google Sheets to check product availability or status. Use variables to add external data points to your prompts and deliver them to users seamlessly.

Test your flow

To see your flow in action, click Save and send to yourself in the upper right corner of the builder. To share your flow, exit the builder, click the three dots under your flow name, and select Link to launch a flow.

You may need to reset your conversation context to test condition triggers. To do this, unsubscribe from your chatbot using the /stop command and resubscribe using the /start command.

Monitor user status

To track subscribers who have exited or are still in the AI Agent element, switch to flow view mode and click the number at the bottom of the element.

When chatting with a subscriber, you can pause flows that include the AI Agent element to prevent them from interrupting conversations.

Rate this article about

"The AI Agent element in chatbots"

User Rating: 5 / 5 (22)

Previous

The Condition element in chatbots

Next

The API Request element in chatbots

Create your own chatbot today