haive.agents.rag.adaptive_tools.agent¶

Adaptive RAG with Tools Integration Agents.

from typing import Any Implementation of adaptive RAG with tool integration and ReAct patterns. Includes Google Search integration, tool selection, and dynamic routing based on query needs.

Classes¶

AdaptiveToolsRAGAgent

Complete Adaptive RAG agent with tools integration and ReAct patterns.

AdaptiveToolsResult

Complete result from adaptive tools RAG.

QueryNeed

Query need categories for tool selection.

SearchIntegrationAgent

Agent that integrates external search tools.

SearchResult

Results from search tools.

ToolSelection

Tool selection analysis and recommendations.

ToolSelectionAgent

Agent that selects optimal tools based on query analysis.

ToolType

Available tool types for adaptive RAG.

Functions¶

create_adaptive_synthesis_callable(llm_config)

Create callable function for adaptive synthesis.

create_adaptive_tools_rag_agent(documents[, ...])

Create an Adaptive Tools RAG agent.

create_google_search_callable(llm_config)

Create callable function for Google search integration.

create_tool_selector_callable(llm_config)

Create callable function for tool selection.

get_adaptive_tools_rag_io_schema()

Get I/O schema for Adaptive Tools RAG agents.

Module Contents¶

class haive.agents.rag.adaptive_tools.agent.AdaptiveToolsRAGAgent¶

Bases: haive.agents.multi.base.SequentialAgent

Complete Adaptive RAG agent with tools integration and ReAct patterns.

classmethod from_documents(documents, llm_config=None, enable_google_search=True, enable_local_retrieval=True, **kwargs)¶

Create Adaptive Tools RAG agent from documents.

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

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

  • enable_google_search (bool) – Whether to enable Google Search integration

  • enable_local_retrieval (bool) – Whether to enable local document retrieval

  • **kwargs – Additional arguments

Returns:

AdaptiveToolsRAGAgent instance

class haive.agents.rag.adaptive_tools.agent.AdaptiveToolsResult(/, **data)¶

Bases: pydantic.BaseModel

Complete result from adaptive tools RAG.

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 haive.agents.rag.adaptive_tools.agent.QueryNeed¶

Bases: str, enum.Enum

Query need categories for tool selection.

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

class haive.agents.rag.adaptive_tools.agent.SearchIntegrationAgent¶

Bases: haive.agents.base.agent.Agent

Agent that integrates external search tools.

build_graph()¶

Build search integration graph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

class haive.agents.rag.adaptive_tools.agent.SearchResult(/, **data)¶

Bases: pydantic.BaseModel

Results from search tools.

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 haive.agents.rag.adaptive_tools.agent.ToolSelection(/, **data)¶

Bases: pydantic.BaseModel

Tool selection analysis and recommendations.

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 haive.agents.rag.adaptive_tools.agent.ToolSelectionAgent¶

Bases: haive.agents.base.agent.Agent

Agent that selects optimal tools based on query analysis.

build_graph()¶

Build tool selection graph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

class haive.agents.rag.adaptive_tools.agent.ToolType¶

Bases: str, enum.Enum

Available tool types for adaptive RAG.

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

haive.agents.rag.adaptive_tools.agent.create_adaptive_synthesis_callable(llm_config)¶

Create callable function for adaptive synthesis.

Parameters:

llm_config (haive.core.models.llm.base.LLMConfig)

haive.agents.rag.adaptive_tools.agent.create_adaptive_tools_rag_agent(documents, llm_config=None, tools_mode='full', **kwargs)¶

Create an Adaptive Tools RAG agent.

Parameters:
  • documents (list[langchain_core.documents.Document]) – Documents for local retrieval

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

  • tools_mode (str) – Tools mode (“full”, “search_only”, “local_only”)

  • **kwargs – Additional arguments

Returns:

Configured Adaptive Tools RAG agent

Return type:

AdaptiveToolsRAGAgent

haive.agents.rag.adaptive_tools.agent.create_google_search_callable(llm_config)¶

Create callable function for Google search integration.

Parameters:

llm_config (haive.core.models.llm.base.LLMConfig)

haive.agents.rag.adaptive_tools.agent.create_tool_selector_callable(llm_config)¶

Create callable function for tool selection.

Parameters:

llm_config (haive.core.models.llm.base.LLMConfig)

haive.agents.rag.adaptive_tools.agent.get_adaptive_tools_rag_io_schema()¶

Get I/O schema for Adaptive Tools RAG agents.

Return type:

dict[str, list[str]]