agents.rag.agentic.agentic_rag_agentยถ

Agentic RAG Multi-Agent System.

This implements an advanced RAG system with document grading, query rewriting, and conditional routing between retrieval and web search.

Classesยถ

AgenticRAGAgent

Advanced Agentic RAG system with document grading and query refinement.

AgenticRAGState

State for the Agentic RAG workflow.

Module Contentsยถ

class agents.rag.agentic.agentic_rag_agent.AgenticRAGAgentยถ

Bases: haive.agents.simple.SimpleAgent

Advanced Agentic RAG system with document grading and query refinement.

This agent implements a sophisticated RAG workflow that includes: 1. Initial retrieval from vector store 2. Document relevance grading 3. Query rewriting if documents arenโ€™t relevant 4. Web search fallback 5. Final answer generation

Example

# Create agentic RAG agent
agent = AgenticRAGAgent.create_default(
name="agentic_rag",
retriever_config=vector_store_config,
use_web_search=True
)

# Process a query
result = await agent.arun("What are the latest advances in quantum computing?")

# The agent will:
# 1. Retrieve documents from vector store
# 2. Grade them for relevance
# 3. Rewrite query if needed
# 4. Use web search if local docs aren't sufficient
# 5. Generate comprehensive answer
build_graph()ยถ

Build the Agentic RAG workflow graph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

classmethod create_default(**kwargs)ยถ

Create a default Agentic RAG agent.

Parameters:

**kwargs โ€“ Configuration options - name: Agent name - retriever_config: Retriever or vector store config (required) - use_web_search: Whether to enable web search fallback - temperature: LLM temperature - engine: Custom AugLLMConfig if needed

Returns:

AgenticRAGAgent configured for advanced RAG

Return type:

AgenticRAGAgent

class agents.rag.agentic.agentic_rag_agent.AgenticRAGState(/, **data)ยถ

Bases: haive.core.schema.prebuilt.messages_state.MessagesState

State for the Agentic RAG workflow.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)