> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform-resources/skill-library/data-skills-rag/rag-query.md).

# RAG Query

**RAG Query** asks a question against a private knowledge base — a RAG Container — and generates an answer grounded in what it finds there. It retrieves the relevant material first, then answers from it.

A general LLM knows what it was trained on. This is how an agent answers from your credit policy instead.

{% hint style="info" %}
**Reference layer pending.** This page documents the skill's purpose and configuration as used in the builder. Its formal configuration schema, output schema, and error codes are not yet documented — see the [Skill Library](/platform-resources/skill-library.md) overview.
{% endhint %}

## Worked example: answering advisors' policy questions

Financial advisors need quick answers about internal lending policy. Rather than searching long technical documents, they ask the agent: *"What is our policy on SBLOC loans for new businesses?"*

**The problem.** The policy documents are far too long to put in a single prompt, and a keyword search doesn't understand what the advisor is actually asking.

**The approach.** Send the question to a RAG Container pre-loaded with the policy documents. The skill finds the relevant sections and uses them to generate a policy-based answer.

**1. Choose the knowledge base.** Select the container holding your policy documents from the **RAG Container ID** dropdown.

**2. Write the instruction.** **Instruction to LLM** sets the role:

> You are a helpful and knowledgeable financial policy assistant. Provide clear and concise answers based on the provided context.

**3. Set the query.** Point **Query** at the advisor's question — `$input.userQuestion`.

**4. Filter (optional).** **Filters** takes a stringified JSON object that narrows the search before retrieval: `{"loan_type": "SBLOC"}` searches only documents tagged for that loan type. Narrowing the haystack usually beats improving the needle.

## Advanced configuration

| Setting                       | What it does                                                                                                                      |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Response Format**           | Text, or a structured JSON object for use by later skills.                                                                        |
| **Temperature**               | Controls creativity. **Lower values (around `0.2`) are better for factual, grounded answers** — which is the entire point of RAG. |
| **Num of Conversation Turns** | Lets the model consider previous messages for conversational context.                                                             |

## Output

* **`content`** — the generated answer, as text or JSON.
* **`statusCode`** — `200` success · `400` bad request · `500` internal error.

***

For how retrieval works and why, see [Knowledge & Context](/core-concepts/knowledge-and-context.md). To configure ingestion, see [RAG Knowledge Pipeline](/agent-builder/build/rag-knowledge-pipeline.md). To add this skill to an agent, see [Adding a Skill to the Agent](/agent-builder/build/adding-a-skill-to-the-agent.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://docs.uptiq.ai/platform-resources/skill-library/data-skills-rag/rag-query.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.
