> For the complete documentation index, see [llms.txt](https://docs.agentalk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentalk.io/knowledge-base/set-up-a-knowledge-base.md).

# Set up a knowledge base

A knowledge base lets your agent search and retrieve information during a call. It uses retrieval-augmented generation (RAG) with semantic search and embeddings hosted on Agentalk.

When a caller asks a question, the agent searches the knowledge base for the most relevant passage and uses it to answer.

### When to use a knowledge base

Use a knowledge base when your agent needs to answer questions from a large body of content that would be impractical to include in the instructions directly.

Typical use cases include:

* Product catalogs with many items
* Technical documentation with detailed specifications
* Dense documents such as policies, manuals, or service agreements

The knowledge base is optional. Simple workflows like sales scripts or appointment booking usually don’t require one. The deciding factor is content volume, not company size.

### Before you start

You need the following before you begin:

* Content ready to upload or link.
* Supported sources include PDF, Markdown, plain text, website URLs, sitemaps, and Notion.

{% hint style="info" %} <mark style="color:$info;">**Supported content and limits**</mark>\
File size limits, number of sources, and supported formats may vary depending on your plan.
{% endhint %}

{% stepper %}
{% step %}

### Create a new knowledge base

Start by creating a knowledge base and defining its basic information.

1. Go to **Knowledge base** in the left navigation.
2. Click **+ Create First** **knowledge base.**
3. Enter the required details:
   * **Knowledge Base Name**: Use a descriptive name, for example `Product Catalog 2024` or `Support Documentation`
   * **Description**: Add a short summary of what the knowledge base contains.<br>

     <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><mark style="color:$info;"><strong>Auto refresh</strong></mark><br>Enable this option if your sources are expected to change over time. The knowledge base will update automatically when the source content is updated.</p></div>
4. Click **+** **Create Knowledge Base.**

<figure><img src="/files/luDePNo1DRkp49H7CSh0" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add content

After creating the knowledge base, add content from one or more sources.

#### Upload files

Use this option to upload documents such as PDFs or Markdown files.

1. Drag and drop your file or click **Select files**.
2. Locate and upload files (up to 40MB).
3. Click **Upload and add to knowledge base**.

Use this for structured content like manuals, policies, or documentation.

#### Manual text addition

Use this option to quickly add text without uploading a file.

1. Paste or type your content into the text field.
2. Click **Add text**.

Use this for short content, FAQs, or quick updates.

#### Import from website

Use this option to import content from a website using a sitemap.

1. Enter the sitemap URL.
2. (Optional) Add filters to include or exclude specific pages.
3. Click **Analyze Sitemap**.\
   The system shows how many pages match your filters, including included and excluded URLs.
4. Click **Add content from website**.

Use this when your content is already published online.

<figure><img src="/files/fTP0fGyLWsKd5VSQMw1h" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Train the knowledge base

Once your content is added, train the knowledge base so it becomes searchable.

1. Click **Start training** at the top of the page.

<figure><img src="/files/z7edN131rYvkC6S4en9x" alt=""><figcaption></figcaption></figure>

Agentalk processes your content and makes it available to your agent.

Training time depends on the amount of content. Wait until processing is complete before using the knowledge base.
{% endstep %}
{% endstepper %}

### Next steps

Here are the recommended next steps after completing this guide:

* [**Connect a knowledge base to an agent**](/knowledge-base/connect-a-knowledge-base-to-an-agent.md): Link your knowledge base so the agent can use it during live calls.
* [**Write effective agent instructions**](/ai-agents/write-effective-agent-instructions.md): Guide how the agent uses knowledge base responses in conversations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.agentalk.io/knowledge-base/set-up-a-knowledge-base.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
