Engram memory plugin for LiveKit Agents — durable, explainable memory for voice and realtime AI.
Project description
livekit-plugins-engram
Durable, explainable memory for LiveKit Agents, powered by Engram (Lumetra).
Voice and realtime agents are stateless by default — every call starts from zero. This plugin gives your Agent a one-line memory backend so it can remember what the caller told you last Tuesday, recall it mid-sentence, and explain why it surfaced any given fact (BM25 + vector + knowledge-graph retrieval).
Install
pip install livekit-plugins-engram
Set your Engram API key:
export ENGRAM_API_KEY=eng_live_...
Get a key at https://lumetra.io.
Usage
The plugin exposes a single Engram class. Use it from your Agent's lifecycle hooks (record what the user just said, recall relevant context before the LLM responds), or hand the model a pair of function tools so it can manage memory itself.
Pattern 1 — record + recall in on_user_turn_completed
from livekit.agents import Agent, AgentSession, JobContext, WorkerOptions, cli
from livekit.plugins import openai, deepgram, silero
from livekit.plugins.engram import Engram
memory = Engram(bucket="caller-default") # picks up ENGRAM_API_KEY
class Receptionist(Agent):
def __init__(self) -> None:
super().__init__(
instructions=(
"You are a friendly receptionist. Use the memory provided "
"in the system messages to personalize replies."
),
)
async def on_user_turn_completed(self, chat_ctx, new_message):
text = new_message.text_content
if not text:
return
# Save what the user just said
await memory.astore_memory(text)
# Pull anything relevant from prior sessions
recall = await memory.aquery_memory(text)
if recall.get("answer"):
chat_ctx.add_message(
role="system",
content=f"Relevant memory: {recall['answer']}",
)
async def entrypoint(ctx: JobContext):
session = AgentSession(
stt=deepgram.STT(),
llm=openai.LLM(model="gpt-4o-mini"),
tts=openai.TTS(),
vad=silero.VAD.load(),
)
await session.start(agent=Receptionist(), room=ctx.room)
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Pattern 2 — give the model memory tools
from livekit.agents import Agent
from livekit.plugins.engram import Engram, engram_tools
memory = Engram(bucket="caller-default")
agent = Agent(
instructions="When the user shares a fact, call store_memory. "
"When you need history, call query_memory.",
tools=engram_tools(memory),
)
Per-caller buckets
In a voice deployment you typically want one bucket per caller / room / customer:
memory = Engram(bucket=f"caller-{ctx.room.name}")
Buckets are created lazily on first write — no admin step required.
API
Engram(*, api_key=None, bucket=None, base_url="https://api.lumetra.io", timeout=30.0)
| Method (sync / async) | Returns |
|---|---|
store_memory(content, bucket=None) / astore_memory(...) |
{} (201) |
query_memory(query, bucket=None) / aquery_memory(...) |
{"success": True, "answer": "..."} |
list_memories(bucket=None, *, limit=50) / alist_memories(...) |
{"memories": [...], "total": N} |
list_buckets(*, limit=50, offset=0) / alist_buckets(...) |
{"buckets": [...]} |
delete_memory(memory_id, bucket=None) / adelete_memory(...) |
{} |
clear_memories(bucket=None) / aclear_memories(...) |
{} |
Inside a LiveKit Agent (which is asyncio), prefer the a* coroutines.
Configuration
| Env var | Purpose |
|---|---|
ENGRAM_API_KEY |
API key (eng_live_...) |
Links
- Engram docs — https://docs.lumetra.io
- LiveKit Agents — https://docs.livekit.io/agents/
- Source — https://github.com/lumetra-ai/engram-livekit
License
MIT © Lumetra
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file livekit_plugins_engram-0.1.0.tar.gz.
File metadata
- Download URL: livekit_plugins_engram-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a14199c121bbaf3f8382b7d654ca8ee3024368a96df3e50886b02ada409d729
|
|
| MD5 |
305b08ad26d44d77667844d4f2408abb
|
|
| BLAKE2b-256 |
56bad649d68b34a97887b51ada2ac912f8dee32e0d1571215c577dbbe86564fb
|
File details
Details for the file livekit_plugins_engram-0.1.0-py3-none-any.whl.
File metadata
- Download URL: livekit_plugins_engram-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b8f77c1aff52968008e4dd00423bf9c9005f40458d959a57ba5ff4e8f4dad04
|
|
| MD5 |
17a4d2f7f02a5db654bb92941146b0f8
|
|
| BLAKE2b-256 |
fdc0101abe8e58cb091daf97987a19550810138753f01496a35cb07448e963a0
|