Skip to main content

create_react_agent

Function create_react_agent 

Source
pub fn create_react_agent(
    model: Arc<dyn BaseChatModel>,
    tools: Vec<Arc<dyn BaseTool>>,
    config: Option<ReActAgentConfig>,
) -> Result<ReActAgent, GraphError>
Expand description

Create a ReAct agent with the given model and tools.

This builds a graph with the following structure:

START → agent → [tools_condition] → tools → agent (loop)
                               → END

§Arguments

  • model - The chat model to use for generating responses
  • tools - The tools available to the agent
  • config - Optional configuration for the agent

§Returns

A compiled agent graph that can be invoked.