Skip to content

feat(livekit): add persistent memory for LiveKit Agents - #1702

Merged
Dhravya merged 7 commits into
mainfrom
capy/add-persistent-memory-for
Oct 1, 2026
Merged

Dhravya merged 7 commits into
mainfrom
capy/add-persistent-memory-for

Conversation

@Dhravya

@Dhravya Dhravya commented Sep 24, 2026

Copy link
Copy Markdown
Member

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 gets search_memories, remember, and forget, 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.toml changes on main. The first PyPI release needs a trusted publisher for the new project name supermemory-livekit.

Open in Capy

@mintlify

mintlify Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
supermemory 🟢 Ready View Preview Oct 1, 2026, 7:40 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 30af373 Oct 01 2026, 07:41 PM

@polylane

polylane Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Note

Production impact unlikely.

Checked both in-scope Workers against this diff: it only adds the standalone packages/livekit-sdk-python package, docs and CI/publish workflows — no changed file deploys to supermemory-mcp or supermemory-app, and over 72h both served with zero errors.

View the full analysis →

Also considered · 3 refuted
  • Refuted · New package reads SUPERMEMORY_API_KEY with no workspace provisioning · The getenv lives in a library published to PyPI for external consumers, not in any resource this workspace deploys.
  • Refuted · New publish workflow depends on an out-of-band PyPI trusted publisher · Even if the trusted publisher is unconfigured and the run fails, the failure is confined to publishing a brand-new PyPI project.
  • Refuted · Changed workflows deploy to supermemory-mcp / supermemory-app · The workflows this PR touches do not deploy to supermemory-mcp or supermemory-app, whose bindings, routes and deployed versions are untouched by the diff.

supermemory-mcp · requests per hour

supermemory-app · requests per hour

Dependency changes

Package Change Jump Release age
livekit-agents added 1.2.0 — 14 months
pydantic added 2.10.0 — 22 months
pytest added 8.3.5 — 19 months
supermemory added 3.50.0 — 3 months
Analysed against 2 Cloudflare Workers and 1 repository

View in Polylane Disable reviews

Polylane analysed 9b8308b for production impact. You can ask follow-ups by mentioning @polylane in a comment.

Did this help? React 👍 or 👎 so the next review is sharper.

Previous verdicts (1)
Head Verdict Analysis
2d3c706 Production impact unlikely

@socket-security

socket-security Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​livekit-agents@​1.8.392100100100100

View full report

Dhravya and others added 4 commits September 25, 2026 21:22
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.
@ishaanxgupta
ishaanxgupta force-pushed the capy/add-persistent-memory-for branch from d8c1d6d to 30af373 Compare October 1, 2026 19:39
@Dhravya
Dhravya merged commit b36b225 into main Oct 1, 2026
19 checks passed

This branch was successfully deployed

1 active deployment
staging - apps/docs — 30af373a Deployed Oct 1, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants