Skip to main content

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

Project description

Synapse Layer

PyPI MCP Compatible AES-256-GCM State Continuity License: Apache 2.0 Tests Passing

RAG retrieves. Synapse remembers.

Persistent memory infrastructure for AI agents — encrypted, governed, and cross-agent.


⚡ 30-Second Quickstart

pip install synapse-layer
from synapse_layer import Synapse

s = 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

Capability Description
State Continuity OAuth for AI Memory. Persistent context across sessions and models.
Privacy First Server never sees plaintext. AES-256-GCM encrypted at rest with per-operation random IV.
Agent-Native 30-second install. Built for the MCP ecosystem.
Cross-Agent Share memory between agents via A2A protocol.
Trust Quotient Weighted 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)

from synapse_layer import SynapseA2AClient

async with SynapseA2AClient(api_key="your-key") as client:
    # Store a memory
    await client.store_memory(
        user_id="agent-001",
        content="User prefers dark mode and Portuguese.",
        source_type="user_input",
        confidence=0.95
    )

    # Recall memories
    result = await client.recall_memory(
        user_id="agent-001",
        query="What are the user preferences?",
        limit=10
    )

LangChain Adapter (requires langchain-core)

from synapse_layer import SynapseMemory

memory = SynapseMemory(
    api_key="your-key",
    user_id="agent-001",
    input_key="input",
    memory_key="history"
)

# Use with any LangChain agent
variables = await memory.load_memory_variables({"input": "What do I know?"})

CrewAI Tools (requires crewai)

from synapse_layer import SynapseStoreMemoryTool, SynapseRecallMemoryTool

store_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

Layer Implementation
Encryption AES-256-GCM with per-operation random IV. GCM auth tag validated on every read.
Key Management Keys rotated per environment. Never logged.
Privacy Differential privacy via Gaussian noise on embeddings.
Validation Intent validation pipeline with confidence scoring.

Server never sees plaintext. 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).

Method Description
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.


Links


License

Apache 2.0 — see LICENSE for details.


Synapse Layer
Persistent memory infrastructure for AI agents.

PyPI · Website · Forge

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_layer-2.4.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

synapse_layer-2.4.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file synapse_layer-2.4.1.tar.gz.

File metadata

  • Download URL: synapse_layer-2.4.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for synapse_layer-2.4.1.tar.gz
Algorithm Hash digest
SHA256 574260a806fec7d74419528520b34b629a9625ade4c6ca733abfec9b98d6c58a
MD5 df068d063dc4e11899fbaa09f26545b4
BLAKE2b-256 0f1f16e0e7fb4ecfe9b3030f6cace36453542493084443d0ac04761ed3bb5933

See more details on using hashes here.

File details

Details for the file synapse_layer-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: synapse_layer-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for synapse_layer-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a95ec66423fd2ae0f2193cef64ed09b9decce8b0dd13de80697d215ef855fdbf
MD5 6cc682e2d85cee24e92135ac7a48d8c9
BLAKE2b-256 508f840c7905bbf727a8fbded1ce99d5b935f5edee19fbefe7e4b5110595d87a

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