feat(livekit): add persistent memory for LiveKit Agents - #1702
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 30af373 | Commit Preview URL Branch Preview URL |
Oct 01 2026, 07:41 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 30af373 | Oct 01 2026, 07:41 PM |
|
Note Production impact unlikely. Checked both in-scope Workers against this diff: it only adds the standalone Also considered · 3 refuted
Dependency changes
Analysed against 2 Cloudflare Workers and 1 repository
Polylane analysed Did this help? React 👍 or 👎 so the next review is sharper. Previous verdicts (1)
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
session.run and generate_reply never call on_user_turn_completed, so a text turn reached the model with no memory. SupermemoryAgent now recalls inside llm_node and skips the fetch when the voice hook already injected.
Found in live LiveKit Cloud voice calls: - Recalling in on_user_turn_completed changed the turn context, so LiveKit discarded its preemptive generation on every turn with memory. SupermemoryAgent now recalls only in llm_node, and uses the turn hook only for realtime models, which skip llm_node. - A turn with no memory recalled twice (hook, then llm_node), and tool follow-ups recalled again. Each user message is now recalled once; retries and follow-ups share the result. - A preloaded profile made llm_node skip recall for the rest of the call. Fresh recall now replaces the earlier injection. - remember used the default dynamic dreaming, so an explicit fact took about 18 minutes to become recallable. It now uses instant (~40s). The call transcript mode is configurable via capture_dreaming. - recall_timeout defaults to 2s; profile calls measured 0.5-1.4s. - Require livekit-agents>=1.3.6: AgentServer (used in the quick start) arrived in 1.3.1, and 1.3.1-1.3.5 no longer import with current opentelemetry-sdk.
examples/voice_agent.py runs in console mode or joins LiveKit rooms. It scopes memory from dispatch metadata, SUPERMEMORY_CONTAINER_TAG, or the participant, preloads the caller's profile, and greets returning callers by name. Tested on LiveKit Cloud: a second call greeted the caller by name and used a fact from the first call. The example is not included in the wheel or sdist.
From review of 5b2a435: - Captured turns now keep the container tag and document id they were spoken under. Rebinding the instance used to flush earlier turns into the new caller's scope. Turns captured before any bind still go to the first caller bound. - Recall strips earlier injected memory before it runs, so a failed or empty recall can no longer leave another caller's memory in context. For the same caller, a slow or failed recall falls back to the profile loaded by preload. - The recall cache is keyed on the user message, not its text, so a later turn with the same words recalls again. - Capture writes time out after 10s and keep their turns for retry, including on cancellation. Large calls are written in chunks of at most 100k characters, and the buffer is capped. - remember falls back to the default processing schedule when the organization has no balance for instant processing (HTTP 402). - Docs state the measured delays: about a minute for remember, 10 to 20 minutes for captured calls on the default dynamic schedule.
With the dynamic schedule a captured call took 10 to 20 minutes to become memories, so a caller who rang back right away was not recalled. Capture now defaults to dreaming="instant": on LiveKit Cloud a call's content was recallable 19 seconds after it ended, and the callback answered from it. Each capture write bills one extra operation. When the organization has no balance for instant processing (HTTP 402), capture and remember fall back to the dynamic schedule for the rest of the call instead of failing. capture_dreaming="dynamic" keeps the old behaviour.
608ccba to
d8c1d6d
Compare
d8c1d6d to
30af373
Compare
Adds
supermemory-livekit, a Python plugin that gives a LiveKit Agents voice session persistent memory.Before each reply it loads the caller profile and memories related to the turn, and inserts them immediately before the user message. A slow or failed recall is skipped, so a Supermemory outage does not end the call. Completed turns are stored as one document per call (
lk-<session_id>). The model also getssearch_memories,remember, andforget, scoped to that caller.Scope comes from an explicit container tag, the participant attribute
supermemory_container_tag, or the participant identity. Identities that are not valid container tags are sanitized to a stable id.Docs: integrations/livekit. Publishing follows the other Python SDKs and runs when
packages/livekit-sdk-python/pyproject.tomlchanges on main. The first PyPI release needs a trusted publisher for the new project namesupermemory-livekit.