agents.react_class.react_v3.agentΒΆ
ReactAgent implementation with tool usage and ReAct pattern.
from typing import Any, Dict This module implements a tool-using agent that follows the ReAct pattern (Reasoning, Acting, and Observing) for solving tasks.
ClassesΒΆ
A tool-using agent implementing the ReAct pattern. |
Module ContentsΒΆ
- class agents.react_class.react_v3.agent.ReactAgent(config, verbose=False, rich_logging=True)ΒΆ
Bases:
haive.core.engine.agent.agent.Agent
[haive.agents.react_class.react_v3.config.ReactAgentConfig
]A tool-using agent implementing the ReAct pattern.
Features: - Integration with LangChain tools - Automatic schema composition from tools and engine - Reasoning β Tool Use β Observation cycle - Retry policies for resilience - Configurable termination conditions
Initialize the agent with its configuration.
- Parameters:
- classmethod from_langgraph(react_state_graph, **kwargs)ΒΆ
Create a ReactAgent from an existing LangGraph StateGraph.
This allows using LangGraphβs create_react_agent directly and then wrapping it with our ReactAgent class.
- Parameters:
react_state_graph (langgraph.graph.StateGraph) β Existing React agent StateGraph
**kwargs β Additional configuration parameters
- Returns:
ReactAgent instance wrapping the provided StateGraph
- Return type:
- classmethod from_tools(tools, llm=None, system_prompt=None, **kwargs)ΒΆ
Create a ReactAgent from a list of tools.
- Parameters:
- Returns:
Configured ReactAgent instance
- Return type:
- run(input_data)ΒΆ
Run the agent on the provided input.
- Parameters:
input_data (Any) β Input in various formats
- Returns:
Agent result
- Return type:
Any
- setup_workflow()ΒΆ
Set up the ReAct workflow with reasoning and tool execution nodes.
This creates a graph with: 1. A reasoning node that decides what to do 2. A tool execution node that carries out actions 3. Conditional branching based on message types
- Return type:
None