1mod common;
2
3use common::run_cli_loop;
4use tiny_loop::{Agent, llm::OpenAIProvider, tool::tool};
5
6#[tool]
8async fn get_weather(
9 city: String,
11) -> String {
12 format!("The weather in {} is sunny and 72°F", city)
13}
14
15#[tool]
17async fn add(
18 a: i32,
20 b: i32,
22) -> String {
23 format!("{}", a + b)
24}
25
26#[tokio::main]
27async fn main() {
28 let api_key = std::env::var("LLM_API_KEY").expect("LLM_API_KEY not set");
29
30 let llm = OpenAIProvider::new()
31 .api_key(api_key)
32 .base_url("https://openrouter.ai/api/v1")
33 .model("google/gemini-3-flash-preview");
34
35 let agent = Agent::new(llm)
36 .system("You are a helpful assistant with access to tools")
37 .tool(get_weather)
38 .tool(add);
39
40 run_cli_loop(agent).await
41}