Skip to main content

memorysync-pipecat

MemorySync for Pipecat — long-term memory for voice pipelines that never stalls a reply and never re-stores what it already knows. PyPI package: pipecat-memorysync.

Built and maintained by the MemorySync team — MemorySync is our product, and this integration is actively maintained alongside it.

Tested with Pipecat v1.8.1 (pipecat-ai>=1.0.0,<2).

pip install pipecat-memorysync
# or
uv add pipecat-memorysync

Where it sits

MemorySyncMemoryService is a FrameProcessor. Place it between your context aggregator and your LLM service:

transport.input() → stt → context_aggregator.user()
    → MemorySyncMemoryService        ← enriches + captures here
    → llm → tts → transport.output() → context_aggregator.assistant()
from pipecat_memorysync import MemorySyncMemoryService

memory = MemorySyncMemoryService(
    api_key="ms_...",                 # or MEMORYSYNC_API_KEY env var
    user_id="caller-42",              # stable end-user id
    session_id="call-123",            # optional: scope to this call
)

pipeline = Pipeline([
    transport.input(),
    stt,
    context_aggregator.user(),
    memory,
    llm,
    tts,
    transport.output(),
    context_aggregator.assistant(),
])

Every LLMContextFrame that flows through is enriched with relevant memories (as a system message) and mined for new turns to persist — then pushed on, enriched or not, on time.

Design guarantees

  • Budgeted recall. Enrichment runs under a hard timeout (default 1.2 s). A slow or dead memory backend means an unenriched frame, never a stalled voice reply.
  • Turn-complete capture. Voice aggregators split one utterance across several context messages at speech pauses; consecutive fragments merge into ONE stored turn when the assistant's reply completes it (the in-progress tail flushes at end of call) — no per-fragment junk rows.
  • Delta-only capture. Only messages not seen before are stored, tracked by deterministic idempotency seeds. Growing a 50-message context does not re-store 50 messages per turn.
  • Injection exclusion. The memory block this service adds is never captured back as a new memory.
  • Graceful end, salvaged abort. On EndFrame, queued writes get a bounded window (3 s) to land before the pipeline stops — the call's final exchange is not lost. On CancelFrame, the frame is pushed first and writes get a brief salvage window.
  • Failure-proof. HTTP errors, quota limits, and timeouts all degrade to "no memories this turn". Nothing propagates into the pipeline.

Running the example

A single-file voice agent that remembers callers across calls lives in examples/foundational.py:

uv add pipecat-memorysync "pipecat-ai[deepgram,cartesia,openai,silero,runner,webrtc]"

export MEMORYSYNC_API_KEY=ms_...   # https://app.memorysync.io
export DEEPGRAM_API_KEY=...
export CARTESIA_API_KEY=...
export OPENAI_API_KEY=...

python examples/foundational.py

Open http://localhost:7860/client, tell the bot your name and a preference, hang up, and connect again — it remembers.

Configuration (InputParams)

from pipecat_memorysync import MemorySyncMemoryService

memory = MemorySyncMemoryService(
    api_key="ms_...",
    user_id="caller-42",
    params=MemorySyncMemoryService.InputParams(
        top_k=5,                  # memories injected per turn
        recall_timeout=1.2,       # hard budget, seconds
        add_as_system_message=True,
        position="end",           # where the memory block lands in the context
        min_prompt_chars=8,       # skip enrichment for shorter user prompts
    ),
)
Param Default Meaning
top_k 5 Memories injected per turn
recall_timeout 1.2 Hard recall budget in seconds
system_prompt (guarded header) Prefix line for the injected block; also the capture-exclusion marker
add_as_system_message True Inject as system (else appended to the latest user message)
position "end" "start" or "end" of the message list
min_prompt_chars 8 Skip recall for trivial prompts

Semantics worth knowing

  • Both user and assistant turns are persisted, with role fidelity.
  • Idempotency seeds make retries/reconnects duplicate-free server-side.
  • Free-tier quota exhaustion is silent by design (empty recall, accepted-but- dropped writes); evaluation keys surface strict 429s instead.
  • The service is reusable across pipeline runs; call await memory.aclose() from application shutdown if you want an explicit flush + client close.

Development

python -m venv venv && venv/Scripts/pip install -e . pipecat-ai pytest pytest-asyncio
venv/Scripts/python -m pytest tests -q    # 14 tests, run via pipecat's official test harness

Docs

Full guide: docs.memorysync.io/guides/pipecat

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipecat_memorysync-1.1.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pipecat_memorysync-1.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file pipecat_memorysync-1.1.0.tar.gz.

File metadata

  • Download URL: pipecat_memorysync-1.1.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for pipecat_memorysync-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3ca0541db97059890c72cb008c6edcbeafd09febc8c836c4d49abefa430d9557
MD5 6e9cce436d702a2dd2dcae09b40fc17b
BLAKE2b-256 b8d337c51c4839e2a62bc4fa13f762ea32e9bdca01036049397d6a40fe705902

See more details on using hashes here.

File details

Details for the file pipecat_memorysync-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pipecat_memorysync-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 144773f38022f540b040068afd466aa1b141553837845b0e2c2991a9bf0e5462
MD5 b1629c97e933401ffcf1edbb597775b4
BLAKE2b-256 fc86d6fa2beb570447926f66b5f05cdc1b6d4a1b7d02c989dab88f9688f0fe97

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.1

2 files

This release

1.1.0 This release

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page