use helios_engine::{Agent, CalculatorTool, Config, EchoTool, FileReadTool};
#[tokio::main]
async fn main() -> helios_engine::Result<()> {
println!("🧠 Helios Engine - ReAct Agent Example");
println!("======================================\n");
let config = Config::from_file("config.toml")?;
let mut agent = Agent::builder("ReActAgent")
.config(config)
.system_prompt(
"You are a helpful assistant that thinks carefully before acting. \
Use your reasoning to plan your approach.",
)
.tools(vec![
Box::new(CalculatorTool),
Box::new(EchoTool),
Box::new(FileReadTool),
])
.react() .max_iterations(5)
.build()
.await?;
println!(
"Available tools: {:?}\n",
agent.tool_registry().list_tools()
);
println!("═══════════════════════════════════════════════════════════");
println!("Example 1: Mathematical Problem");
println!("═══════════════════════════════════════════════════════════\n");
println!("User: I need to calculate (25 * 4) + (100 / 5). Can you help?\n");
let response = agent
.chat("I need to calculate (25 * 4) + (100 / 5). Can you help?")
.await?;
println!("\nAgent: {}\n", response);
println!("═══════════════════════════════════════════════════════════");
println!("Example 2: Multi-step Task");
println!("═══════════════════════════════════════════════════════════\n");
println!("User: First calculate 15 * 7, then echo the result back to me.\n");
let response = agent
.chat("First calculate 15 * 7, then echo the result back to me.")
.await?;
println!("\nAgent: {}\n", response);
println!("═══════════════════════════════════════════════════════════");
println!(" ReAct Demo Complete!");
println!("═══════════════════════════════════════════════════════════");
println!("\nNotice how the agent:");
println!(" 1. 💭 First reasons about the task");
println!(" 2. 📋 Creates a plan");
println!(" 3. ⚡ Then executes the actions\n");
println!("This leads to more thoughtful and systematic problem-solving!");
Ok(())
}