Skip to content

Repository files navigation

Synapse Layer — Python SDK

PyPIMCP CompatibleAES-256-GCMLicense: Apache 2.0

RAG retrieves. Synapse remembers.

Persistent memory infrastructure for AI agents — AES-256-GCM encrypted at rest, semantic search, MCP-native.

Synapse Layer is open-source persistent memory infrastructure for AI agents and assistants. Memories are encrypted at rest with AES-256-GCM, indexed via pgvector HNSW for semantic recall, and exposed through MCP JSON-RPC for native integration with Claude, GPT, Gemini, and any MCP-compatible client. Apache 2.0 licensed.


⚡ 30-Second Quickstart

pip install synapse-layer
fromsynapse_layerimportSynapses=Synapse(token="sk_connect_YOUR_TOKEN")
s.save("user likes coffee")
print(s.recall("what does user like?"))

Get your token at forge.synapselayer.org → Dashboard → Connect


Why Synapse?

Superpowers proved agents need discipline. Synapse provides the continuity layer that makes that discipline persistent across sessions, tools, and handoffs.

Key Capabilities

CapabilityDescription
State ContinuityPersistent context across sessions and models.
Encrypted at RestAES-256-GCM encrypted at rest with per-operation random IV.
Agent-Native30-second install. Built for the MCP ecosystem.
Cross-AgentShare memory between agents via A2A protocol.
Trust QuotientWeighted memory ranking: confidence, recency, and usage.

Install

pip install synapse-layer

Optional Integrations

pip install synapse-layer[langchain]
pip install synapse-layer[crewai]

Quick Start

Core Client (always available)

fromsynapse_layerimportSynapseA2AClientasyncwithSynapseA2AClient(api_key="your-key") asclient:
# Store a memoryawaitclient.store_memory(
user_id="agent-001",
content="User prefers dark mode and Portuguese.",
source_type="user_input",
confidence=0.95
)
# Recall memoriesresult=awaitclient.recall_memory(
user_id="agent-001",
query="What are the user preferences?",
limit=10
)

LangChain Adapter (requires langchain-core)

fromsynapse_layerimportSynapseMemorymemory=SynapseMemory(
api_key="your-key",
user_id="agent-001",
input_key="input",
memory_key="history"
)
# Use with any LangChain agentvariables=awaitmemory.load_memory_variables({"input": "What do I know?"})

CrewAI Tools (requires crewai)

fromsynapse_layerimportSynapseStoreMemoryTool, SynapseRecallMemoryToolstore_tool=SynapseStoreMemoryTool(api_key="your-key")
recall_tool=SynapseRecallMemoryTool(api_key="your-key")
# Use as CrewAI tools in your agents

Architecture

┌───────────────────────────────────────────────────────────┐
│ YOUR AGENT │
│ (Claude, GPT-4o, Gemini, etc.) │
└─────────────────────────────┬─────────────────────────────┘
│
┌─────────┴─────────┐
│ synapse-layer │
│ Python SDK │
└─────────┬─────────┘
│
┌─────────────┴─────────────┐
│ SYNAPSE LAYER VAULT │
│ │
│ ✓ AES-256-GCM encrypted │
│ ✓ Server-side at rest │
│ ✓ Per-operation random IV │
│ ✓ Trust Quotient scoring │
└─────────────┬─────────────┘
│
┌───────┴───────┐
│ │
▼ ▼
┌────────────┐ ┌────────────┐
│ Session 2 │ │ Session 3 │
│ (GPT-4o) │ │ (Gemini) │
│ recalls ✓ │ │ recalls ✓ │
└────────────┘ └────────────┘

Security Model

LayerImplementation
EncryptionAES-256-GCM with per-operation random IV. GCM auth tag validated on every read.
Key ManagementKeys rotated per environment. Never logged.
PrivacyDifferential privacy via Gaussian noise on embeddings.
ValidationIntent validation pipeline with confidence scoring.

All sensitive data is AES-256-GCM encrypted at rest with per-operation random IV. Designed for LGPD/GDPR alignment.


API Reference

SynapseA2AClient

Core async client for the Synapse Layer A2A protocol (JSON-RPC 2.0 over HTTPS).

MethodDescription
store_memory()Store encrypted memory with semantic embedding
recall_memory()Retrieve memories ranked by Trust Quotient
create_handover()Create signed context for cross-agent transfer
forget_memory()Soft-delete specific memories

SynapseMemory(requires langchain-core)

LangChain BaseMemory adapter for persistent agent memory.

SynapseChatHistory(requires langchain-core)

LangChain BaseChatMessageHistory for persistent chat histories.

CrewAI Tools (requires crewai)

  • SynapseStoreMemoryTool — Store memories
  • SynapseRecallMemoryTool — Recall memories
  • SynapseHandoverTool — Cross-agent context transfer

Trust Quotient (TQ)

Memories are ranked using a weighted scoring formula:

TQ = f(confidence, recency, usage)

Higher TQ scores surface the most relevant and reliable memories first. The exact weights are proprietary and dynamically calibrated.


Related Projects

ProjectDescription
synapse-layerCore server — MCP endpoint, encryption engine, pgvector indexing
synapse-layer-skillMCP skill configuration for Claude Desktop, Cursor, Windsurf
synapse-layer-langgraphLangGraph checkpoint saver with encrypted state persistence

Links


License

Apache 2.0 — see LICENSE for details.


Synapse Layer
Persistent memory infrastructure for AI agents — AES-256-GCM encrypted at rest, semantic search, MCP-native.

PyPI · Website · Forge

About

Python SDK for Synapse Layer — persistent, encrypted, cross-agent memory for AI agents.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages