agents.rag.agentic_router.agent¶

Agentic RAG Router with ReAct Pattern Agents.

from typing import Any Implementation of autonomous RAG routing using ReAct (Reason + Act) patterns. Provides intelligent agent selection, strategy planning, and execution coordination.

Classes¶

AgenticRAGRouterAgent

Complete Agentic RAG Router with ReAct patterns and autonomous decision-making.

AgenticRouterResult

Complete result from agentic RAG routing.

ExecutionResult

Result from strategy execution.

RAGStrategy

Available RAG strategies for routing.

ReActPlan

Complete ReAct planning result.

ReasoningStep

Individual reasoning step in ReAct pattern.

Functions¶

create_agentic_rag_router_agent(documents[, ...])

Create an Agentic RAG Router agent.

get_agentic_rag_router_io_schema()

Get I/O schema for Agentic RAG Router agents.

Module Contents¶

class agents.rag.agentic_router.agent.AgenticRAGRouterAgent¶

Bases: haive.agents.base.agent.Agent

Complete Agentic RAG Router with ReAct patterns and autonomous decision-making.

This agent uses conditional edges to route between different RAG strategies based on query analysis and planning.

build_graph()¶

Build the agentic RAG router graph with conditional edges.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

execute_flare_strategy(state)¶

Execute FLARE RAG strategy.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

execute_fusion_strategy(state)¶

Execute fusion RAG strategy.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

execute_hyde_strategy(state)¶

Execute HyDE RAG strategy.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

execute_multi_query_strategy(state)¶

Execute multi-query RAG strategy.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

execute_simple_strategy(state)¶

Execute simple RAG strategy.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

classmethod from_documents(documents, llm_config=None, autonomy_level='high', **kwargs)¶

Create Agentic RAG Router from documents.

Parameters:
  • documents (list[langchain_core.documents.Document]) – Documents to index for RAG strategies

  • llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration

  • autonomy_level (str) – Autonomy level (“low”, “medium”, “high”)

  • **kwargs – Additional arguments

Returns:

AgenticRAGRouterAgent instance

plan_react_strategy(state)¶

Plan RAG strategy using ReAct reasoning.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

setup_agent()¶

Initialize engines and strategy agents.

Return type:

None

strategy_router(state)¶

Route to the appropriate strategy execution node based on the selected strategy.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

str

synthesize_agentic_result(state)¶

Synthesize final agentic routing result.

Parameters:

state (haive.core.schema.prebuilt.rag_state.RAGState)

Return type:

dict[str, Any]

class agents.rag.agentic_router.agent.AgenticRouterResult(/, **data)¶

Bases: pydantic.BaseModel

Complete result from agentic RAG routing.

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)

class agents.rag.agentic_router.agent.ExecutionResult(/, **data)¶

Bases: pydantic.BaseModel

Result from strategy execution.

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)

class agents.rag.agentic_router.agent.RAGStrategy¶

Bases: str, enum.Enum

Available RAG strategies for routing.

Initialize self. See help(type(self)) for accurate signature.

class agents.rag.agentic_router.agent.ReActPlan(/, **data)¶

Bases: pydantic.BaseModel

Complete ReAct planning result.

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)

class agents.rag.agentic_router.agent.ReasoningStep(/, **data)¶

Bases: pydantic.BaseModel

Individual reasoning step in ReAct pattern.

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)

agents.rag.agentic_router.agent.create_agentic_rag_router_agent(documents, llm_config=None, routing_mode='autonomous', **kwargs)¶

Create an Agentic RAG Router agent.

Parameters:
  • documents (list[langchain_core.documents.Document]) – Documents for RAG strategies

  • llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration

  • routing_mode (str) – Routing mode (“conservative”, “balanced”, “autonomous”)

  • **kwargs – Additional arguments

Returns:

Configured Agentic RAG Router agent

Return type:

AgenticRAGRouterAgent

agents.rag.agentic_router.agent.get_agentic_rag_router_io_schema()¶

Get I/O schema for Agentic RAG Router agents.

Return type:

dict[str, list[str]]