Liath for AI Agents

Liath gives AI agents embedded, programmable memory. Instead of a fixed vector-DB API, the agent writes a sandboxed Lua program to run semantic search, filter by recency and importance, and re-rank by custom scores over its own memory. Liath bundles a key-value store, vector search, embeddings, and agent primitives — tagged memory, conversation history, and tool state — in one Rust engine with no external infrastructure.

Best for: AI Agents

The problem with agent memory today

An AI agent’s usefulness depends on what it can remember and how well it can recall the right thing at the right moment. Most memory today lives in a vector database behind a fixed API: semantic_search(query, k). That single call cannot express the strategies real agents need — weight recent memories higher, prefer high-importance facts, cross-reference conversations with tool outputs. All of that ends up in application code, reimplemented per agent.

Programmable memory

Liath flips the model. The agent generates a Lua program that runs inside the engine:

  • search memories semantically,
  • filter to the last few days and to high-importance items,
  • re-rank by similarity * importance,
  • return just the top results in the shape it wants.

The retrieval strategy lives where the reasoning is. And because the Lua runs in a sandbox with no file, network, or system access, it is safe to let the agent generate that code.

Everything an agent needs, in one engine

Beyond vectors, Liath ships the primitives agents actually use: tagged memory with importance scores, conversation history (add_message / get_messages), and tool state (set_tool_state / get_tool_state). Embeddings are generated locally with FastEmbed, vectors indexed with USearch, and structured state kept in a Fjall key-value store — all embedded, no servers.

Getting started

Install liath in Python or add the liath-rs crate, store a few memories with store_with_embedding, and let the agent query them with Lua. For coordinating several agents, see multi-agent systems; to build retrieval-augmented generation, see RAG pipelines.

Frequently Asked Questions

How do agents recall memory with Liath?

The agent generates a Lua program that Liath runs in a sandbox. It can call semantic_search over embedded memories, filter by recency and importance, re-rank by a custom score, and return the shaped result — all in one execution, without file, network, or system access.

Is it safe to let an agent generate the query code?

Yes. Liath executes Lua in a strict sandbox that blocks file system, network, and system access. The agent gets full programmability over retrieval while the code stays contained to the memory store.

Can Liath store conversation history and tool state?

Yes. Liath includes agent primitives: add_message and get_messages for conversation history, set_tool_state and get_tool_state for durable tool state, and store_memory with tags and importance for long-term memory.

Does Liath need external infrastructure for an agent?

No. Liath is embedded and runs in the agent's process as a single dependency. It bundles a key-value store, vector search, and embeddings, so there is no separate database, vector service, or embedding server to operate.

Which languages can I build agents in?

Liath ships as two editions of the same product: liath for Python (pip install liath) and liath-rs as a Rust crate. Both share the same Rust core and can also run as an MCP server for agent frameworks.

Related Content

Give your agents programmable memory

Open source, MIT licensed. pip install liath or add the liath Rust crate.