agents.react_class.react_v2.utilsΒΆ
Utility functions for creating and customizing ReactAgents.
FunctionsΒΆ
|
Create a ReactAgent with a custom engine configuration. |
|
Create a ReactAgent with the specified tools and configuration. |
|
Create a ReactAgent that produces structured output according to the specified model. |
|
Organize tools into categories for parallel processing. |
Module ContentsΒΆ
- agents.react_class.react_v2.utils.create_agent_with_custom_engine(engine, tools, name=None, max_iterations=10, parallel_tool_execution=False, max_retries=3, retry_delay=0.5, **kwargs)ΒΆ
Create a ReactAgent with a custom engine configuration.
- Parameters:
engine (haive.core.engine.aug_llm.AugLLMConfig) β Custom AugLLMConfig
tools (haive.agents.react.config.ToolsInput) β Tools available to the agent (list or node mapping)
name (str | None) β Optional agent name
max_iterations (int) β Maximum number of iterations
parallel_tool_execution (bool) β Whether to execute tools in parallel
max_retries (int) β Maximum number of retries for tool failures
retry_delay (float) β Delay between retry attempts in seconds
**kwargs β Additional configuration options
- Returns:
Configured ReactAgent instance
- Return type:
haive.agents.react.agent.ReactAgent
- agents.react_class.react_v2.utils.create_react_agent(tools, model='gpt-4o', system_prompt=None, name=None, max_iterations=10, temperature=0.7, parallel_tool_execution=False, max_retries=3, retry_delay=0.5, **kwargs)ΒΆ
Create a ReactAgent with the specified tools and configuration.
- Parameters:
tools (haive.agents.react.config.ToolsInput) β Tools available to the agent (list or node mapping)
model (str) β The model name to use
system_prompt (str | None) β Optional system prompt
name (str | None) β Optional agent name
max_iterations (int) β Maximum number of iterations
temperature (float) β Temperature for LLM generation
parallel_tool_execution (bool) β Whether to execute tools in parallel
max_retries (int) β Maximum number of retries for tool failures
retry_delay (float) β Delay between retry attempts in seconds
**kwargs β Additional configuration options
- Returns:
Configured ReactAgent instance
- Return type:
haive.agents.react.agent.ReactAgent
- agents.react_class.react_v2.utils.create_structured_react_agent(output_model, tools, model='gpt-4o', system_prompt=None, name=None, max_iterations=10, temperature=0.7, parallel_tool_execution=False, max_retries=3, retry_delay=0.5, **kwargs)ΒΆ
Create a ReactAgent that produces structured output according to the specified model.
- Parameters:
output_model (type[pydantic.BaseModel]) β Pydantic model for structured output
tools (haive.agents.react.config.ToolsInput) β Tools available to the agent (list or node mapping)
model (str) β The model name to use
system_prompt (str | None) β Optional system prompt
name (str | None) β Optional agent name
max_iterations (int) β Maximum number of iterations
temperature (float) β Temperature for LLM generation
parallel_tool_execution (bool) β Whether to execute tools in parallel
max_retries (int) β Maximum number of retries for tool failures
retry_delay (float) β Delay between retry attempts in seconds
**kwargs β Additional configuration options
- Returns:
Configured ReactAgent instance with structured output support
- Return type:
haive.agents.react.agent.ReactAgent
- agents.react_class.react_v2.utils.organize_tools_by_category(tools, categories=None)ΒΆ
Organize tools into categories for parallel processing.
- Parameters:
- Returns:
Dictionary mapping category names to tool lists
- Return type:
dict[str, list[langchain_core.tools.BaseTool | langchain_core.tools.StructuredTool | langchain_core.tools.Tool | collections.abc.Callable]]