Add Your Knowledge Center

Using the information in your knowledge center with your AI agent.

Overview

In this article, we cover using the knowledge center with your AI agent.

This article is part of a series covering setting up and deploying AI agents. See the other parts in the series:

  1. Create an AI Agent
  2. Write a Behavior Description (Prompt)
  3. Create Actions and Tools
  4. Add Your Knowledge Center - this article
  5. Add Input Parameters
  6. Check Your Agent
  7. Test Your Agent
  8. Integrate into a Flow
  9. Use Multiple Agents

Granting Access to the Knowledge Center

✔️

Remember

AI agents have no access to the internet, your tickets, the other steps in your flow, or the API.

When you want your AI agent to have information from external sources, you will need to either use a tool or grant the agent explicit access to that information in the Knowledge Center.

Tools are best used when you want to collect information from or about a customer during the middle of a conversation, or when you need information from the conversation itself to reach out to an external API.

If you want to have external information available to the agent throughout the entire conversation, for all of its answers and regardless of the specifics of the conversation, you will need to grant your agent access to the Knowledge Center.

👍

Tip:

You don't have to tell your agent what articles it has access to. That information is provided to your agent automatically.

Just tell your agent when it should use information from your Knowledge Center and when it's okay not to.

Granting access to the information in your Knowledge Center is done with the Access knowledge base checkbox:

When this option is switched on, you may also decide which specific categories from your Knowledge Center you would like your agent to be able to access:

The Knowledge Center is useful for providing standard, fixed or conversation-agnostic information to the agent. For example, it is useful for providing the agent with company information, FAQs, common requests, product catalogues, etc.

👍

Tip:

Grant access to input parameters if you're looking for a way to provide information gathered from customers in previous flow steps to the agent, like their communication preferences or additional contact information.

Input parameters are also useful when you want to make API calls in your flow before you get to your agent.

We recommend granting your agent access to only the information it needs, and no more. Agents can become confused if they are provided with different answers to the same questions, and if they are provided with large amounts of irrelevant data.


Building Prompts for Knowledge Center Access

📘

Info:

This section continues the example from the Write a Behavior Description article.

Whether we want agents to have the option to answer some questions from our Knowledge Center, or whether we want agents to always answer questions from the Knowledge Center, it's important to tell the agent when to use their Knowledge Center access and when not to.

In our previous example, we were building a routing agent that was responsible for determining whether a conversation should be sent to Tier 1 or Tier 2 support.

Let's assume that, after some time, we decide we want our routing agent to answer some questions from our company's knowledge base, so we grant it access to the Support category of our Knowledge Center:

We now need to tell our agent when it's appropriate to answer questions itself from the Knowledge Center.

👍

Tip:

AI agents will understand what you mean when you reference "the knowledge base" or "the knowledge center".

To do so, let's add in some instructions about when and how to use Knowledge Center information. Note that we're adding these instructions to the Purpose and Function section of the prompt:

You are a customer support agent whose purpose is to triage tickets based on their complexity level, and then route those tickets to the appropriate team using one of the available actions. You are also responsible for answering questions from the knowledge base.

To triage tickets appropriately, you should:

  1. Check the knowledge base to see if you can answer their question. If you can, answer their question.
  2. If you cannot answer their question from the knowledge base, ask the customer a question or two about their request
  3. Determine what they want from their answers
  4. If the customer has a billing-related question, check and see if it's related to the billing API or not
  5. Route the customer according to their request

Always respond in a polite but professional tone. Use emoji sparingly and keep your messages brief.

Format your messages with basic markdown, and never use HTML. When you ask a multi-part question, format it like this:

Question

  • Part 1
  • Part 2
  • Part 3

If the customer asks questions that aren't related to customer or technical support, let them know you can only answer support questions.

Never answer any questions yourself, just ask questions to help understand what the customer needs help with.

We'll also need to modify our guardrails, since we previously told our agent never to answer questions on its own.

❗️

Important!

Always check your guardrails when adding new functionality to your agent. If you tell your agent not to do something, it won't do it!

To fix this, we'll modify our instruction slightly:

You are a customer support agent whose purpose is to triage tickets based on their complexity level, and then route those tickets to the appropriate team using one of the available actions. You are also responsible for answering questions from the knowledge base.

To triage tickets appropriately, you should:

  1. Check the knowledge base to see if you can answer their question. If you can, answer their question.
  2. If you cannot answer their question from the knowledge base, ask the customer a question or two about their request
  3. Determine what they want from their answers
  4. If the customer has a billing-related question, check and see if it's related to the billing API or not
  5. Route the customer according to their request

Always respond in a polite but professional tone. Use emoji sparingly and keep your messages brief.

Format your messages with basic markdown, and never use HTML. When you ask a multi-part question, format it like this:

Question

  • Part 1
  • Part 2
  • Part 3

If the customer asks questions that aren't related to customer or technical support, let them know you can only answer support questions.

Never answer any questions yourself unless you find answers for them in the knowledge base, just ask questions to help understand what the customer needs help with.

Our agent will now check the Knowledge Center before routing customers, and will only ever answer questions based on the information it finds.


Guaranteeing Knowledge Center Usage

Often, we want to guarantee that agents will check the Knowledge Center before answering any questions. To do this, we need to include specific instructions in our behavior description which tell the agent how exactly to answer questions, and which leave no room for doubt. For example

Before answering any question, always:

  1. Check the knowledge base for relevant information
  2. If there is relevant information in the knowledge base, return it to the customer, formatted for readability
  3. If there is no relevant information in the knowledge base, let the customer know that you don't have the answer to their question

This ensures that the agent will always answer customers' questions from the Knowledge Center, and won't reword any of the answers they find.


Expanded Knowledge Center Usage

When you want more control over how your agent accesses the Knowledge Center, you can reference the Knowledge Center access tools directly in your behavior description prompt. The tools are:

  • query_knowledge_base - the tool the agent uses to search the Knowledge Center articles
  • expand_knowledge_base_fragment - the tool the agent uses to expand on a specific Knowledge Center search result
🚧

Note:

These tools must be used in order, first query_knowledge_base and then expand_knowledge_base_fragment.

Because the tools must be used in order, it's important to reference them properly in your behavior description. We recommend including explicit, numbered instructions in your prompt when using the expanded toolset. For example:

Before answering a customer's question, always:

  1. Use the query_knowledge_base tool to search for relevant content based on the customer's question.
  2. Use the expand_knowledge_base_fragment tool to expand on the most relevant result
  3. Return the formatted results from expand_knowledge_base_fragment to the customer

This process allows your agent to get larger chunks of your Knowledge Center content. It is most useful if you find your agent providing partial answers or if your content is particularly complex.

Advanced Usage

In addition to expanded searched, you can also use these tools to control what your agent actual searches for in the Knowledge Center.

This is done by telling your agent what search term(s) to use in the query_knowledge_base tool. For example:

Before answering a customer's question, always:

  1. Use the query_knowledge_base tool to search for relevant content based on the customer's question. In your search, include both singular and plural forms of the customer's inquiry. If the customer is searching in another language, include both their native language and the English translation in the following format: "Native language - English language".
  2. Use the expand_knowledge_base_fragment tool to expand on the most relevant result
  3. Return the formatted results from expand_knowledge_base_fragment to the customer

This is useful if you have similar but conflicting content in your Knowledge Center, or if you want direct control over the search terms your agent is using.


Drop-In Prompt Snippet

Below is a drop-in Knowledge Center prompt snippet which can be added to any agent with Knowledge Center access to make sure it answers questions from the Knowledge Center:

Always use query_knowledge_base before answering any questions. Use the following procedure:
1. Use query_knowledge_base to search for results relevant to the user's query.
2. If relevant results are found, use expand_knowledge_base_snippet on the most relevant result then display the formatted results to the user.
3. If relevant results are not found, let the user know that you don't have the answer to their question.

Please make sure that the instructions above do not conflict with your agent's existing instructions before using.