pub fn create_react_agent_with_options(
model: Arc<dyn ChatModel>,
tools: Vec<Arc<dyn Tool>>,
options: ReactAgentOptions,
) -> Result<CompiledGraph<MessageState>, SynapseError>Expand description
Create a prebuilt ReAct agent graph with additional configuration options.
This is the extended version of create_react_agent that accepts
a ReactAgentOptions struct for configuring checkpointing,
interrupts, and system prompts.
The graph has two nodes:
- “agent”: calls the ChatModel with messages and tool definitions
- “tools”: executes any tool calls from the agent’s response
Routing: if the agent returns tool calls, route to “tools”; otherwise route to END.
§Example
ⓘ
use std::sync::Arc;
use synaptic_graph::{create_react_agent_with_options, ReactAgentOptions, MemorySaver};
let options = ReactAgentOptions {
checkpointer: Some(Arc::new(MemorySaver::new())),
system_prompt: Some("You are a helpful assistant.".to_string()),
interrupt_before: vec!["tools".to_string()],
..Default::default()
};
let graph = create_react_agent_with_options(model, tools, options)?;