> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/en/build/knowledge-base.md).

# Knowledge Base

What is a knowledge base: the data source for Agents answering company-specific questions, supported content (documents, FAQs, web pages), how it differs from a database, and how to create one.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-62364526efff5f143857970f6f8ccfb6fd96d246%2Fknowledge-base-infographic.png?alt=media" alt="Knowledge base concept"><figcaption><p>Knowledge base RAG workflow: from document upload to Agent retrieval and responses</p></figcaption></figure>

## What Is It? <a href="#what-is-this" id="what-is-this"></a>

A knowledge base is an Agent's encyclopedia of company knowledge. Add your company's documents, FAQs, and web page content, and the Agent can use this information to answer users' questions.

Without a knowledge base, an Agent can only respond using the language model's general knowledge. With a knowledge base, it can answer company-specific questions such as “What is our company's return policy?”

## What Can You Add to a Knowledge Base? <a href="#what-can-go-in-knowledge-base" id="what-can-go-in-knowledge-base"></a>

| Data Type            | Description                                   | Suitable Scenarios                                     |
| -------------------- | --------------------------------------------- | ------------------------------------------------------ |
| **Document uploads** | PDF, Word, Excel, TXT, etc.                   | Product manuals, internal policies, contract templates |
| **FAQ**              | Question-and-answer pairs                     | Frequently asked questions, standard responses         |
| **Crawler imports**  | Automatically retrieve content from web pages | Company website information, public data               |

## How Does It Differ from a Database? <a href="#knowledge-base-vs-database" id="knowledge-base-vs-database"></a>

This is the most frequently asked question:

|                        | Knowledge Base                                        | Database                                             |
| ---------------------- | ----------------------------------------------------- | ---------------------------------------------------- |
| **Data format**        | Unstructured (documents, articles, FAQs)              | Structured (tables, fields, numbers)                 |
| **Query method**       | Semantic search (“What is the return policy?”)        | SQL queries (“What was last month's revenue?”)       |
| **Suitable questions** | Knowledge questions, policies, operating instructions | Data queries, statistical analysis, real-time status |

**A simple rule**: If the answer is in a “document,” use a knowledge base. If it is in a “report,” use a database.

> **Technical details**: Knowledge bases use RAG (Retrieval-Augmented Generation). Uploaded documents are split into passages and converted into vectors. When a user asks a question, the system finds the most relevant passages and provides them to the Agent as the basis for its response.

## What Do I Need to Do? <a href="#what-do-i-need-to-do" id="what-do-i-need-to-do"></a>

1. **Create a knowledge base** — Name it and select an Embedding model
2. **Import data** — Upload documents, create FAQs, or retrieve content with the crawler
3. **Test searches** — Use sample questions to test whether the knowledge base can find the correct answers
4. **Attach it to an Agent** — Link this knowledge base in the Agent settings

## Further Reading <a href="#further-reading" id="further-reading"></a>

* [Knowledge Base Overview](/maiagent-user-guide/en/build/knowledge-base/km.md)
* [How to Create a Knowledge Base: Basic Settings](/maiagent-user-guide/en/build/knowledge-base/km-basic-settings.md)
* [How to Create FAQs](/maiagent-user-guide/en/build/knowledge-base/faq.md)
* [Document Management: Tags and Metadata](/maiagent-user-guide/en/build/knowledge-base/tags-and-metadata.md)
* [Search Testing](/maiagent-user-guide/en/build/knowledge-base/test-search-result.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/maiagent-user-guide/en/build/knowledge-base.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
