> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# RAG • AI Agent SDK

> PraisonAI RAG - Retrieval Augmented Generation Module.

# rag

<Badge color="blue">AI Agent</Badge>

PraisonAI RAG - Retrieval Augmented Generation Module.

This module provides a thin orchestration layer over Knowledge for RAG workflows.
Knowledge handles indexing/retrieval; RAG adds answer generation with citations.

Usage:
from praisonaiagents.rag import RAG, RAGConfig, RAGResult, Citation

# With existing Knowledge

rag = RAG(knowledge=my\_knowledge)
result = rag.query("What is the main finding?")
print(result.answer)
for citation in result.citations:
print(f"  \[\{citation.id}] \{citation.source}")

All imports are lazy to avoid performance impact when RAG is not used.

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import rag
```

### Constants

| Name            | Value                                                                                                                                                                                                         |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_LAZY_IMPORTS` | `{'Citation': ('praisonaiagents.rag.models', 'Citation'), 'ContextPack': ('praisonaiagents.rag.models', 'ContextPack'), 'RAGResult': ('praisonaiagents.rag.models', 'RAGResult'), 'RAGConfig': ('praisona...` |

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="RAG Concept" icon="magnifying-glass" href="/docs/concepts/rag" />

  <Card title="RAG Overview" icon="database" href="/docs/rag/overview" />

  <Card title="Chunking Strategies" icon="scissors" href="/docs/rag/strategies/overview" />
</CardGroup>
