rs-agent
rs-agent is a Rust implementation of the Lattice AI Agent Framework, providing clean abstractions for building production AI agents with LLMs, tool calling, retrieval-augmented memory, and multi-agent coordination.
Why rs-agent?
Building production AI agents requires more than just LLM calls. You need:
- Pluggable LLM providers that swap without rewriting logic
- Tool calling that works across different model APIs
- Memory systems that remember context across conversations
- Multi-agent coordination for complex workflows
- Testing infrastructure that doesn't hit external APIs
rs-agent provides all of this with idiomatic Rust patterns and async support.
Features
- 🧩 Modular Architecture – Compose agents from reusable components
- 🤖 Multi-Agent Support – Coordinate specialist agents
- 🔧 Rich Tooling – Implement the
Tooltrait once, use everywhere - 🧠 Smart Memory – RAG-powered memory with vector search
- 🔌 Model Agnostic – Adapters for Gemini, Ollama, Anthropic, or bring your own
- 📡 UTCP Ready – First-class Universal Tool Calling Protocol support
- ⚡ High Performance – Built with Rust for speed and safety
Quick Start
Installation
Add to your Cargo.toml:
[]
= { = "../rs-agent" }
= { = "1.41", = ["full"] }
Basic Usage
use ;
use ;
use Arc;
async
Project Structure
rs-agent/
├── src/
│ ├── agent/ # Main agent orchestration
│ ├── memory/ # Memory engine and vector stores
│ ├── models/ # LLM provider adapters
│ ├── tools/ # Tool system and catalog
│ ├── types.rs # Core type definitions
│ └── error.rs # Error types
├── examples/ # Usage examples
└── tests/ # Integration tests
Core Concepts
Agent
The Agent struct is the main orchestrator that handles:
- LLM interactions
- Memory management
- Tool invocation
- Context building
Memory System
rs-agent includes a sophisticated memory system:
use ;
use Arc;
let store = Boxnew;
let memory = new;
Features:
- Session-based – Isolated conversations
- Context windowing – Automatic trimming
- Vector search – Semantic memory retrieval
- Multiple backends – In-memory, PostgreSQL, Qdrant
Tool System
Create custom tools by implementing the Tool trait:
use ;
use async_trait;
;
UTCP Integration
rs-agent integrates with the Universal Tool Calling Protocol via rs-utcp, enabling cross-platform agent orchestration.
use ;
use HashMap;
use Arc;
let repo = new;
let search = new;
let utcp = new;
// Load tools from a UTCP provider and expose them to the agent
let tools = agent
.register_utcp_provider
.await?;
// Invoke UTCP tool like any other registered tool
let mut args = new;
args.insert;
let result = agent.invoke_tool.await?;
CodeMode Orchestration
Enable CodeMode (powered by rs-utcp) to execute snippets or let the LLM orchestrate tools with generated code.
use ;
use ;
use HashMap;
use Arc;
let codemode = new;
let memory = new;
// Register codemode.run_code and enable the orchestrator (defaults to the agent's model)
let agent = new
.with_codemode_orchestrator;
// Direct codemode execution
let mut args = new;
args.insert;
let _ = agent.invoke_tool.await?;
// Or natural language orchestration
let reply = agent
.generate
.await?;
Configuration
Environment Variables
| Variable | Description | Required |
|---|---|---|
GOOGLE_API_KEY |
Gemini API credentials | For Gemini models |
ANTHROPIC_API_KEY |
Anthropic API credentials | For Anthropic models |
Development
Running Tests
Running Examples
# Quickstart example
# Tool catalog and custom tools
# Memory + checkpointing
# Multi-agent example
# UTCP integration
Features
gemini- Google Gemini LLM support (default)ollama- Ollama local LLM supportanthropic- Anthropic Claude supportmemory- Memory and embedding support (default)postgres- PostgreSQL backend for memoryqdrant- Qdrant vector database supportall-providers- All LLM providersall-memory- All memory backends
Roadmap
- Gemini LLM implementation
- Ollama LLM implementation
- Anthropic LLM implementation
- PostgreSQL memory backend
- Qdrant memory backend
- Streaming support
- Tool orchestrator (LLM-driven tool selection)
- Code mode integration
- Sub-agent support
- Checkpoint/restore optimization
Comparison with go-agent
rs-agent is a Rust port of go-agent, maintaining feature parity while leveraging Rust's:
- Memory safety without garbage collection
- Zero-cost abstractions for performance
- Async/await for efficient concurrency
- Type system for compile-time guarantees
Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Acknowledgments
Star us on GitHub if you find rs-agent useful! ⭐