Skip to main content

RAG Search Component

Use the RAG Search component to fetch relevant pieces of information that your agent previously stored using the RAG Remember component. It enables smart memory recall across documents, notes, messages, or any other text-based content.

Why this matters

RAG Search allows your agent to tap into memory — just like a real assistant. It surfaces the most relevant content chunks based on vector similarity, enabling accurate, fast lookups without re-indexing.

What You’ll Configure

Namespace

FieldRequired?Description
NamespaceYesThis defines which "memory bucket" to search in. It must match the one used during indexing with RAG Remember.
TIP

Think of namespaces like folders — your agent will only search inside the one you point it to.

Results Count

FieldRequired?Description
Results CountNoSet how many top results to return (usually 3–5 is ideal). Helps control what gets passed downstream.

Include Metadata

FieldRequired?Description
Include MetadataNoIncludes source info like document name, section number, author, etc.—only if metadata was added during indexing.
INFO

If no metadata was stored with the document originally, enabling this will have no effect.

Inputs

Query

FieldRequired?Description
QueryYesThis is the question or phrase your agent uses to search memory. Can be natural language, keywords, or anything meaningful.
INFO

Use clear, concise questions like “What’s the refund policy?” instead of vague terms like “refund.”

Outputs

Results

OutputDescription
ResultsReturns an array of relevant content. Each item includes:
- text: the matched content
- score: relevance score (optional)
- metadata: original doc info (if enabled)
How to use it

Send Results into a GenAI LLM block to summarize, explain, or convert it into a user-facing message. Or use conditionals to route based on the result’s metadata.

INFO

This component only emits one output field: Results. Custom outputs aren't supported.

Real-World Example: Internal Policy Lookup

Let’s say your agent acts as a company helpdesk. You’ve previously indexed HR and policy documents under the namespace company_docs.

Now your agent needs to answer a user query like:

“How do I process a customer refund?”

Your RAG Search Configuration

SettingValue
Namespacecompany_docs
Results Count3
Include MetadataYes

Example Query

FieldValue
QuerySteps for processing a refund

Output Example

[
{
"text": "Refunds must be processed through the billing portal within 7 days of the original transaction.",
"score": 0.94,
"metadata": {
"document": "RefundPolicy2024.pdf",
"section": "2.1"
}
}
]

Now your agent can forward this text to a downstream LLM component to format it as a human-readable response.

Real-World Example: Internal Policy Lookup

Consider an enterprise helpdesk agent built with SmythOS. You’ve previously stored internal documents (HR policies, refund terms, tech protocols) using the RAG Remember component under the namespace company_docs.

Now, you want your agent to intelligently retrieve responses when users ask questions like:

  • "How many days of paid leave do I get?"
  • "What’s the process for refunding a customer?"

Setup

  • Namespace: company_docs
  • Results Count: 3
  • Include Metadata: Enabled (to show document name and version)

Input

FieldValue
Query"Steps for processing a refund"

Output Sample

[
{
"text": "Refunds must be processed through the billing portal within 7 days of the original transaction.",
"score": 0.94,
"metadata": {
"document": "RefundPolicy2024.pdf",
"section": "2.1"
}
},
]
Tip
Use domain-specific namespaces like hr_docs, finance_2024, or support_guides to keep memory modular and manageable.

Best Practices

  • Keep your namespace naming consistent across components
  • Ask precise questions in the query field — just like you'd Google something
  • Stick to 3–5 results max unless you want a broader recall
  • Always include metadata when you want traceability or audit context
  • Use RAG Search before LLM generation to reduce hallucination and boost accuracy

What to Try Next

  • Feed Results into a GenAI LLM for summarization
  • Index new documents with RAG Remember for future retrieval
  • Use metadata to filter or route results programmatically
TIP

Chaining RAG Search + GenAI LLM is one of the most effective ways to create grounded, reliable agents in SmythOS.