Skip to content

DiscreteTom/tiny-loop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiny-loop

Crates.io Version GitHub License

Minimal AI agent framework in Rust.

⚠️ Early Development: This project is in early phase and the API will change frequently.

Features

Installation

Add to your Cargo.toml:

[dependencies]
tiny-loop = "0.2"
serde = { version = "1", features = ["derive"] }
schemars = "1"

Quick Start

use tiny_loop::{Agent, llm::OpenAIProvider, tool::tool};

#[tool]
async fn search(
    /// Search query
    query: String
) -> String {
    format!("Results for: {}", query)
}

#[tokio::main]
async fn main() {
    let mut agent = Agent::new(OpenAIProvider::new())
        .system("You are a helpful assistant")
        .tool(search);

    let response = agent.chat("Search for Rust tutorials").await.unwrap();
    println!("{}", response);
}