agents.rag.self_route.agent¶
Self-Route RAG Agents.
from typing import Any Implementation of self-routing RAG with dynamic strategy selection and iterative planning. Uses structured output models for complex routing decisions and preprocessing.
Classes¶
Iterative processing plan with loop structure. |
|
Agent that creates iterative processing plans. |
|
Structured analysis of query for routing decisions. |
|
Agent that performs structured query analysis for routing. |
|
Query complexity levels for routing decisions. |
|
Final routing decision with execution plan. |
|
Agent that makes final routing decisions. |
|
Available routing strategies. |
|
Complete Self-Route RAG agent with structured analysis and iterative planning. |
Functions¶
|
Create a Self-Route RAG agent. |
Get I/O schema for Self-Route RAG agents. |
Module Contents¶
- class agents.rag.self_route.agent.IterativePlan(/, **data)¶
Bases:
pydantic.BaseModel
Iterative processing plan with loop structure.
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.self_route.agent.IterativePlannerAgent(llm_config=None, max_iterations=3, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that creates iterative processing plans.
Initialize iterative planner.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
max_iterations (int) – Maximum number of iterations
**kwargs – Additional agent arguments
- build_graph()¶
Build iterative planning graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.self_route.agent.QueryAnalysis(/, **data)¶
Bases:
pydantic.BaseModel
Structured analysis of query for routing decisions.
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.self_route.agent.QueryAnalyzerAgent(llm_config=None, analysis_depth='comprehensive', **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that performs structured query analysis for routing.
Initialize query analyzer.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
analysis_depth (str) – Depth of analysis (“basic”, “comprehensive”, “expert”)
**kwargs – Additional agent arguments
- build_graph()¶
Build query analysis graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.self_route.agent.QueryComplexity¶
-
Query complexity levels for routing decisions.
Initialize self. See help(type(self)) for accurate signature.
- class agents.rag.self_route.agent.RoutingDecision(/, **data)¶
Bases:
pydantic.BaseModel
Final routing decision with execution plan.
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.self_route.agent.RoutingDecisionAgent(llm_config=None, enable_fallback=True, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that makes final routing decisions.
Initialize routing decision agent.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
enable_fallback (bool) – Whether to enable fallback strategies
**kwargs – Additional agent arguments
- build_graph()¶
Build routing decision graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.self_route.agent.RoutingStrategy¶
-
Available routing strategies.
Initialize self. See help(type(self)) for accurate signature.
- class agents.rag.self_route.agent.SelfRouteRAGAgent(config)¶
Bases:
haive.agents.multi.base.SequentialAgent
Complete Self-Route RAG agent with structured analysis and iterative planning.
Init .
- Parameters:
config (SequentialAgentConfig) – [TODO: Add description]
- classmethod from_documents(documents, llm_config=None, analysis_depth='comprehensive', max_iterations=3, enable_fallback=True, **kwargs)¶
Create Self-Route RAG agent from documents.
- Parameters:
documents (list[langchain_core.documents.Document]) – Documents to index
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
analysis_depth (str) – Depth of query analysis
max_iterations (int) – Maximum iterations for planning
enable_fallback (bool) – Whether to enable fallback routing
**kwargs – Additional arguments
- Returns:
SelfRouteRAGAgent instance
- agents.rag.self_route.agent.create_self_route_rag_agent(documents, llm_config=None, routing_mode='adaptive', **kwargs)¶
Create a Self-Route RAG agent.
- Parameters:
- Returns:
Configured Self-Route RAG agent
- Return type: