Author's bio: ๐๐ Hi, I'm CryptoPatrick! I'm currently enrolled as an Undergraduate student in Mathematics, at Chalmers & the University of Gothenburg, Sweden. If you have any questions or need more info, then please join my Discord Channel: AiMath
๐ Important Notices
- Framework Support: Currently designed for Rig agents, but extensible to other frameworks
- Storage: Uses SQLite for persistent storage with full-text search capabilities
- Inspired by Atuin: Brings the power of Atuin's searchable shell history to AI agents
๐ค What is AgentSmith
agentsmith is a Rust library that provides AI agents with persistent, fuzzy-searchable, metadata-rich memory that survives process restarts. Inspired by Atuin for shell history, AgentSmith ensures your agents never forget past conversations.
Built specifically for Rig agents, AgentSmith wraps your existing agents with a memory layer that automatically:
- Records all conversations to a SQLite database
- Enables fuzzy search across historical interactions
- Provides session management for organizing conversations
- Allows agents to recall relevant context from past discussions
Use Cases
- Persistent AI Assistants: Build chatbots that remember users across sessions
- Context-Aware Agents: Enable agents to reference past conversations naturally
- Conversation Analytics: Search and analyze agent interactions over time
- Session Management: Organize conversations by session for different contexts
- Agent Memory Research: Experiment with long-term memory for AI agents
๐ท Features
agentsmith provides a complete memory layer for AI agents with persistent storage and intelligent retrieval:
๐ง Core Functionality
- Persistent History: Automatic storage of all agent interactions in SQLite
- Fuzzy Search: Full-text search across conversation history with relevance ranking
- Session Management: Group conversations into sessions for different contexts
- Metadata Tracking: Store timestamps, roles, and custom metadata with each interaction
๐ง Memory Capabilities
- Automatic Recording: All agent interactions are automatically saved
- Smart Retrieval: Retrieve recent messages or search by content
- Context Injection: Automatically include relevant past context in conversations
- Cross-Session Search: Search across all conversations or within specific sessions
๐ค Smart Agent Features
- Transparent Wrapping: Drop-in wrapper for existing Rig agents
- Automatic Context: Agents automatically recall relevant past interactions
- Session Summaries: Generate summaries of conversation sessions
- Conversation History: Access chronological history of interactions
๐พ Persistence
- SQLite Storage: Reliable, file-based persistence with no external dependencies
- Migration Support: Built-in database schema migrations
- Session Continuity: Resume conversations across process restarts
- Export Capabilities: Import/export conversation history
๐ How to Use
Installation
Add agentsmith to your Cargo.toml:
[]
= "0.1"
Or install with cargo:
Basic Example
use ;
use openai;
async
Advanced Usage
use ;
async
๐งช Examples
The repository includes several examples demonstrating different features:
# Persistent chat REPL that remembers across restarts
# Demonstrate Atuin-style search capabilities
# Import conversation logs from other sources
# Basic usage example
๐งช Testing
Run the test suite:
# Run all tests
# Run with output
๐ Documentation
Comprehensive documentation is available at docs.rs/agentsmith, including:
- API reference for all public types and functions
- Tutorial on wrapping Rig agents with persistent memory
- Examples of searching and managing conversation history
- Best practices for session management
๐ Author
CryptoPatrick
Keybase Verification: https://keybase.io/cryptopatrick/sigs/8epNh5h2FtIX1UNNmf8YQ-k33M8J-Md4LnAN
๐ฃ Support
Leave a โญ if you think this project is cool.
๐ License
This project is licensed under MIT. See LICENSE for details.