agent_with_tools/
agent_with_tools.rs1use helios_engine::{Agent, CalculatorTool, Config, EchoTool};
2
3#[tokio::main]
4async fn main() -> helios_engine::Result<()> {
5 let config = Config::from_file("config.toml")?;
7
8 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 .await?;
17
18 println!(
19 "Available tools: {:?}\n",
20 agent.tool_registry().list_tools()
21 );
22
23 let response = agent.chat("What is 25 * 4 + 10?").await?;
25 println!("Agent: {}\n", response);
26
27 let response = agent
29 .chat("Can you echo this message: 'Hello from Helios!'")
30 .await?;
31 println!("Agent: {}\n", response);
32
33 Ok(())
34}