synapse-layer 2.3.0__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: synapse-layer
3
+ Version: 2.3.2
4
+ Summary: Persistent memory infrastructure for AI agents — State Continuity Layer.
5
+ Author-email: Synapse Layer <founder.synapselayer@proton.me>
6
+ Project-URL: Homepage, https://synapselayer.org
7
+ Project-URL: Bug Tracker, https://github.com/SynapseLayer/synapse-sdk-python/issues
8
+ Project-URL: Documentation, https://synapselayer.org/docs
9
+ Project-URL: Repository, https://github.com/SynapseLayer/synapse-sdk-python
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Intended Audience :: Developers
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: requests>=2.25.0
18
+ Requires-Dist: pydantic>=2.0.0
19
+ Provides-Extra: langchain
20
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
21
+ Provides-Extra: crewai
22
+ Requires-Dist: crewai>=0.1.0; extra == "crewai"
23
+
24
+ # Synapse Layer
25
+
26
+ [![PyPI](https://img.shields.io/pypi/v/synapse-layer?label=PyPI&color=blue)](https://pypi.org/project/synapse-layer/)
27
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-6B4FBB)](https://modelcontextprotocol.io/)
28
+ [![AES-256-GCM](https://img.shields.io/badge/AES--256--GCM-Encrypted_at_Rest-success)](https://github.com/SynapseLayer/synapse-sdk-python)
29
+ [![Server Never Sees Plaintext](https://img.shields.io/badge/Server-Never_Sees_Plaintext-informational)](https://github.com/SynapseLayer/synapse-sdk-python)
30
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
31
+ [![Tests Passing](https://img.shields.io/badge/Tests-Passing-brightgreen)](https://github.com/SynapseLayer/synapse-sdk-python)
32
+
33
+ > **RAG retrieves. Synapse remembers.**
34
+
35
+ Persistent memory infrastructure for AI agents — encrypted, governed, and cross-agent.
36
+
37
+ ---
38
+
39
+ ## Why Synapse?
40
+
41
+ Superpowers proved agents need discipline. Synapse provides the **continuity layer** that makes that discipline persistent across sessions, tools, and handoffs.
42
+
43
+ ### Key Capabilities
44
+
45
+ | Capability | Description |
46
+ |---|---|
47
+ | **State Continuity** | OAuth for AI Memory. Persistent context across sessions and models. |
48
+ | **Privacy First** | Server never sees plaintext. AES-256-GCM client-side encryption. |
49
+ | **Agent-Native** | 30-second install. Built for the MCP ecosystem. |
50
+ | **Cross-Agent** | Share memory between agents via A2A protocol. |
51
+ | **Trust Quotient** | Weighted memory ranking: confidence, recency, and usage. |
52
+
53
+ ---
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ pip install synapse-layer
59
+ ```
60
+
61
+ ### Optional Integrations
62
+
63
+ ```bash
64
+ pip install synapse-layer[langchain]
65
+ pip install synapse-layer[crewai]
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Quick Start
71
+
72
+ ### Core Client (always available)
73
+
74
+ ```python
75
+ from synapse_layer import SynapseA2AClient
76
+
77
+ async with SynapseA2AClient(api_key="your-key") as client:
78
+ # Store a memory
79
+ await client.store_memory(
80
+ user_id="agent-001",
81
+ content="User prefers dark mode and Portuguese.",
82
+ source_type="user_input",
83
+ confidence=0.95
84
+ )
85
+
86
+ # Recall memories
87
+ result = await client.recall_memory(
88
+ user_id="agent-001",
89
+ query="What are the user preferences?",
90
+ limit=10
91
+ )
92
+ ```
93
+
94
+ ### LangChain Adapter (requires `langchain-core`)
95
+
96
+ ```python
97
+ from synapse_layer import SynapseMemory
98
+
99
+ memory = SynapseMemory(
100
+ api_key="your-key",
101
+ user_id="agent-001",
102
+ input_key="input",
103
+ memory_key="history"
104
+ )
105
+
106
+ # Use with any LangChain agent
107
+ variables = await memory.load_memory_variables({"input": "What do I know?"})
108
+ ```
109
+
110
+ ### CrewAI Tools (requires `crewai`)
111
+
112
+ ```python
113
+ from synapse_layer import SynapseStoreMemoryTool, SynapseRecallMemoryTool
114
+
115
+ store_tool = SynapseStoreMemoryTool(api_key="your-key")
116
+ recall_tool = SynapseRecallMemoryTool(api_key="your-key")
117
+
118
+ # Use as CrewAI tools in your agents
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Architecture
124
+
125
+ ```
126
+ ┌───────────────────────────────────────────────────────────┐
127
+ │ YOUR AGENT │
128
+ │ (Claude, GPT-4o, Gemini, etc.) │
129
+ └─────────────────────────────┬─────────────────────────────┘
130
+
131
+ ┌─────────┴─────────┐
132
+ │ synapse-layer │
133
+ │ Python SDK │
134
+ └─────────┬─────────┘
135
+
136
+ ┌─────────────┴─────────────┐
137
+ │ SYNAPSE LAYER VAULT │
138
+ │ │
139
+ │ ✓ AES-256-GCM encrypted │
140
+ │ ✓ Server-side at rest │
141
+ │ ✓ Per-operation random IV │
142
+ │ ✓ Trust Quotient scoring │
143
+ └─────────────┬─────────────┘
144
+
145
+ ┌───────┴───────┐
146
+ │ │
147
+ ▼ ▼
148
+ ┌────────────┐ ┌────────────┐
149
+ │ Session 2 │ │ Session 3 │
150
+ │ (GPT-4o) │ │ (Gemini) │
151
+ │ recalls ✓ │ │ recalls ✓ │
152
+ └────────────┘ └────────────┘
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Security Model
158
+
159
+ | Layer | Implementation |
160
+ |---|---|
161
+ | **Encryption** | AES-256-GCM with per-operation random IV. GCM auth tag validated on every read. |
162
+ | **Key Management** | Keys rotated per environment. Never logged. |
163
+ | **Privacy** | Differential privacy via Gaussian noise on embeddings. |
164
+ | **Validation** | Intent validation pipeline with confidence scoring. |
165
+
166
+ > The server never sees plaintext. All sensitive data is encrypted before storage.
167
+
168
+ ---
169
+
170
+ ## API Reference
171
+
172
+ ### `SynapseA2AClient`
173
+
174
+ Core async client for the Synapse Layer A2A protocol (JSON-RPC 2.0 over HTTPS).
175
+
176
+ | Method | Description |
177
+ |---|---|
178
+ | `store_memory()` | Store encrypted memory with semantic embedding |
179
+ | `recall_memory()` | Retrieve memories ranked by Trust Quotient |
180
+ | `create_handover()` | Create signed context for cross-agent transfer |
181
+ | `forget_memory()` | Soft-delete specific memories |
182
+
183
+ ### `SynapseMemory` *(requires langchain-core)*
184
+
185
+ LangChain `BaseMemory` adapter for persistent agent memory.
186
+
187
+ ### `SynapseChatHistory` *(requires langchain-core)*
188
+
189
+ LangChain `BaseChatMessageHistory` for persistent chat histories.
190
+
191
+ ### CrewAI Tools *(requires crewai)*
192
+
193
+ - `SynapseStoreMemoryTool` — Store memories
194
+ - `SynapseRecallMemoryTool` — Recall memories
195
+ - `SynapseHandoverTool` — Cross-agent context transfer
196
+
197
+ ---
198
+
199
+ ## Trust Quotient (TQ)
200
+
201
+ Memories are ranked using a weighted scoring formula:
202
+
203
+ ```
204
+ TQ = f(confidence, recency, usage)
205
+ ```
206
+
207
+ Higher TQ scores surface the most relevant and reliable memories first. The exact weights are proprietary and dynamically calibrated.
208
+
209
+ ---
210
+
211
+ ## Links
212
+
213
+ - **Website**: [synapselayer.org](https://synapselayer.org)
214
+ - **Forge (Dashboard)**: [forge.synapselayer.org](https://forge.synapselayer.org)
215
+ - **Documentation**: [synapselayer.org/docs](https://synapselayer.org/docs)
216
+ - **Issues**: [GitHub Issues](https://github.com/SynapseLayer/synapse-sdk-python/issues)
217
+ - **MCP Server**: [Smithery](https://smithery.ai/server/@nicholasmarchi/synapse-layer)
218
+
219
+ ---
220
+
221
+ ## License
222
+
223
+ Apache 2.0 — see [LICENSE](./LICENSE) for details.
224
+
225
+ ---
226
+
227
+ <p align="center">
228
+ <strong>Synapse Layer</strong><br>
229
+ Persistent memory infrastructure for AI agents.<br><br>
230
+ <a href="https://pypi.org/project/synapse-layer/">PyPI</a> ·
231
+ <a href="https://synapselayer.org">Website</a> ·
232
+ <a href="https://forge.synapselayer.org">Forge</a>
233
+ </p>
@@ -0,0 +1,210 @@
1
+ # Synapse Layer
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/synapse-layer?label=PyPI&color=blue)](https://pypi.org/project/synapse-layer/)
4
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-6B4FBB)](https://modelcontextprotocol.io/)
5
+ [![AES-256-GCM](https://img.shields.io/badge/AES--256--GCM-Encrypted_at_Rest-success)](https://github.com/SynapseLayer/synapse-sdk-python)
6
+ [![Server Never Sees Plaintext](https://img.shields.io/badge/Server-Never_Sees_Plaintext-informational)](https://github.com/SynapseLayer/synapse-sdk-python)
7
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](./LICENSE)
8
+ [![Tests Passing](https://img.shields.io/badge/Tests-Passing-brightgreen)](https://github.com/SynapseLayer/synapse-sdk-python)
9
+
10
+ > **RAG retrieves. Synapse remembers.**
11
+
12
+ Persistent memory infrastructure for AI agents — encrypted, governed, and cross-agent.
13
+
14
+ ---
15
+
16
+ ## Why Synapse?
17
+
18
+ Superpowers proved agents need discipline. Synapse provides the **continuity layer** that makes that discipline persistent across sessions, tools, and handoffs.
19
+
20
+ ### Key Capabilities
21
+
22
+ | Capability | Description |
23
+ |---|---|
24
+ | **State Continuity** | OAuth for AI Memory. Persistent context across sessions and models. |
25
+ | **Privacy First** | Server never sees plaintext. AES-256-GCM client-side encryption. |
26
+ | **Agent-Native** | 30-second install. Built for the MCP ecosystem. |
27
+ | **Cross-Agent** | Share memory between agents via A2A protocol. |
28
+ | **Trust Quotient** | Weighted memory ranking: confidence, recency, and usage. |
29
+
30
+ ---
31
+
32
+ ## Install
33
+
34
+ ```bash
35
+ pip install synapse-layer
36
+ ```
37
+
38
+ ### Optional Integrations
39
+
40
+ ```bash
41
+ pip install synapse-layer[langchain]
42
+ pip install synapse-layer[crewai]
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Quick Start
48
+
49
+ ### Core Client (always available)
50
+
51
+ ```python
52
+ from synapse_layer import SynapseA2AClient
53
+
54
+ async with SynapseA2AClient(api_key="your-key") as client:
55
+ # Store a memory
56
+ await client.store_memory(
57
+ user_id="agent-001",
58
+ content="User prefers dark mode and Portuguese.",
59
+ source_type="user_input",
60
+ confidence=0.95
61
+ )
62
+
63
+ # Recall memories
64
+ result = await client.recall_memory(
65
+ user_id="agent-001",
66
+ query="What are the user preferences?",
67
+ limit=10
68
+ )
69
+ ```
70
+
71
+ ### LangChain Adapter (requires `langchain-core`)
72
+
73
+ ```python
74
+ from synapse_layer import SynapseMemory
75
+
76
+ memory = SynapseMemory(
77
+ api_key="your-key",
78
+ user_id="agent-001",
79
+ input_key="input",
80
+ memory_key="history"
81
+ )
82
+
83
+ # Use with any LangChain agent
84
+ variables = await memory.load_memory_variables({"input": "What do I know?"})
85
+ ```
86
+
87
+ ### CrewAI Tools (requires `crewai`)
88
+
89
+ ```python
90
+ from synapse_layer import SynapseStoreMemoryTool, SynapseRecallMemoryTool
91
+
92
+ store_tool = SynapseStoreMemoryTool(api_key="your-key")
93
+ recall_tool = SynapseRecallMemoryTool(api_key="your-key")
94
+
95
+ # Use as CrewAI tools in your agents
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Architecture
101
+
102
+ ```
103
+ ┌───────────────────────────────────────────────────────────┐
104
+ │ YOUR AGENT │
105
+ │ (Claude, GPT-4o, Gemini, etc.) │
106
+ └─────────────────────────────┬─────────────────────────────┘
107
+
108
+ ┌─────────┴─────────┐
109
+ │ synapse-layer │
110
+ │ Python SDK │
111
+ └─────────┬─────────┘
112
+
113
+ ┌─────────────┴─────────────┐
114
+ │ SYNAPSE LAYER VAULT │
115
+ │ │
116
+ │ ✓ AES-256-GCM encrypted │
117
+ │ ✓ Server-side at rest │
118
+ │ ✓ Per-operation random IV │
119
+ │ ✓ Trust Quotient scoring │
120
+ └─────────────┬─────────────┘
121
+
122
+ ┌───────┴───────┐
123
+ │ │
124
+ ▼ ▼
125
+ ┌────────────┐ ┌────────────┐
126
+ │ Session 2 │ │ Session 3 │
127
+ │ (GPT-4o) │ │ (Gemini) │
128
+ │ recalls ✓ │ │ recalls ✓ │
129
+ └────────────┘ └────────────┘
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Security Model
135
+
136
+ | Layer | Implementation |
137
+ |---|---|
138
+ | **Encryption** | AES-256-GCM with per-operation random IV. GCM auth tag validated on every read. |
139
+ | **Key Management** | Keys rotated per environment. Never logged. |
140
+ | **Privacy** | Differential privacy via Gaussian noise on embeddings. |
141
+ | **Validation** | Intent validation pipeline with confidence scoring. |
142
+
143
+ > The server never sees plaintext. All sensitive data is encrypted before storage.
144
+
145
+ ---
146
+
147
+ ## API Reference
148
+
149
+ ### `SynapseA2AClient`
150
+
151
+ Core async client for the Synapse Layer A2A protocol (JSON-RPC 2.0 over HTTPS).
152
+
153
+ | Method | Description |
154
+ |---|---|
155
+ | `store_memory()` | Store encrypted memory with semantic embedding |
156
+ | `recall_memory()` | Retrieve memories ranked by Trust Quotient |
157
+ | `create_handover()` | Create signed context for cross-agent transfer |
158
+ | `forget_memory()` | Soft-delete specific memories |
159
+
160
+ ### `SynapseMemory` *(requires langchain-core)*
161
+
162
+ LangChain `BaseMemory` adapter for persistent agent memory.
163
+
164
+ ### `SynapseChatHistory` *(requires langchain-core)*
165
+
166
+ LangChain `BaseChatMessageHistory` for persistent chat histories.
167
+
168
+ ### CrewAI Tools *(requires crewai)*
169
+
170
+ - `SynapseStoreMemoryTool` — Store memories
171
+ - `SynapseRecallMemoryTool` — Recall memories
172
+ - `SynapseHandoverTool` — Cross-agent context transfer
173
+
174
+ ---
175
+
176
+ ## Trust Quotient (TQ)
177
+
178
+ Memories are ranked using a weighted scoring formula:
179
+
180
+ ```
181
+ TQ = f(confidence, recency, usage)
182
+ ```
183
+
184
+ Higher TQ scores surface the most relevant and reliable memories first. The exact weights are proprietary and dynamically calibrated.
185
+
186
+ ---
187
+
188
+ ## Links
189
+
190
+ - **Website**: [synapselayer.org](https://synapselayer.org)
191
+ - **Forge (Dashboard)**: [forge.synapselayer.org](https://forge.synapselayer.org)
192
+ - **Documentation**: [synapselayer.org/docs](https://synapselayer.org/docs)
193
+ - **Issues**: [GitHub Issues](https://github.com/SynapseLayer/synapse-sdk-python/issues)
194
+ - **MCP Server**: [Smithery](https://smithery.ai/server/@nicholasmarchi/synapse-layer)
195
+
196
+ ---
197
+
198
+ ## License
199
+
200
+ Apache 2.0 — see [LICENSE](./LICENSE) for details.
201
+
202
+ ---
203
+
204
+ <p align="center">
205
+ <strong>Synapse Layer</strong><br>
206
+ Persistent memory infrastructure for AI agents.<br><br>
207
+ <a href="https://pypi.org/project/synapse-layer/">PyPI</a> ·
208
+ <a href="https://synapselayer.org">Website</a> ·
209
+ <a href="https://forge.synapselayer.org">Forge</a>
210
+ </p>
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "synapse-layer"
7
- version = "2.3.0"
7
+ version = "2.3.2"
8
8
  authors = [
9
9
  { name="Synapse Layer", email="founder.synapselayer@proton.me" },
10
10
  ]
11
- description = "Universal memory layer for AI agents - Persistent, Private, Model-agnostic"
11
+ description = "Persistent memory infrastructure for AI agents State Continuity Layer."
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.9"
14
14
  classifiers = [
@@ -0,0 +1,70 @@
1
+ """
2
+ Synapse Layer — Universal memory layer for AI agents.
3
+ Persistent, Private, Model-agnostic.
4
+
5
+ MCP-native. LangChain-compatible. A2A-ready.
6
+
7
+ Core (always available):
8
+ from synapse_layer import SynapseA2AClient
9
+
10
+ LangChain adapter (requires langchain-core):
11
+ from synapse_layer import SynapseMemory, SynapseChatHistory
12
+
13
+ CrewAI tools (requires crewai):
14
+ from synapse_layer import SynapseStoreMemoryTool, SynapseRecallMemoryTool
15
+ """
16
+
17
+ __version__ = "2.3.2"
18
+
19
+ # Core — always importable, zero optional deps
20
+ from .a2a_client import SynapseA2AClient
21
+
22
+
23
+ # ---------------------------------------------------------------------------
24
+ # Lazy accessors for optional integrations
25
+ # ---------------------------------------------------------------------------
26
+
27
+ def __getattr__(name: str):
28
+ """Lazy-load optional adapters only when accessed."""
29
+
30
+ # LangChain adapters
31
+ if name in ("SynapseMemory", "SynapseChatHistory"):
32
+ try:
33
+ from . import langchain_memory as _lc # noqa: F811
34
+ except ImportError as exc:
35
+ raise ImportError(
36
+ f"{name} requires langchain-core. "
37
+ "Install with: pip install 'synapse-layer[langchain]'"
38
+ ) from exc
39
+ return getattr(_lc, name)
40
+
41
+ # CrewAI tools
42
+ if name in (
43
+ "SynapseStoreMemoryTool",
44
+ "SynapseRecallMemoryTool",
45
+ "SynapseHandoverTool",
46
+ ):
47
+ try:
48
+ from . import crewai_tools as _ct # noqa: F811
49
+ except ImportError as exc:
50
+ raise ImportError(
51
+ f"{name} requires crewai. "
52
+ "Install with: pip install 'synapse-layer[crewai]'"
53
+ ) from exc
54
+ return getattr(_ct, name)
55
+
56
+ raise AttributeError(f"module 'synapse_layer' has no attribute {name!r}")
57
+
58
+
59
+ __all__ = [
60
+ "__version__",
61
+ # Core
62
+ "SynapseA2AClient",
63
+ # LangChain (lazy)
64
+ "SynapseMemory",
65
+ "SynapseChatHistory",
66
+ # CrewAI (lazy)
67
+ "SynapseStoreMemoryTool",
68
+ "SynapseRecallMemoryTool",
69
+ "SynapseHandoverTool",
70
+ ]