Adam is an embeddable AI agent library that integrates machine learning models with relational data using SQLite's database expertise. It enables developers to query and manipulate AI-driven data in a familiar, SQL-like syntax.
Overview
Adam provides a complete agent loop, including tool calling, memory, sessions, voice, streaming, and structured output, all in one #include. It works with cloud APIs, such as Anthropic, OpenAI, and Google Gemini, as well as local models like llama.cpp, through the same interface. Adam compiles on various platforms, including macOS, Linux, Windows, iOS, Android, and WASM.
Features
Adam's features include:
- Agent loop with tool calling and automatic iteration until final response
- Support for multiple providers, including Anthropic, OpenAI, and Google Gemini
- Local vision with multimodal image understanding via llama.cpp and mmproj
- Image generation with native image output via Gemini image models
- Database extensions for SQLite and PostgreSQL
- 13 built-in tools, including file I/O, shell, calculator, SQL, web fetch/search, and HTTP POST
- Long-term memory with hybrid BM25 + vector search via SQLite
- Session persistence with save/load conversations using UUIDv7 keys
- Telegram bot integration with text, voice, images, tools, and memory
- Voice support with STT, TTS, and full audio pipeline
- Streaming with real-time token delivery via callback
- Structured output with validation and retry
- Evolution loop for self-improving agents
- Research mode for autonomous multi-iteration information gathering
- Multi-agent support with independent settings and tools
- Guardrails with pre-send and post-receive validation callbacks
- Response cache with LRU hash table keyed on model and message history
- History management with clone, summarize, and token estimation
- Thread pool for concurrent agent execution
- Filesystem sandbox with tools restricted to explicitly allowed directories
- Cross-platform support with arena allocator for zero-leak per-iteration memory
Database Extensions
Adam can be embedded directly inside SQLite and PostgreSQL as a SQL extension. The agent can query the same database it's loaded in, allowing for natural language queries and answers from the data. The database extensions provide functions such as adam_config, adam, adam_ask, adam_sql, adam_create_session, adam_get_session, and adam_clear_session.
The MIT-licensed Adam library is available on GitHub, with a comprehensive API reference and examples for various use cases, including simple conversations, tool calling, local models, and database queries.