> For the complete documentation index, see [llms.txt](https://vibemx.gitbook.io/neuronai-studio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vibemx.gitbook.io/neuronai-studio/knowledge-bases/agent-binding.md).

# Agent Binding

Agents do **not** auto-attach a knowledge base. Connect retrieval explicitly with a RAG tool or a workflow RAG node.

## RAG tool (`KnowledgeBaseTool`)

1. Create a tool: **Tools** → **Create**, choose kind **RAG** (`?kind=rag`).
2. Select the **knowledge base**, optional `top_k` / `threshold`.
3. Bind the tool to an agent (agent editor → tool bindings).
4. Open the Playground — the model can call the tool with a `query` string.

The tool resolves via `ToolDefinition.type === 'rag'` and returns source-prefixed chunks, or a clear message when nothing matches.

| Need                                   | Use                                                       |
| -------------------------------------- | --------------------------------------------------------- |
| Agent decides when to search           | RAG tool                                                  |
| Always inject context before the agent | [RAG node](/neuronai-studio/knowledge-bases/retrieval.md) |

## Template: RAG Knowledge Q\&A

Install workflow template `rag-knowledge-qna` (and agent `knowledge-agent`):

1. **Templates** → use **RAG Knowledge Q\&A**
2. Open the RAG node → select your knowledge base
3. Run the workflow — the agent prompt uses `{{ rag_context.context }}`

Related: `support-rag-hitl` and `dev-support-memory-loop` also include RAG nodes.

## Quick checklist

* [ ] Knowledge base created and documents `completed`
* [ ] Retrieval preview returns sensible chunks
* [ ] Either RAG tool bound to the agent **or** RAG node wired in the graph
* [ ] Agent instructions tell the model to use retrieved context / the search tool

See also: [Tools Overview](/neuronai-studio/tools/overview.md#rag-knowledge-base-tool) · [Templates](/neuronai-studio/workflows/templates.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 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://vibemx.gitbook.io/neuronai-studio/knowledge-bases/agent-binding.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.
