Ambi π¦
Ambi is a flexible, highly customizable AI Agent framework built entirely in Rust. It features a dual-engine architecture supporting both local inference and cloud APIs, alongside a powerful multi-tool calling system and intelligent context management.
β¨ Key Features
- Dual-Engine Architecture:
- Local Engine: Powered by
llama.cpp, supporting GGUF models with hardware acceleration for CUDA, Vulkan, Metal, etc. - Cloud Engine: Fully compatible with OpenAI-spec APIs (e.g., DeepSeek, SiliconFlow, Groq).
- Local Engine: Powered by
- Parallel Multi-Tool Calling: Capable of parsing and executing multiple
[TOOL_CALL]instructions in a single response, significantly boosting complex task efficiency. - Fine-grained Tool Control: Configure
timeout_secsandmax_retriesindependently for each tool. - Built-in Chat Templates: Native support for Chatml, Llama3, Gemma, DeepSeek, and more, with support for fully custom templates.
- Intelligent Context Eviction: A safe eviction algorithm that identifies
Usermessages as cutting points to prevent token overflow while maintaining logical flow. - Streaming Reasoning Support: Automatically identifies and formats reasoning tags like
<think>for models like DeepSeek.
π¦ Installation
Add Ambi to your Cargo.toml:
[]
= "0.1.3"
# For cloud-only usage (faster compilation):
# ambi = { version = "0.1.3", default-features = false, features = ["openai-api"] }
π Quick Start
1. Instantiate an Agent
use ;
use ChatTemplateType;
async
2. Define a Custom Tool
use ;
use async_trait;
use Deserialize;
;
// Mount when creating Agent
// let mut agent = Agent::make(config)?.tool(AddTool)?;
π οΈ Hardware Acceleration (Local)
Enable specific features for GPU acceleration:
- CUDA:
cargo build --features cuda - Metal:
cargo build --features metal - Vulkan:
cargo build --features vulkan
βοΈ License
Licensed under the Apache-2.0 License.