Skip to main content

Python SDK for Synapse Memory API — persistent memory for AI agents

Project description

synapse-memory — Python SDK for Synapse

PyPI version License: MIT

Python SDK for the Synapse Memory API — persistent memory for AI agents.

Install

pip install synapse-memory-sdk

Quick Start

from synapse_memory import Synapse

synapse = Synapse(
    base_url="https://synapse.schaefer.zone",
    mind_key="your-mind-key-uuid",
)

# Recall all memories (LLM-formatted text)
text = synapse.memory.recall()
print(text)

# Store a new memory
synapse.memory.store(
    category="fact",
    content="User is Michael Schäfer",
    key="user_name",
    priority="critical",
    source="user",
)

# Search memories
results = synapse.memory.search("insolvenz")

# Chat with the human
msgs = synapse.chat.poll()
if msgs["messages"]:
    print(msgs["messages"][0]["content"])
    synapse.chat.reply("Got it!")

# Persistent variables
synapse.scheduler.set_var("last_run", str(int(time.time())))
last_run = synapse.scheduler.get_var("last_run")

API Reference

synapse.memory

  • recall() — Get all memories as LLM-formatted text
  • list(category?, tag?, limit?, offset?) — List with filters
  • store(**params) — Store/upsert (category, content, key?, tags?, priority?, source?, confidence?)
  • search(q, limit?) — Full-text search (FTS5)
  • semantic_search(q, limit?, threshold?) — Semantic search
  • update(memory_id, **params) — Update by ID
  • delete(memory_id) — Delete by ID
  • stats() — Statistics
  • unverified(limit?) — Unverified memories
  • contradictions(within_seconds?) — Detect contradictions
  • audit(limit?, action?) — Audit log
  • related(memory_id) — Related by shared tags
  • by_tag(tag) — Filter by tag
  • diff(since) — Incremental sync
  • expiring(within_seconds?) — Soon-to-expire
  • health() — Mind health check
  • sync(memories) — Bulk sync
  • export(format?) — Export mind

synapse.chat

  • poll(since_id?) — Poll for new messages
  • reply(content, reply_to_id?) — Send a reply
  • status() — Online status
  • history(limit?) — Full history (JWT-only)
  • unread(role?) — Unread count (JWT-only)

synapse.scheduler

  • list_crons() / create_cron(...) / delete_cron(id) / toggle_cron(id)
  • list_vars() / get_var(key) / set_var(key, value?) / delete_var(key)

License

MIT

Project details


Download files

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

Source Distribution

synapse_memory_sdk-1.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

synapse_memory_sdk-1.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: synapse_memory_sdk-1.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for synapse_memory_sdk-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ad9d42357eab943878a505cf680180925d46b2ba9fc107f8bbce3ab8d92a77ae
MD5 3fa16d4c03721c551515c930d3f52443
BLAKE2b-256 f3e8bdf3f67bde1efc30b32474bc141fa7ced820f4e50f17b28d8e734859478e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for synapse_memory_sdk-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b45506bf9a148d0c04774b3338d35f07367a2c7dd839821e31d98f68f45cb633
MD5 96ed1ff14a5c634f973a3087e656aacb
BLAKE2b-256 4ca6a001f321293a851c170999bc4bdd694fe886da313e49c97ad2b2e3aa8376

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page