agent_with_tools/
agent_with_tools.rs

1use helios_engine::{Agent, Config, CalculatorTool, EchoTool};
2
3#[tokio::main]
4async fn main() -> helios_engine::Result<()> {
5    // Load configuration
6    let config = Config::from_file("config.toml")?;
7
8    // Create an agent with tools
9    let mut agent = Agent::builder("ToolAgent")
10        .config(config)
11        .system_prompt("You are a helpful assistant with access to tools. Use them when needed.")
12        .tool(Box::new(CalculatorTool))
13        .tool(Box::new(EchoTool))
14        .max_iterations(5)
15        .build()?;
16
17    println!("Available tools: {:?}\n", agent.tool_registry().list_tools());
18
19    // Test calculator tool
20    let response = agent.chat("What is 25 * 4 + 10?").await?;
21    println!("Agent: {}\n", response);
22
23    // Test echo tool
24    let response = agent.chat("Can you echo this message: 'Hello from Helios!'").await?;
25    println!("Agent: {}\n", response);
26
27    Ok(())
28}