The SQLite for AI agents
Liath is programmable memory for AI agents. Instead of calling a fixed vector-database API, agents write sandboxed Lua programs to query their own memory — custom retrieval, ranking, and filtering. Embedded, zero-infrastructure, Rust core.
pip install liath cargo add liath What is Liath?
Liath is an embedded, programmable memory database for AI agents, with a Rust core. It bundles a key-value store, vector search, and embeddings, and it lets agents query all of it by writing sandboxed Lua programs — no server, no vendor API, no unsafe code execution.
Traditional vector DB
The agent can only call a fixed API:
semantic_search("query", 5) → results - One retrieval strategy, baked into the API
- Custom filtering and ranking happens in app code
- Usually a separate server to run and scale
Liath (programmable memory)
The agent generates a Lua program:
local r = semantic_search("mem", q, 20)
local top = rank_and_filter(r)
return json.encode(top) - Any retrieval strategy the agent can express in code
- Runs in a Lua sandbox: no file, network, or system access
- Embedded — a single dependency, zero infrastructure
The problems Liath solves
Agent memory is either too rigid, too dangerous, or too heavy. Liath fixes all three.
Fixed retrieval APIs
The Problem
Vector databases expose one call: semantic_search(query, k). Any custom ranking, recency weighting, or cross-referencing has to be reimplemented in your application for every agent.
Liath's Solution
Agents write Lua that runs inside Liath. They can search, filter by recency and importance, re-rank by a custom score, and shape the result — all in one program the LLM generates on the fly.
Running agent code is dangerous
The Problem
Letting an LLM execute arbitrary code to query memory is a security nightmare: file access, network calls, and system commands are all on the table.
Liath's Solution
Liath executes Lua in a strict sandbox with no file, network, or system access. Agents get full programmability without any of the blast radius.
Vector DBs need servers
The Problem
Most memory stores are network services you have to deploy, secure, scale, and pay for — heavy infrastructure for what is often a single agent process.
Liath's Solution
Liath is embedded. It runs in-process as a single dependency with a Rust core. Point it at a data directory; there is no server to operate.
Fragmented memory stack
The Problem
Agents typically bolt together a KV store, a vector database, an embedding service, and glue code for conversations and tool state.
Liath's Solution
Liath bundles a key-value store (Fjall), vector search (USearch), and embeddings (FastEmbed), plus agent primitives for memory, conversations, and tool state — one dependency.
Agents query memory with code, not a fixed API
The retrieval logic lives where the reasoning is — in a program the agent writes. Liath executes it against its built-in vector search, embeddings, and key-value store, safely inside a Lua sandbox.
# Fixed vector-DB API: one strategy
results = db.query(
vector=embed("query"),
top_k=5,
)
# Recency + importance re-ranking
# has to live in your app code:
recent = [r for r in results
if r.age_days < 7
and r.importance > 0.8]
recent.sort(key=score) Strategy is fixed by the API; the rest is glue code.
-- The agent generates this Lua program.
-- Liath runs it safely in a sandbox.
local results = semantic_search("memories", query, 20)
-- Filter by recency
local recent = filter(results, function(m)
return m.age_days < 7 and m.importance > 0.8
end)
-- Re-rank by a custom score, return top 5
local scored = map(recent, function(m)
m.score = m.similarity * m.importance
return m
end)
return json.encode(top(sort_by(scored, "score"), 5)) One program: search, filter, rank, and shape the result.
Everything an agent needs to remember
Programmable Lua queries, a built-in KV store, vector search, embeddings, and agent primitives — in one embedded Rust engine.
Programmable Memory
The core idea: agents query their memory with sandboxed Lua programs, not fixed APIs
Programmable Queries in Lua
Agents write Lua programs to query their own memory. Custom retrieval, ranking, filtering, and cross-referencing — logic that fixed vector-DB APIs simply cannot express.
Learn more →Sandboxed Execution
Running agent-generated code is normally dangerous. Liath executes Lua in a strict sandbox with no file, network, or system access. Safe by construction.
Learn more →Storage & Search
Key-value, vector search, embeddings, and namespaces built into one embedded engine
Key-Value Storage
Built-in namespaced key-value store backed by Fjall. Persistent, atomic, and typed — the foundation for agent state, configuration, and structured memory.
Learn more →Vector Search
Similarity search over embeddings powered by USearch. Store vectors alongside your key-value data and run nearest-neighbor queries from inside Lua.
Learn more →Built-in Embeddings
FastEmbed generates text embeddings locally. store_with_embedding() and semantic_search() turn plain text into searchable memory automatically.
Learn more →Namespaces
Isolate data per agent, tenant, or environment. Namespaced storage keeps multi-agent systems from stepping on each other while sharing one embedded engine.
Learn more →Agent Primitives
Memory, conversations, and tool state designed for how agents actually work
Agent Memory Primitives
Store memories with tags and importance scores, then recall by tag or by semantic similarity. Memory that maps directly onto how agents actually reason.
Learn more →Conversation History
First-class conversation tracking: add_message() and get_messages() manage multi-turn history per conversation without bolting on a separate store.
Learn more →Tool State
Persist and retrieve tool state between steps with set_tool_state() and get_tool_state(). Give long-running agents durable working memory across a task.
Learn more →Runtime & Interfaces
Embedded Rust core with library, CLI, TUI, HTTP, and MCP interfaces
Embedded, Zero-Infrastructure
No server to run, no cluster to operate. Liath embeds directly in your process as a single dependency. Point it at a data directory and go.
Learn more →Rust Core
The engine is written in Rust: memory-safe, fast, and portable. Low-latency execution suited to real-time agent loops, with a Python binding on top.
Learn more →Multiple Interfaces
Use Liath as an embedded library, an interactive TUI/CLI, an HTTP server, or an MCP server that plugs directly into AI assistants and agent frameworks.
Learn more →Ready to give your agents programmable memory?
Liath is open source (MIT). Install it, store some memories, and let your agents query them with Lua.
Need a database for AI-era applications?
ORMDB is Liath's sibling from the incredlabs data platform — a relational database built for modern app workloads.