Skip to main content

pipecat-memorysync

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

pip install 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.
  • 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 (a real flaw in some in-tree memory services, which re-send the entire context every frame — O(n²) writes per call).
  • 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.

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

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.0.0.tar.gz (14.0 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.0.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pipecat_memorysync-1.0.0.tar.gz
  • Upload date:
  • Size: 14.0 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.0.0.tar.gz
Algorithm Hash digest
SHA256 961cce2ff6af2560d349f5faa9e33168f27f08a35085bc3b936b02f635d4e379
MD5 c65dc71e843be9164f75c79c27c2d266
BLAKE2b-256 10279788aa5c28ff724708df31796d769d39af38af40463f909d0eae46dbb00d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pipecat_memorysync-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00aae3b2973c61f9bcb3b19ffb221a58035de6077203baf13326ed0473578abf
MD5 4eac7f2874d48aabbf10f5d26be71f85
BLAKE2b-256 49a3bc15495327675fe18b5d5e3395d7d20eb0dd85e939bb815e42ecd32c64c2

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

This release

1.0.0 This release

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