Add persistent memory to a Pipecat voice pipeline as two frame processors: one that injects the user’s relevant memories before the LLM sees a frame, and one that records each completed turn after the response.Documentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This guide shows how to add Synap to a Pipecat application to build voice pipelines that:- Inject the most relevant memories as a system message before the LLM responds
- Record each completed user + assistant turn back to Synap
- Compose with any other Pipecat frame processor without changing the pipeline shape
| Class | Pipeline position | Purpose |
|---|---|---|
SynapMemoryProcessor | Before LLM | Prepends relevant memories to the system message |
SynapRecorder | After response | Records the completed turn back to Synap |
Setup
Install the package alongside Pipecat:.env
Basic integration
The smallest useful integration adds both processors to a standard voice pipeline — memory injection before the LLM, recording after the response. No other pipeline changes are needed:SynapIntegrationError, which Pipecat’s frame-error handling catches and logs.
Core concepts
Memory processor
SynapMemoryProcessor intercepts LLMMessagesFrame events and prepends a system message containing the user’s relevant memories before the frame reaches the LLM service:
mode="fast" is the default. The two retrieval modes trade latency against comprehensiveness:
fast | accurate | |
|---|---|---|
| Latency | 50-100ms | 200-500ms |
| Search | Vector similarity | Vector + graph + re-ranking |
| Best for | Real-time chat | Multi-entity queries |
LLMMessagesFrame passes through unmodified rather than blocking the call.
Recorder
SynapRecorder intercepts TranscriptionFrame (user side) and LLMFullResponseEndFrame (assistant side) and ingests the completed turn into Synap asynchronously:
SynapIntegrationError, which propagates through Pipecat’s frame-error handling so the failure is visible rather than silent.
Positioning in the pipeline
The two processors expect specific positions:SynapMemoryProcessor must be between STT and the user aggregator; SynapRecorder after the assistant aggregator. Any other placement will not see the right frame types.
Complete example: full voice pipeline with memory
The pattern below sets up an end-to-end voice pipeline with Synap-backed memory. Scope is pulled per-call from the transport’s connection metadata, so the same worker can serve multiple users:- Memory injection happens once per LLM turn, not once per audio frame — the processor only acts on
LLMMessagesFrameevents. - Recording is async and non-blocking. The audio path never waits on a Synap write.
- Scope is per-call. Each
run_callinvocation gets its own processor instances with the rightuser_id/customer_id.
Advanced patterns
Multi-tenant scoping
Both processors accept the standard scoping triple —user_id (required), optional customer_id, optional conversation_id. customer_id is required on B2B Synap instances and ignored on single-tenant ones. See Memory Scopes.
Tuning retrieval mode
mode="fast" is the default and the right choice for most voice flows. Switch to "accurate" only for use cases where missing relevant memory is worse than adding ~150ms of pre-LLM latency.
Failure semantics
The integration follows the Synap-wide contract, adapted for voice latency:SynapMemoryProcessordegrades gracefully — frame passes through unmodified if context retrieval fails.SynapRecordersurfaces failures — raisesSynapIntegrationErrorwhich Pipecat’s frame-error path catches and logs.
Next steps
LiveKit Agents
Context preloading and recording for LiveKit voice agents.
Claude Agent SDK
Hooks and MCP server for the Claude Agent SDK.
Context Fetch
The retrieval API behind
SynapMemoryProcessor — modes, scopes, and response shapes.Memory Scopes
How
user_id, customer_id, and conversation_id interact across reads.