> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trypopcorn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect knowledge to an agent

> Give an agent access to knowledge folders, publish the change, test it, and confirm which articles the agent actually uses.

An agent only answers from the folders it has been given access to. Use this page after you have published articles and want an agent to start using them, or when you want to check whether an agent is really reading a folder.

## Before you start

* The articles you want the agent to use are published. Drafts are never used, whatever folders are connected.
* You know which agent handles the conversations in question. Each agent has its own folder access; see [Agents overview](https://docs.trypopcorn.ai/agents/overview.md).

## Connect folders to an agent

**1. Open the agent**

Click **Agent** in the sidebar and open the agent.

**2. Turn folders on**

Open the **Knowledge** tab. The **Knowledge base** panel ("The agent answers from the knowledge bases you turn on.") lists every folder with its description and a switch. Turn on each folder the agent should search. If you have none yet, **New knowledge base** takes you to **Knowledge** to create one; once you have some, **Manage knowledge** does the same.

**3. Save and publish**

Click **Save and review**, then **Publish changes** in the dialog. Connecting a folder is part of the agent's draft: until you publish, live conversations keep the previous setup. See [Test and publish](https://docs.trypopcorn.ai/agents/test-and-publish.md) for what publishing offers.

> [!NOTE]
>
> The same thing has two names in the app. On **Knowledge** it is a **folder**; on the agent's **Knowledge** tab it is a **knowledge base**. Both mean one group of articles.

At the top of the same tab, **What it knows** says whether Popcorn's nightly check has questions for you about this agent's Knowledge (***N* questions** or **Up to date**), with **Review** or **Open Knowledge**. See [Review what your agent learned](https://docs.trypopcorn.ai/knowledge/knowledge-check.md).

Turn a folder off and publish again to stop the agent using it. Deleting a folder on **Knowledge** deletes its articles, so any agent still connected to it finds nothing there.

## How the agent uses connected folders

* The agent gets one search per connected folder. The folder's description is what tells it which folder fits a question, so a folder called *Policies* with the description *Return, exchange, refund and warranty rules* is far more useful than one called *Misc* with no description.
* The agent takes a folder's name and description when you save the agent. If you rename a folder or rewrite its description later, the agent picks up the new wording the next time you save the agent with **Save and review** and publish it.
* A search returns the best-matching passages from that folder's published articles, and the agent writes its reply from them.
* The agent decides on every message whether to search at all. An agent on Popcorn's rules is told to search Knowledge before it answers a question about your store, and to offer your team when nothing covers a point instead of guessing. On an agent with custom instructions, your instructions decide; see [Writing custom instructions](https://docs.trypopcorn.ai/agents/writing-instructions.md).

## Test it

**1. Publish first**

The test chat talks to the published version of the agent, so publish the connection before you test it.

**2. Ask a question**

In the **Test your agent** panel (from 1280 pixels wide) or the **Test agent** dialog, ask a question an article answers, in the words a customer would use. Under the reply, **Searched the knowledge base** shows that the agent looked in your folders.

**3. Check the reply**

The reply should match the published text. If it does not, work through [Troubleshooting](https://docs.trypopcorn.ai/knowledge/troubleshooting.md).

**4. Look at the sources**

Chats from the agent page are real conversations, so open yours in the Inbox. Under the AI reply, **Searched the knowledge base** has a **Sources (*N*)** button when specific articles were cited. It opens **Message source**: **Tool used** names the search the agent ran, and **Knowledge used** links each **Article** it cited, with the version that was live (for example **v3**). If the agent searched but cited no specific article, the button reads **Details** and **Knowledge used** links to the folder that was searched.

## Confirm articles are being used

On **Knowledge**, the **Used by agent** column shows a badge for every article the agent matched in the last 30 days. Open an article and look at **Details** for the figures:

| You see | What it tells you |
| - | - |
| **Not used yet** | No search has returned this article in the last 30 days. Either no customer asked about it, its folder is not connected to the agent handling those chats, or the article is still a draft. |
| **Matched *N* times** | Searches returned the article, but the agent has not yet written a reply from it. |
| **Cited *N* times · last used *time*** | The agent used it in replies. |

Click either figure to open **Recent conversations**. Each entry has an **Open conversation** link to read how the article was used, and conversations where it was cited carry a **Cited** tag.

The same **Sources (*N*)** button appears on live customer conversations in the Inbox, for WhatsApp and Website chat alike, so you can audit real answers the same way. See [Working with conversations](https://docs.trypopcorn.ai/inbox/working-conversations.md).

## Several agents, different knowledge

Folders are the way to give agents different knowledge. A sales agent on Website chat can have *Products and sizing* and *Delivery*; a support agent on WhatsApp can add *Returns* and *Warranty*. Each agent searches only its own folders, and an article is used by every agent whose folders include it.

## Related

> [card] [Create folders and articles](https://docs.trypopcorn.ai/knowledge/writing-articles.md)
>
> Write, import and publish the articles the agent will use.

> [card] [Knowledge, tools, channels and notifications](https://docs.trypopcorn.ai/agents/connect-knowledge-tools-channels.md)
>
> Everything else you connect on the agent page.

> [card] [Test and publish](https://docs.trypopcorn.ai/agents/test-and-publish.md)
>
> Drafts, publishing scope and version history for agents.

> [card] [Custom tools](https://docs.trypopcorn.ai/tools/overview.md)
>
> For answers that need a live lookup in another system.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.