Skip to main content

How to create and train an AI Agent

Create an AI Agent in 2Chat, give it instructions and knowledge sources, train it and test it in the Playground.

With an AI Agent you can answer your customers automatically: sales questions, support, appointments or frequently asked questions. This article covers how to create an agent, add its knowledge, train it, test it and connect it to a channel.

Before you start

  • A 2Chat account with access to AI Agents.

  • The information the agent will answer with: your website, files, texts, questions and answers or your WhatsApp Catalog.

  • AI credits: each agent response uses credits, and the amount depends on the model you choose.

Step 1: Create the agent

  1. Go to AI Agents in the side menu.

  2. Click Create Your First Agent.

  3. Enter a name for your agent.

  4. Under Use Case, choose one: Customer support, Sales and lead generation, Appointment scheduling, Answer frequently asked questions or Other. This article uses Sales and lead generation.

  5. Click Create.

Use case options in the Create New Agent window

The agent starts with instructions written for the use case you chose. You can change the name and the use case later.

Step 2: Configure the instructions

In the Instructions tab, set how your agent behaves.

  • Provider and Model: the AI model that writes the answers. More capable models use more credits per response.

  • Creativity: use a lower value to reduce made-up answers.

  • Human handoff: the team that receives the chat when the agent hands it off to a person, for example when it can't give a good answer, when a condition in your instructions is met or when the customer asks for a human.

  • Instructions (System prompt): the personality, context and rules of your agent. Adapt the base text with your requirements and your business information.

Provider and model selection

When you finish, click Save.

Step 3: Add knowledge sources

  1. Open the Sources tab.

  2. Click Add Source.

  3. Choose the type of source. To use your website, choose Website.

  4. Enter the URL of your website and click Add.

Website source with the URL field

Types of sources

  • Website: 2Chat reads and indexes the pages of your site.

  • Files: PDF, DOCX or TXT documents.

  • Text: content you write yourself.

  • Q&A: questions with their answers.

  • WhatsApp Catalog: your products, so the agent can give better answers.

A website source shows Processing while its pages are read. This can take a few minutes, depending on the size of your site.

Step 4: Train and test your agent

  1. Go back to the Instructions tab.

  2. Once your instructions are saved and your sources are loaded, click Train.

  3. Wait while the status shows Training.

  4. When the status changes to Trained, write a message in the Playground to try your agent.

Playground with a test conversation

The Usage tab shows the credits your agent uses. In the Settings tab you can change its avatar, name and description, or delete it permanently.

Step 5: Connect your agent to a channel

Connect the agent to your phone numbers so it answers the messages they receive.

  1. Open the Channels tab of your agent.

  2. Click Connect A Channel.

  3. In Channel, select the number. It can be a WhatsApp Web or a WhatsApp API (WABA) channel.

  4. If you want to try it first, enter a number in Test number (optional). The flow only runs when that number writes. Leave it empty to reply to everyone.

  5. Click Connect.

Channel selection with an optional test number

Connecting the channel creates a 2Chat flow. Click Edit Flow to change it, or use the Live switch to turn it on or off.

Connected channel with the Live switch and the Edit Flow link

Your agent is now ready to be used in a 2Chat flow. You can also add it to your own flows with the Engage with AI component, so it can answer your customers when you are unavailable. See Flow component: Engage AI Agent.

Did this answer your question?