mnemosyne-sdk 0.1.0__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Geass Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Geass Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,79 @@
1
+ Mnemosyne & Syne — Dual-License Notice
2
+ ======================================
3
+
4
+ This repository, github.com/synet-systems/mnemosyne, contains two classes of
5
+ artifacts distributed under DIFFERENT licenses.
6
+
7
+ 1. THE MONOREPO SOURCE
8
+ The full source code in this repository — including the Mnemosyne engine
9
+ (mnemosyne/), the Syne voice+avatar companion (syne/), the Rust kernels
10
+ (mnemosyne_rs/, syne_rs/), the React UI (mnemosyne_ui/), the legacy
11
+ Sovereign Memory code (sovereign_memory*/), documentation, and benchmark
12
+ code — is licensed under the Mnemosyne Source-Available License v1.0
13
+ (MSAL v1.0). See ./LICENSE for the full text.
14
+
15
+ The MSAL is NOT an OSI-approved open-source license. It permits viewing,
16
+ reading, security review, interoperability study, and non-commercial
17
+ academic research, but it RESTRICTS commercial use, modification,
18
+ redistribution, and offering as a hosted service. Commercial use requires
19
+ a separate written agreement with Geass Labs — see
20
+ https://geasslabs.com/licensing or licensing@geasslabs.com.
21
+
22
+ 2. PUBLISHED PACKAGES
23
+ The following packages, which are extracted from this monorepo and
24
+ distributed through public registries (PyPI, npm, crates.io, GitHub
25
+ Releases), are licensed under the MIT License. See ./LICENSE-MIT for the
26
+ full text.
27
+
28
+ Python (PyPI):
29
+ - mnemosyne-sdk
30
+ - mnemosyne-mcp-server
31
+ - mnemosyne-langchain
32
+ - mnemosyne-crewai
33
+ - mnemosyne-autogen
34
+ - mnemosyne-openai-agents
35
+ - mnemosyne-connectors
36
+ - syne
37
+
38
+ JavaScript / TypeScript (npm):
39
+ - @mnemosyne/sdk
40
+ - @mnemosyne/mcp-server
41
+ - @mnemosyne/langchain
42
+ - @mnemosyne/vercel-ai
43
+ - @mnemosyne/react
44
+ - @mnemosyne/cli
45
+ - @mnemosyne/types
46
+
47
+ Rust (crates.io):
48
+ - mnemosyne-rs
49
+ - syne (workspace)
50
+
51
+ Binaries (GitHub Releases):
52
+ - syne-supervisor
53
+
54
+ The MIT-licensed published packages are designed to talk to a Mnemosyne
55
+ or Syne instance, which itself is governed by the MSAL. Combining the
56
+ MIT-licensed clients with a self-hosted MSAL-licensed server is
57
+ permitted by both licenses.
58
+
59
+ WHY THIS PATTERN
60
+ ----------------
61
+ This is the standard source-available distribution model used by companies
62
+ such as Sourcegraph, Sentry, and HashiCorp: the source is visible and
63
+ auditable under a restricted license, while the redistributable client
64
+ artifacts (SDKs, CLI, MCP server, framework adapters) ship under a
65
+ permissive license so that downstream developers can build commercial
66
+ products on top of the open ecosystem without friction.
67
+
68
+ The full Mnemosyne engine is also available for production deployment
69
+ under the Mnemosyne Teams and Mnemosyne Enterprise tiers. See
70
+ https://mnemosyne.geasslabs.com for details.
71
+
72
+ TRADEMARKS
73
+ ----------
74
+ "Mnemosyne", "Agent Soul", "Syne", and the Geass Labs wordmarks are
75
+ trademarks of Geass Labs. The MIT license does NOT grant permission to
76
+ use these trademarks; see the Geass Labs trademark policy at
77
+ https://geasslabs.com/trademarks.
78
+
79
+ Copyright (c) 2026 Geass Labs.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemosyne-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Mnemosyne memory substrate. Sync and async clients, container-scoped storage, hybrid BM25+vector recall, full Pydantic type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx.
5
+ Author-email: Mashle Burneded <mashle@geasslabs.xyz>
6
+ Maintainer-email: Geass Labs <team@geasslabs.xyz>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 Geass Labs
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://mnemosyne.geasslabs.xyz
30
+ Project-URL: Documentation, https://docs.geasslabs.xyz/mnemosyne-sdk
31
+ Project-URL: Repository, https://github.com/synet-systems/mnemosyne/tree/main/packages/mnemosyne-sdk-python
32
+ Project-URL: Issues, https://github.com/synet-systems/mnemosyne/issues
33
+ Project-URL: Changelog, https://github.com/synet-systems/mnemosyne/blob/main/packages/mnemosyne-sdk-python/CHANGELOG.md
34
+ Keywords: mnemosyne,ai,llm,memory,agent,agent-memory,rag,retrieval-augmented-generation,long-term-memory,vector-search,sdk
35
+ Classifier: Development Status :: 4 - Beta
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Programming Language :: Python :: 3
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Programming Language :: Python :: 3.13
43
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
44
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
45
+ Classifier: Typing :: Typed
46
+ Requires-Python: >=3.11
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ License-File: LICENSE-MIT
50
+ License-File: NOTICE
51
+ Requires-Dist: httpx>=0.27.0
52
+ Requires-Dist: pydantic>=2.7.0
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
55
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
56
+ Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
57
+ Requires-Dist: ruff>=0.5.0; extra == "dev"
58
+ Requires-Dist: mypy>=1.10.0; extra == "dev"
59
+ Requires-Dist: respx>=0.21.0; extra == "dev"
60
+ Requires-Dist: anyio>=4.0.0; extra == "dev"
61
+ Provides-Extra: all
62
+ Requires-Dist: mnemosyne-langchain>=0.1.0; extra == "all"
63
+ Requires-Dist: mnemosyne-crewai>=0.1.0; extra == "all"
64
+ Requires-Dist: mnemosyne-autogen>=0.1.0; extra == "all"
65
+ Requires-Dist: mnemosyne-openai-agents>=0.1.0; extra == "all"
66
+ Dynamic: license-file
67
+
68
+ # mnemosyne-sdk
69
+
70
+ [![PyPI version](https://img.shields.io/pypi/v/mnemosyne-sdk.svg)](https://pypi.org/project/mnemosyne-sdk/)
71
+ [![Python versions](https://img.shields.io/pypi/pyversions/mnemosyne-sdk.svg)](https://pypi.org/project/mnemosyne-sdk/)
72
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
73
+ [![CI](https://github.com/synet-systems/mnemosyne/actions/workflows/ci.yml/badge.svg)](https://github.com/synet-systems/mnemosyne/actions)
74
+
75
+ > The official Python client for the Mnemosyne memory substrate. Synchronous and async APIs, container-scoped storage, hybrid BM25+vector recall, full type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx.
76
+
77
+ Mnemosyne gives any AI system persistent identity, episodic recall, contradiction resolution, metacognition, and a self-model that compounds across sessions. This SDK is the thin HTTP client that talks to a Mnemosyne Cloud or self-hosted Mnemosyne instance.
78
+
79
+ ## Install
80
+
81
+ ```bash
82
+ pip install mnemosyne-sdk
83
+ # or
84
+ uv add mnemosyne-sdk
85
+ # or
86
+ poetry add mnemosyne-sdk
87
+ ```
88
+
89
+ ## Quick start
90
+
91
+ ```python
92
+ from mnemosyne_sdk import Mnemosyne
93
+
94
+ mn = Mnemosyne(
95
+ api_key="mn_...", # from your Mnemosyne dashboard
96
+ # base_url="https://api.mnemosyne.geasslabs.xyz", # default
97
+ )
98
+
99
+ # Save a memory
100
+ memory = mn.add(
101
+ "The dock-A camera lost calibration at 14:32 UTC",
102
+ container_tag="fleet-ops",
103
+ metadata={"severity": "high"},
104
+ )
105
+ print(memory.id)
106
+
107
+ # Search
108
+ results = mn.search("when did dock A fail?", container_tag="fleet-ops")
109
+ for r in results:
110
+ print(f"{r.score:.3f} {r.content}")
111
+
112
+ # Get / delete
113
+ one = mn.get(memory.id)
114
+ mn.delete(memory.id)
115
+ ```
116
+
117
+ ## Async client
118
+
119
+ ```python
120
+ import asyncio
121
+ from mnemosyne_sdk import AsyncMnemosyne
122
+
123
+ async def main():
124
+ async with AsyncMnemosyne(api_key="mn_...") as mn:
125
+ await mn.add("...", container_tag="fleet-ops")
126
+ results = await mn.search("query", container_tag="fleet-ops")
127
+
128
+ asyncio.run(main())
129
+ ```
130
+
131
+ The async client shares the same `httpx` connection pool and is recommended for high-throughput agents.
132
+
133
+ ## Function-calling tools
134
+
135
+ ```python
136
+ from mnemosyne_sdk import TOOLS, execute_tool
137
+
138
+ # Pass TOOLS to any OpenAI-compatible function-calling API
139
+ response = client.chat.completions.create(
140
+ model="gpt-4",
141
+ messages=[...],
142
+ tools=TOOLS,
143
+ )
144
+
145
+ # Execute a tool call from the model's response
146
+ for call in response.choices[0].message.tool_calls:
147
+ result = execute_tool(
148
+ call.function.name,
149
+ call.function.arguments,
150
+ base_url="https://api.mnemosyne.geasslabs.xyz",
151
+ api_key="mn_...",
152
+ )
153
+ ```
154
+
155
+ ## Framework adapters
156
+
157
+ This package is the *core* client. For framework-specific integrations, install one of the dedicated adapter packages:
158
+
159
+ | Framework | Package | Install |
160
+ |---|---|---|
161
+ | LangChain / LangGraph | `mnemosyne-langchain` | `pip install mnemosyne-sdk[langchain]` |
162
+ | CrewAI | `mnemosyne-crewai` | `pip install mnemosyne-sdk[crewai]` |
163
+ | AutoGen v0.4 | `mnemosyne-autogen` | `pip install mnemosyne-sdk[autogen]` |
164
+ | OpenAI Agents SDK | `mnemosyne-openai-agents` | `pip install mnemosyne-sdk[openai-agents]` |
165
+
166
+ Or install everything: `pip install mnemosyne-sdk[all]`.
167
+
168
+ ## Error handling
169
+
170
+ ```python
171
+ from mnemosyne_sdk import Mnemosyne, AuthenticationError, RateLimitError
172
+
173
+ mn = Mnemosyne(api_key="...")
174
+
175
+ try:
176
+ mn.add("...")
177
+ except AuthenticationError:
178
+ ... # bad API key
179
+ except RateLimitError as e:
180
+ time.sleep(e.retry_after or 1)
181
+ ... # back off
182
+ ```
183
+
184
+ All errors inherit from `MnemosyneError`.
185
+
186
+ ## Configuration
187
+
188
+ | Env var | Description | Default |
189
+ |---|---|---|
190
+ | `MNEMOSYNE_API_KEY` | API key (overridden by constructor) | - |
191
+ | `MNEMOSYNE_BASE_URL` | Server URL | `https://api.mnemosyne.geasslabs.xyz` |
192
+ | `MNEMOSYNE_CONTAINER` | Default container tag | `default` |
193
+
194
+ ## Development
195
+
196
+ ```bash
197
+ git clone https://github.com/synet-systems/mnemosyne
198
+ cd mnemosyne/packages/mnemosyne-sdk-python
199
+ uv sync --all-extras
200
+ uv run pytest
201
+ ```
202
+
203
+ ## License
204
+
205
+ MIT © [Geass Labs](https://geasslabs.xyz). The Mnemosyne *engine* this SDK talks to is licensed under the [Mnemosyne Source-Available License v1.0](https://github.com/synet-systems/mnemosyne/blob/main/LICENSE). See [`NOTICE`](https://github.com/synet-systems/mnemosyne/blob/main/NOTICE) for the dual-license arrangement.
206
+
207
+ ## Links
208
+
209
+ - **Homepage**: https://mnemosyne.geasslabs.xyz
210
+ - **Documentation**: https://docs.geasslabs.xyz/mnemosyne-sdk
211
+ - **Repository**: https://github.com/synet-systems/mnemosyne
212
+ - **Issues**: https://github.com/synet-systems/mnemosyne/issues
213
+ - **Changelog**: [CHANGELOG.md](./CHANGELOG.md)
@@ -0,0 +1,146 @@
1
+ # mnemosyne-sdk
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/mnemosyne-sdk.svg)](https://pypi.org/project/mnemosyne-sdk/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/mnemosyne-sdk.svg)](https://pypi.org/project/mnemosyne-sdk/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
6
+ [![CI](https://github.com/synet-systems/mnemosyne/actions/workflows/ci.yml/badge.svg)](https://github.com/synet-systems/mnemosyne/actions)
7
+
8
+ > The official Python client for the Mnemosyne memory substrate. Synchronous and async APIs, container-scoped storage, hybrid BM25+vector recall, full type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx.
9
+
10
+ Mnemosyne gives any AI system persistent identity, episodic recall, contradiction resolution, metacognition, and a self-model that compounds across sessions. This SDK is the thin HTTP client that talks to a Mnemosyne Cloud or self-hosted Mnemosyne instance.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install mnemosyne-sdk
16
+ # or
17
+ uv add mnemosyne-sdk
18
+ # or
19
+ poetry add mnemosyne-sdk
20
+ ```
21
+
22
+ ## Quick start
23
+
24
+ ```python
25
+ from mnemosyne_sdk import Mnemosyne
26
+
27
+ mn = Mnemosyne(
28
+ api_key="mn_...", # from your Mnemosyne dashboard
29
+ # base_url="https://api.mnemosyne.geasslabs.xyz", # default
30
+ )
31
+
32
+ # Save a memory
33
+ memory = mn.add(
34
+ "The dock-A camera lost calibration at 14:32 UTC",
35
+ container_tag="fleet-ops",
36
+ metadata={"severity": "high"},
37
+ )
38
+ print(memory.id)
39
+
40
+ # Search
41
+ results = mn.search("when did dock A fail?", container_tag="fleet-ops")
42
+ for r in results:
43
+ print(f"{r.score:.3f} {r.content}")
44
+
45
+ # Get / delete
46
+ one = mn.get(memory.id)
47
+ mn.delete(memory.id)
48
+ ```
49
+
50
+ ## Async client
51
+
52
+ ```python
53
+ import asyncio
54
+ from mnemosyne_sdk import AsyncMnemosyne
55
+
56
+ async def main():
57
+ async with AsyncMnemosyne(api_key="mn_...") as mn:
58
+ await mn.add("...", container_tag="fleet-ops")
59
+ results = await mn.search("query", container_tag="fleet-ops")
60
+
61
+ asyncio.run(main())
62
+ ```
63
+
64
+ The async client shares the same `httpx` connection pool and is recommended for high-throughput agents.
65
+
66
+ ## Function-calling tools
67
+
68
+ ```python
69
+ from mnemosyne_sdk import TOOLS, execute_tool
70
+
71
+ # Pass TOOLS to any OpenAI-compatible function-calling API
72
+ response = client.chat.completions.create(
73
+ model="gpt-4",
74
+ messages=[...],
75
+ tools=TOOLS,
76
+ )
77
+
78
+ # Execute a tool call from the model's response
79
+ for call in response.choices[0].message.tool_calls:
80
+ result = execute_tool(
81
+ call.function.name,
82
+ call.function.arguments,
83
+ base_url="https://api.mnemosyne.geasslabs.xyz",
84
+ api_key="mn_...",
85
+ )
86
+ ```
87
+
88
+ ## Framework adapters
89
+
90
+ This package is the *core* client. For framework-specific integrations, install one of the dedicated adapter packages:
91
+
92
+ | Framework | Package | Install |
93
+ |---|---|---|
94
+ | LangChain / LangGraph | `mnemosyne-langchain` | `pip install mnemosyne-sdk[langchain]` |
95
+ | CrewAI | `mnemosyne-crewai` | `pip install mnemosyne-sdk[crewai]` |
96
+ | AutoGen v0.4 | `mnemosyne-autogen` | `pip install mnemosyne-sdk[autogen]` |
97
+ | OpenAI Agents SDK | `mnemosyne-openai-agents` | `pip install mnemosyne-sdk[openai-agents]` |
98
+
99
+ Or install everything: `pip install mnemosyne-sdk[all]`.
100
+
101
+ ## Error handling
102
+
103
+ ```python
104
+ from mnemosyne_sdk import Mnemosyne, AuthenticationError, RateLimitError
105
+
106
+ mn = Mnemosyne(api_key="...")
107
+
108
+ try:
109
+ mn.add("...")
110
+ except AuthenticationError:
111
+ ... # bad API key
112
+ except RateLimitError as e:
113
+ time.sleep(e.retry_after or 1)
114
+ ... # back off
115
+ ```
116
+
117
+ All errors inherit from `MnemosyneError`.
118
+
119
+ ## Configuration
120
+
121
+ | Env var | Description | Default |
122
+ |---|---|---|
123
+ | `MNEMOSYNE_API_KEY` | API key (overridden by constructor) | - |
124
+ | `MNEMOSYNE_BASE_URL` | Server URL | `https://api.mnemosyne.geasslabs.xyz` |
125
+ | `MNEMOSYNE_CONTAINER` | Default container tag | `default` |
126
+
127
+ ## Development
128
+
129
+ ```bash
130
+ git clone https://github.com/synet-systems/mnemosyne
131
+ cd mnemosyne/packages/mnemosyne-sdk-python
132
+ uv sync --all-extras
133
+ uv run pytest
134
+ ```
135
+
136
+ ## License
137
+
138
+ MIT © [Geass Labs](https://geasslabs.xyz). The Mnemosyne *engine* this SDK talks to is licensed under the [Mnemosyne Source-Available License v1.0](https://github.com/synet-systems/mnemosyne/blob/main/LICENSE). See [`NOTICE`](https://github.com/synet-systems/mnemosyne/blob/main/NOTICE) for the dual-license arrangement.
139
+
140
+ ## Links
141
+
142
+ - **Homepage**: https://mnemosyne.geasslabs.xyz
143
+ - **Documentation**: https://docs.geasslabs.xyz/mnemosyne-sdk
144
+ - **Repository**: https://github.com/synet-systems/mnemosyne
145
+ - **Issues**: https://github.com/synet-systems/mnemosyne/issues
146
+ - **Changelog**: [CHANGELOG.md](./CHANGELOG.md)
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemosyne-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Mnemosyne memory substrate. Sync and async clients, container-scoped storage, hybrid BM25+vector recall, full Pydantic type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx.
5
+ Author-email: Mashle Burneded <mashle@geasslabs.xyz>
6
+ Maintainer-email: Geass Labs <team@geasslabs.xyz>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 Geass Labs
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://mnemosyne.geasslabs.xyz
30
+ Project-URL: Documentation, https://docs.geasslabs.xyz/mnemosyne-sdk
31
+ Project-URL: Repository, https://github.com/synet-systems/mnemosyne/tree/main/packages/mnemosyne-sdk-python
32
+ Project-URL: Issues, https://github.com/synet-systems/mnemosyne/issues
33
+ Project-URL: Changelog, https://github.com/synet-systems/mnemosyne/blob/main/packages/mnemosyne-sdk-python/CHANGELOG.md
34
+ Keywords: mnemosyne,ai,llm,memory,agent,agent-memory,rag,retrieval-augmented-generation,long-term-memory,vector-search,sdk
35
+ Classifier: Development Status :: 4 - Beta
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Programming Language :: Python :: 3
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Programming Language :: Python :: 3.13
43
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
44
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
45
+ Classifier: Typing :: Typed
46
+ Requires-Python: >=3.11
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ License-File: LICENSE-MIT
50
+ License-File: NOTICE
51
+ Requires-Dist: httpx>=0.27.0
52
+ Requires-Dist: pydantic>=2.7.0
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
55
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
56
+ Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
57
+ Requires-Dist: ruff>=0.5.0; extra == "dev"
58
+ Requires-Dist: mypy>=1.10.0; extra == "dev"
59
+ Requires-Dist: respx>=0.21.0; extra == "dev"
60
+ Requires-Dist: anyio>=4.0.0; extra == "dev"
61
+ Provides-Extra: all
62
+ Requires-Dist: mnemosyne-langchain>=0.1.0; extra == "all"
63
+ Requires-Dist: mnemosyne-crewai>=0.1.0; extra == "all"
64
+ Requires-Dist: mnemosyne-autogen>=0.1.0; extra == "all"
65
+ Requires-Dist: mnemosyne-openai-agents>=0.1.0; extra == "all"
66
+ Dynamic: license-file
67
+
68
+ # mnemosyne-sdk
69
+
70
+ [![PyPI version](https://img.shields.io/pypi/v/mnemosyne-sdk.svg)](https://pypi.org/project/mnemosyne-sdk/)
71
+ [![Python versions](https://img.shields.io/pypi/pyversions/mnemosyne-sdk.svg)](https://pypi.org/project/mnemosyne-sdk/)
72
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
73
+ [![CI](https://github.com/synet-systems/mnemosyne/actions/workflows/ci.yml/badge.svg)](https://github.com/synet-systems/mnemosyne/actions)
74
+
75
+ > The official Python client for the Mnemosyne memory substrate. Synchronous and async APIs, container-scoped storage, hybrid BM25+vector recall, full type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx.
76
+
77
+ Mnemosyne gives any AI system persistent identity, episodic recall, contradiction resolution, metacognition, and a self-model that compounds across sessions. This SDK is the thin HTTP client that talks to a Mnemosyne Cloud or self-hosted Mnemosyne instance.
78
+
79
+ ## Install
80
+
81
+ ```bash
82
+ pip install mnemosyne-sdk
83
+ # or
84
+ uv add mnemosyne-sdk
85
+ # or
86
+ poetry add mnemosyne-sdk
87
+ ```
88
+
89
+ ## Quick start
90
+
91
+ ```python
92
+ from mnemosyne_sdk import Mnemosyne
93
+
94
+ mn = Mnemosyne(
95
+ api_key="mn_...", # from your Mnemosyne dashboard
96
+ # base_url="https://api.mnemosyne.geasslabs.xyz", # default
97
+ )
98
+
99
+ # Save a memory
100
+ memory = mn.add(
101
+ "The dock-A camera lost calibration at 14:32 UTC",
102
+ container_tag="fleet-ops",
103
+ metadata={"severity": "high"},
104
+ )
105
+ print(memory.id)
106
+
107
+ # Search
108
+ results = mn.search("when did dock A fail?", container_tag="fleet-ops")
109
+ for r in results:
110
+ print(f"{r.score:.3f} {r.content}")
111
+
112
+ # Get / delete
113
+ one = mn.get(memory.id)
114
+ mn.delete(memory.id)
115
+ ```
116
+
117
+ ## Async client
118
+
119
+ ```python
120
+ import asyncio
121
+ from mnemosyne_sdk import AsyncMnemosyne
122
+
123
+ async def main():
124
+ async with AsyncMnemosyne(api_key="mn_...") as mn:
125
+ await mn.add("...", container_tag="fleet-ops")
126
+ results = await mn.search("query", container_tag="fleet-ops")
127
+
128
+ asyncio.run(main())
129
+ ```
130
+
131
+ The async client shares the same `httpx` connection pool and is recommended for high-throughput agents.
132
+
133
+ ## Function-calling tools
134
+
135
+ ```python
136
+ from mnemosyne_sdk import TOOLS, execute_tool
137
+
138
+ # Pass TOOLS to any OpenAI-compatible function-calling API
139
+ response = client.chat.completions.create(
140
+ model="gpt-4",
141
+ messages=[...],
142
+ tools=TOOLS,
143
+ )
144
+
145
+ # Execute a tool call from the model's response
146
+ for call in response.choices[0].message.tool_calls:
147
+ result = execute_tool(
148
+ call.function.name,
149
+ call.function.arguments,
150
+ base_url="https://api.mnemosyne.geasslabs.xyz",
151
+ api_key="mn_...",
152
+ )
153
+ ```
154
+
155
+ ## Framework adapters
156
+
157
+ This package is the *core* client. For framework-specific integrations, install one of the dedicated adapter packages:
158
+
159
+ | Framework | Package | Install |
160
+ |---|---|---|
161
+ | LangChain / LangGraph | `mnemosyne-langchain` | `pip install mnemosyne-sdk[langchain]` |
162
+ | CrewAI | `mnemosyne-crewai` | `pip install mnemosyne-sdk[crewai]` |
163
+ | AutoGen v0.4 | `mnemosyne-autogen` | `pip install mnemosyne-sdk[autogen]` |
164
+ | OpenAI Agents SDK | `mnemosyne-openai-agents` | `pip install mnemosyne-sdk[openai-agents]` |
165
+
166
+ Or install everything: `pip install mnemosyne-sdk[all]`.
167
+
168
+ ## Error handling
169
+
170
+ ```python
171
+ from mnemosyne_sdk import Mnemosyne, AuthenticationError, RateLimitError
172
+
173
+ mn = Mnemosyne(api_key="...")
174
+
175
+ try:
176
+ mn.add("...")
177
+ except AuthenticationError:
178
+ ... # bad API key
179
+ except RateLimitError as e:
180
+ time.sleep(e.retry_after or 1)
181
+ ... # back off
182
+ ```
183
+
184
+ All errors inherit from `MnemosyneError`.
185
+
186
+ ## Configuration
187
+
188
+ | Env var | Description | Default |
189
+ |---|---|---|
190
+ | `MNEMOSYNE_API_KEY` | API key (overridden by constructor) | - |
191
+ | `MNEMOSYNE_BASE_URL` | Server URL | `https://api.mnemosyne.geasslabs.xyz` |
192
+ | `MNEMOSYNE_CONTAINER` | Default container tag | `default` |
193
+
194
+ ## Development
195
+
196
+ ```bash
197
+ git clone https://github.com/synet-systems/mnemosyne
198
+ cd mnemosyne/packages/mnemosyne-sdk-python
199
+ uv sync --all-extras
200
+ uv run pytest
201
+ ```
202
+
203
+ ## License
204
+
205
+ MIT © [Geass Labs](https://geasslabs.xyz). The Mnemosyne *engine* this SDK talks to is licensed under the [Mnemosyne Source-Available License v1.0](https://github.com/synet-systems/mnemosyne/blob/main/LICENSE). See [`NOTICE`](https://github.com/synet-systems/mnemosyne/blob/main/NOTICE) for the dual-license arrangement.
206
+
207
+ ## Links
208
+
209
+ - **Homepage**: https://mnemosyne.geasslabs.xyz
210
+ - **Documentation**: https://docs.geasslabs.xyz/mnemosyne-sdk
211
+ - **Repository**: https://github.com/synet-systems/mnemosyne
212
+ - **Issues**: https://github.com/synet-systems/mnemosyne/issues
213
+ - **Changelog**: [CHANGELOG.md](./CHANGELOG.md)
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ LICENSE-MIT
3
+ NOTICE
4
+ README.md
5
+ pyproject.toml
6
+ mnemosyne_sdk.egg-info/PKG-INFO
7
+ mnemosyne_sdk.egg-info/SOURCES.txt
8
+ mnemosyne_sdk.egg-info/dependency_links.txt
9
+ mnemosyne_sdk.egg-info/requires.txt
10
+ mnemosyne_sdk.egg-info/top_level.txt
11
+ tests/test_client.py
@@ -0,0 +1,17 @@
1
+ httpx>=0.27.0
2
+ pydantic>=2.7.0
3
+
4
+ [all]
5
+ mnemosyne-langchain>=0.1.0
6
+ mnemosyne-crewai>=0.1.0
7
+ mnemosyne-autogen>=0.1.0
8
+ mnemosyne-openai-agents>=0.1.0
9
+
10
+ [dev]
11
+ pytest>=8.0.0
12
+ pytest-asyncio>=0.23.0
13
+ pytest-cov>=5.0.0
14
+ ruff>=0.5.0
15
+ mypy>=1.10.0
16
+ respx>=0.21.0
17
+ anyio>=4.0.0
@@ -0,0 +1,97 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mnemosyne-sdk"
7
+ version = "0.1.0"
8
+ description = "Official Python SDK for the Mnemosyne memory substrate. Sync and async clients, container-scoped storage, hybrid BM25+vector recall, full Pydantic type stubs. Talks to any Mnemosyne endpoint over HTTPS via httpx."
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ authors = [
12
+ { name = "Mashle Burneded", email = "mashle@geasslabs.xyz" },
13
+ ]
14
+ maintainers = [
15
+ { name = "Geass Labs", email = "team@geasslabs.xyz" },
16
+ ]
17
+ requires-python = ">=3.11"
18
+ keywords = [
19
+ "mnemosyne",
20
+ "ai",
21
+ "llm",
22
+ "memory",
23
+ "agent",
24
+ "agent-memory",
25
+ "rag",
26
+ "retrieval-augmented-generation",
27
+ "long-term-memory",
28
+ "vector-search",
29
+ "sdk",
30
+ ]
31
+ classifiers = [
32
+ "Development Status :: 4 - Beta",
33
+ "Intended Audience :: Developers",
34
+ "License :: OSI Approved :: MIT License",
35
+ "Operating System :: OS Independent",
36
+ "Programming Language :: Python :: 3",
37
+ "Programming Language :: Python :: 3.11",
38
+ "Programming Language :: Python :: 3.12",
39
+ "Programming Language :: Python :: 3.13",
40
+ "Topic :: Software Development :: Libraries :: Python Modules",
41
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
42
+ "Typing :: Typed",
43
+ ]
44
+
45
+ dependencies = [
46
+ "httpx>=0.27.0",
47
+ "pydantic>=2.7.0",
48
+ ]
49
+
50
+ [project.optional-dependencies]
51
+ dev = [
52
+ "pytest>=8.0.0",
53
+ "pytest-asyncio>=0.23.0",
54
+ "pytest-cov>=5.0.0",
55
+ "ruff>=0.5.0",
56
+ "mypy>=1.10.0",
57
+ "respx>=0.21.0",
58
+ "anyio>=4.0.0",
59
+ ]
60
+ all = [
61
+ "mnemosyne-langchain>=0.1.0",
62
+ "mnemosyne-crewai>=0.1.0",
63
+ "mnemosyne-autogen>=0.1.0",
64
+ "mnemosyne-openai-agents>=0.1.0",
65
+ ]
66
+
67
+ [project.urls]
68
+ Homepage = "https://mnemosyne.geasslabs.xyz"
69
+ Documentation = "https://docs.geasslabs.xyz/mnemosyne-sdk"
70
+ Repository = "https://github.com/synet-systems/mnemosyne/tree/main/packages/mnemosyne-sdk-python"
71
+ Issues = "https://github.com/synet-systems/mnemosyne/issues"
72
+ Changelog = "https://github.com/synet-systems/mnemosyne/blob/main/packages/mnemosyne-sdk-python/CHANGELOG.md"
73
+
74
+ [tool.setuptools.packages.find]
75
+ include = ["mnemosyne_sdk*"]
76
+
77
+ [tool.setuptools.package-data]
78
+ mnemosyne_sdk = ["py.typed"]
79
+
80
+ [tool.ruff]
81
+ line-length = 100
82
+ target-version = "py311"
83
+
84
+ [tool.ruff.lint]
85
+ select = ["E", "F", "I", "W", "B", "UP", "N", "C4", "RET", "SIM", "RUF"]
86
+ ignore = ["E501"]
87
+
88
+ [tool.mypy]
89
+ python_version = "3.11"
90
+ strict = true
91
+ warn_unused_ignores = true
92
+ warn_redundant_casts = true
93
+
94
+ [tool.pytest.ini_options]
95
+ asyncio_mode = "auto"
96
+ testpaths = ["tests"]
97
+ addopts = "-ra --strict-markers"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,126 @@
1
+ """Tests for the sync Mnemosyne client."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import pytest
6
+ import respx
7
+ from httpx import Response
8
+
9
+ from mnemosyne_sdk import (
10
+ AuthenticationError,
11
+ Mnemosyne,
12
+ MnemosyneError,
13
+ NotFoundError,
14
+ RateLimitError,
15
+ ServerError,
16
+ ValidationError,
17
+ )
18
+
19
+
20
+ BASE_URL = "https://api.mnemosyne.test"
21
+ API_KEY = "mn_test_123"
22
+
23
+
24
+ @pytest.fixture
25
+ def mn() -> Mnemosyne:
26
+ return Mnemosyne(api_key=API_KEY, base_url=BASE_URL)
27
+
28
+
29
+ class TestAdd:
30
+ @respx.mock
31
+ def test_add_returns_memory(self, mn: Mnemosyne) -> None:
32
+ respx.post(f"{BASE_URL}/memories").mock(
33
+ return_value=Response(
34
+ 200,
35
+ json={
36
+ "id": "mem_1",
37
+ "content": "hello",
38
+ "container_tag": "default",
39
+ "source": None,
40
+ "created_at": "2026-06-14T00:00:00Z",
41
+ "updated_at": None,
42
+ "metadata": {},
43
+ },
44
+ )
45
+ )
46
+ mem = mn.add("hello")
47
+ assert mem.id == "mem_1"
48
+ assert mem.content == "hello"
49
+
50
+ @respx.mock
51
+ def test_add_passes_container_tag(self, mn: Mnemosyne) -> None:
52
+ route = respx.post(f"{BASE_URL}/memories").mock(
53
+ return_value=Response(200, json={
54
+ "id": "mem_1", "content": "x", "container_tag": "c1",
55
+ "source": None, "created_at": None, "updated_at": None, "metadata": {}
56
+ })
57
+ )
58
+ mn.add("x", container_tag="c1")
59
+ sent = route.calls.last.request
60
+ import json
61
+ body = json.loads(sent.content)
62
+ assert body["container_tag"] == "c1"
63
+
64
+
65
+ class TestSearch:
66
+ @respx.mock
67
+ def test_search_returns_results(self, mn: Mnemosyne) -> None:
68
+ respx.get(f"{BASE_URL}/memories/search").mock(
69
+ return_value=Response(200, json={
70
+ "results": [
71
+ {"id": "m1", "content": "foo", "container_tag": "c1", "score": 0.9, "source": None, "metadata": None},
72
+ ]
73
+ })
74
+ )
75
+ results = mn.search("foo")
76
+ assert len(results) == 1
77
+ assert results[0].score == pytest.approx(0.9)
78
+
79
+
80
+ class TestErrors:
81
+ @respx.mock
82
+ def test_401_raises_authentication_error(self, mn: Mnemosyne) -> None:
83
+ respx.post(f"{BASE_URL}/memories").mock(
84
+ return_value=Response(401, json={"detail": "bad key"})
85
+ )
86
+ with pytest.raises(AuthenticationError):
87
+ mn.add("x")
88
+
89
+ @respx.mock
90
+ def test_404_raises_not_found(self, mn: Mnemosyne) -> None:
91
+ respx.get(f"{BASE_URL}/memories/missing").mock(
92
+ return_value=Response(404, json={"detail": "not found"})
93
+ )
94
+ with pytest.raises(NotFoundError):
95
+ mn.get("missing")
96
+
97
+ @respx.mock
98
+ def test_429_raises_rate_limit(self, mn: Mnemosyne) -> None:
99
+ respx.post(f"{BASE_URL}/memories").mock(
100
+ return_value=Response(429, json={"detail": "slow down"}, headers={"retry-after": "1"})
101
+ )
102
+ with pytest.raises(RateLimitError) as exc:
103
+ mn.add("x")
104
+ assert exc.value.retry_after == 1
105
+
106
+ @respx.mock
107
+ def test_500_raises_server_error(self, mn: Mnemosyne) -> None:
108
+ respx.post(f"{BASE_URL}/memories").mock(
109
+ return_value=Response(500, json={"detail": "oops"})
110
+ )
111
+ with pytest.raises(ServerError):
112
+ mn.add("x")
113
+
114
+ @respx.mock
115
+ def test_422_raises_validation_error(self, mn: Mnemosyne) -> None:
116
+ respx.post(f"{BASE_URL}/memories").mock(
117
+ return_value=Response(422, json={"detail": "bad input"})
118
+ )
119
+ with pytest.raises(ValidationError):
120
+ mn.add("")
121
+
122
+
123
+ class TestMnemosyneErrorInheritance:
124
+ def test_all_errors_subclass_mnemosyne_error(self) -> None:
125
+ for cls in (AuthenticationError, NotFoundError, RateLimitError, ServerError, ValidationError):
126
+ assert issubclass(cls, MnemosyneError)