This recipe assumes upcoming SynapMemoryHook / SynapContextProvider exports from synap-livekit-agents. Until those ship, use preload_synap_context: see the integration’s README for the current API.
LiveKit Agents handles the audio plumbing (STT → LLM → TTS). Synap handles memory. The synap-livekit-agents integration wires them together with two callback hooks.
The two hooks
before_llm fetches relevant memories using the most recent user utterance as the search_query, and prepends them to the chat context as a system message. Latency-tuned for mode="fast" so it doesn’t add perceptible delay.
after_llm ingests the latest user + assistant turn as a single document with document_type="ai-chat-conversation". Runs in the background; doesn’t block the next TTS.
Latency budget for voice
Voice agents have a tight conversational comfort window. Synap’s fast retrieval is comfortably within voice-conversational budgets in typical deployments. If Synap calls feel slow in your environment, lower max_results (e.g., to 3) to trim retrieval work per turn.
Privacy note for voice
The full audio is processed by LiveKit + Deepgram. Synap only sees the text transcript that comes back from STT. If you’re under stricter privacy regimes, set the LiveKit recording flag to off and review the Security & Trust page.
Going further