Skip to content

LiveKit

Give a LiveKit voice agent long-term memory: recall relevant facts before the LLM answers, persist the user's turn once it is transcribed. Ships in the Python SDK.

Install

bash
pip install "suprflo[livekit]"

What you get

Both are built on the Python SDK MemoryClient:

  • SuprfloLiveKitMemory — recalls memories into the turn context and persists the user's message. A plain class, not an Agent subclass, so it composes with whatever agent you already have.
  • create_memory_tools(client, user_id) — LiveKit function tools (save_memory, search_memory) for an agent's tools=[...]. LiveKit derives each tool's schema from its docstring and type hints.

Memory in an agent

Delegate the on_user_turn_completed hook:

python
from livekit.agents import Agent
from suprflo import MemoryClient
from suprflo.integrations.livekit import SuprfloLiveKitMemory

client = MemoryClient(api_key="YOUR_API_KEY")

class Assistant(Agent):
    def __init__(self):
        super().__init__(instructions="You are a helpful voice assistant.")
        self.memory = SuprfloLiveKitMemory(client, user_id="alice", top_k=5)

    async def on_user_turn_completed(self, turn_ctx, new_message):
        await self.memory.on_user_turn_completed(turn_ctx, new_message)

Alice's stored facts are searched with the transcribed turn and added to the context before the LLM runs; the turn is then written back to Suprflo.

Tools for an agent

python
from suprflo.integrations.livekit import create_memory_tools

agent = Assistant(tools=create_memory_tools(client, user_id="alice"))

Notes and limits

  • MemoryClient is synchronous, so every call is offloaded with asyncio.to_thread — an API round trip cannot stall the voice loop.
  • Requires livekit-agents 1.x, which the extra pins. The 0.11 line exposed a different shape (VoicePipelineAgent + before_llm_cb) and is not supported.
  • The hook and tool shapes are written from the documented 1.x API and are unverified against a live LiveKit session; the adapter's tests mock the framework, so they prove the mapping logic and nothing about LiveKit itself. Smoke-test before relying on it.

If livekit-agents isn't installed, importing this module raises a clear ImportError telling you to pip install "suprflo[livekit]".

The memory layer for AI agents.