Requires Python 3.11+.
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
Setup
Install the package alongside Pipecat:The pip package is
maximem-synap-pipecat, but the import drops the maximem- prefix and uses underscores: from synap_pipecat import .....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 is lower-latency and suited to the hot path; accurate adds LLM-driven query decomposition and reranking for relationship-aware queries at a higher latency cost.
Failures degrade gracefully: if context retrieval fails, the 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 the additional pre-LLM latency that LLM-driven query decomposition and reranking add.
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.
Going further
- Voice agent pattern: the reference architecture for memory-backed voice agents.
- Voice concierge cookbook: an end-to-end worked voice example.
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.