# Linking a Knowledge Base to an Agent

Creating a Knowledge Base is only the first step — to make it functional, you need to **link** it to an Agent or Squad.\
This connection is established through the **Knowledge Tool**, available inside each Agent’s configuration.

***

### 🧠 How Linking Works

Every Agent has its own list of **Tools**.\
When you add the **Knowledge Tool**, you can choose which Knowledge Bases that Agent will use as reference sources.

An Agent can:

* Use **multiple Knowledge Bases** simultaneously.
* Share the **same Knowledge Base** with other Agents or Squads.
* Retrieve relevant data dynamically based on context.

This flexibility allows you to build complex ecosystems where shared information powers multiple intelligent Agents.

***

### ⚙️ Linking a Knowledge Base

1. Go to **Builder → Agents → \[Select your Agent] → Tools**
2. Click **Add Tool +**
3. Choose the **Knowledge Tool** from the list
4. In the configuration window:
   * Select one or more **Knowledge Bases** to link
   * Adjust retrieval parameters (if available)
   * Save changes

Once linked, the Agent will automatically begin using the data for contextual reasoning and responses.

***

### 🧩 Linking to a Squad

When Agents belong to a **Squad**, any Knowledge Base connected to those Agents via the Knowledge Tool becomes available to the entire Squad context.\
This enables shared knowledge environments for teams of Agents collaborating on the same workflow.

***

### 💬 Example Scenario

**Knowledge Base:** *Zaia Commercial Knowledge*\
**Linked via:** *Knowledge Tool*\
**Used by:**

* Agent Ju da Zaia → Handles customer inquiries
* Agent Alfred → Builds custom workflows
* Squad da Zaia → Combines both agents in collaborative operations

All three entities reference the same Knowledge Base.\
If the base is updated or retrained, the changes immediately propagate to all Agents and Squads that use it.

***

### 🧭 Best Practices

* **Keep one source of truth.** Reuse Knowledge Bases across Agents when possible.
* **Modularize content.** Create separate bases for topics like Sales, Product, and Support.
* **Test context boundaries.** Ensure Agents are not over-retrieving from unrelated sources.
* **Monitor performance.** Retrain or clean content periodically for consistency.


---

# Agent Instructions: 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:

```
GET https://docs.zaia.app/knowledge-bases/linking-a-knowledge-base-to-an-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
