> ## 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.

# Auto RAG Agent • AI Agent SDK

> AutoRagAgent: Agent wrapper with automatic RAG retrieval decision.

# AutoRagAgent

> Defined in the [**Auto RAG Agent**](../modules/auto_rag_agent) module.

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

Agent wrapper with automatic RAG retrieval decision.

Decides when to perform retrieval based on policy and heuristics,
then composes RAG context with Agent chat.

This follows the same pattern as AutoAgents but for RAG:

* AutoAgents: auto-generates agent configs from instructions
* AutoRagAgent: auto-decides when to retrieve context

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph LR
    input["Input Data"] --> agent["Agent: AutoRagAgent"]
    agent --> output["Output Result"]
    style agent fill:#8B0000,color:#fff
    style input fill:#8B0000,color:#fff
    style output fill:#8B0000,color:#fff
```

## Constructor

<ParamField query="agent" type="Agent" required={true}>
  No description available.
</ParamField>

<ParamField query="rag" type="Optional" required={false}>
  No description available.
</ParamField>

<ParamField query="config" type="Optional" required={false}>
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="rag()" icon="function" href="../functions/AutoRagAgent-rag">
    Lazy load RAG from agent if not provided.
  </Card>

  <Card title="name()" icon="function" href="../functions/AutoRagAgent-name">
    Delegate name to wrapped agent.
  </Card>

  <Card title="chat()" icon="function" href="../functions/AutoRagAgent-chat">
    Chat with automatic RAG retrieval decision.
  </Card>

  <Card title="achat()" icon="function" href="../functions/AutoRagAgent-achat">
    Async version of chat.
  </Card>
</CardGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, AutoRagAgent
    
    agent = Agent(
        name="Research Assistant",
        knowledge=["docs/manual.pdf"],
    )
    
    auto_rag = AutoRagAgent(agent=agent)
    
    # Auto mode - decides based on query
    result = auto_rag.chat("What are the key findings?")
    
    # Force retrieval
    result = auto_rag.chat("Hello", force_retrieval=True)
    
    # Skip retrieval
    result = auto_rag.chat("What is 2+2?", skip_retrieval=True)
```

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agents/auto_rag_agent.py#L105">
  `praisonaiagents/agents/auto_rag_agent.py` at line 105
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Agents Concept" icon="robot" href="/docs/concepts/agents" />

  <Card title="Single Agent Guide" icon="book-open" href="/docs/guides/single-agent" />

  <Card title="Multi-Agent Guide" icon="users" href="/docs/guides/multi-agent" />

  <Card title="Agent Configuration" icon="gear" href="/docs/configuration/agent-config" />

  <Card title="Auto Agents" icon="wand-magic-sparkles" href="/docs/features/autoagents" />
</CardGroup>
