serve_agent/
serve_agent.rs1use helios_engine::{Agent, CalculatorTool, Config};
7
8#[tokio::main]
9async fn main() -> helios_engine::Result<()> {
10 tracing_subscriber::fmt()
12 .with_max_level(tracing::Level::INFO)
13 .init();
14
15 let config = Config::from_file("config.toml")?;
17
18 let agent = Agent::builder("API Agent")
20 .config(config)
21 .system_prompt("You are a helpful AI assistant with access to a calculator tool.")
22 .tool(Box::new(CalculatorTool))
23 .max_iterations(5)
24 .build()
25 .await?;
26
27 println!("Starting server on http://127.0.0.1:8000");
29 println!("Try: curl http://127.0.0.1:8000/v1/chat/completions \\");
30 println!(" -H 'Content-Type: application/json' \\");
31 println!(" -d '{{\"model\": \"local-model\", \"messages\": [{{\"role\": \"user\", \"content\": \"What is 15 * 7?\"}}]}}'");
32
33 helios_engine::serve::start_server_with_agent(
34 agent,
35 "local-model".to_string(),
36 "127.0.0.1:8000",
37 )
38 .await?;
39
40 Ok(())
41}