memorylayer-client 0.0.1.post1__py3-none-any.whl

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,293 @@
1
+ Metadata-Version: 2.4
2
+ Name: memorylayer-client
3
+ Version: 0.0.1.post1
4
+ Summary: Python SDK for MemoryLayer.ai - memory infrastructure for AI agents
5
+ Project-URL: Homepage, https://memorylayer.ai
6
+ Project-URL: Documentation, https://docs.memorylayer.ai
7
+ Project-URL: Repository, https://github.com/scitrera/memorylayer
8
+ Project-URL: Issues, https://github.com/scitrera/memorylayer/issues
9
+ Author-email: Scitrera <open-source-team@scitrera.com>
10
+ License: Apache 2.0
11
+ License-File: LICENSE
12
+ Keywords: agents,ai,llm,memory,vector-search
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.12
20
+ Requires-Dist: httpx>=0.26.0
21
+ Requires-Dist: pydantic>=2.5.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
24
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
26
+ Requires-Dist: respx>=0.20.0; extra == 'dev'
27
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # MemoryLayer.ai Python SDK
31
+
32
+ Python SDK for [MemoryLayer.ai](https://memorylayer.ai) - Memory infrastructure for AI agents.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install memorylayer-client
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ```python
43
+ from memorylayer import MemoryLayerClient, MemoryType
44
+
45
+ async with MemoryLayerClient(
46
+ base_url="https://api.memorylayer.ai",
47
+ api_key="your-api-key",
48
+ workspace_id="ws_123"
49
+ ) as client:
50
+ # Store a memory
51
+ memory = await client.remember(
52
+ content="User prefers Python for backend development",
53
+ type=MemoryType.SEMANTIC,
54
+ importance=0.8,
55
+ tags=["preferences", "programming"]
56
+ )
57
+
58
+ # Search memories
59
+ results = await client.recall(
60
+ query="what programming language does the user prefer?",
61
+ limit=5
62
+ )
63
+
64
+ for memory in results.memories:
65
+ print(f"{memory.content} (relevance: {memory.importance})")
66
+
67
+ # Synthesize memories
68
+ reflection = await client.reflect(
69
+ query="summarize user's technology preferences"
70
+ )
71
+ print(reflection.reflection)
72
+ ```
73
+
74
+ ## Features
75
+
76
+ - **Simple, Pythonic API** - Async/await support with context managers
77
+ - **Type-safe** - Full type hints with Pydantic models
78
+ - **Memory Operations** - Remember, recall, reflect, forget
79
+ - **Relationship Graph** - Link memories with typed relationships
80
+ - **Session Management** - Working memory with TTL
81
+ - **Error Handling** - Comprehensive exception hierarchy
82
+
83
+ ## Core Operations
84
+
85
+ ### Remember (Store Memory)
86
+
87
+ ```python
88
+ memory = await client.remember(
89
+ content="User prefers FastAPI over Flask",
90
+ type=MemoryType.SEMANTIC,
91
+ subtype=MemorySubtype.PREFERENCE,
92
+ importance=0.8,
93
+ tags=["preferences", "frameworks"],
94
+ metadata={"source": "conversation"}
95
+ )
96
+ ```
97
+
98
+ ### Recall (Search Memories)
99
+
100
+ ```python
101
+ from memorylayer import RecallMode, SearchTolerance
102
+
103
+ results = await client.recall(
104
+ query="what frameworks does the user prefer?",
105
+ types=[MemoryType.SEMANTIC],
106
+ mode=RecallMode.RAG, # or RecallMode.LLM for deep semantic search
107
+ limit=10,
108
+ min_relevance=0.7,
109
+ tolerance=SearchTolerance.MODERATE
110
+ )
111
+ ```
112
+
113
+ ### Reflect (Synthesize Memories)
114
+
115
+ ```python
116
+ reflection = await client.reflect(
117
+ query="summarize everything about the user's development workflow",
118
+ max_tokens=500,
119
+ include_sources=True
120
+ )
121
+
122
+ print(reflection.reflection)
123
+ print(f"Based on {len(reflection.source_memories)} memories")
124
+ ```
125
+
126
+ ### Associate (Link Memories)
127
+
128
+ ```python
129
+ from memorylayer import RelationshipType
130
+
131
+ association = await client.associate(
132
+ source_id="mem_problem_123",
133
+ target_id="mem_solution_456",
134
+ relationship=RelationshipType.SOLVES,
135
+ strength=0.9
136
+ )
137
+ ```
138
+
139
+ ### Session Management
140
+
141
+ ```python
142
+ # Create session for working memory
143
+ session = await client.create_session(ttl_seconds=3600)
144
+
145
+ # Store temporary context
146
+ await client.set_context(
147
+ session.id,
148
+ "current_task",
149
+ {"description": "Debugging auth", "file": "auth.py"}
150
+ )
151
+
152
+ # Retrieve context
153
+ context = await client.get_context(session.id, ["current_task"])
154
+ ```
155
+
156
+ ## Memory Types
157
+
158
+ ### Cognitive Types
159
+
160
+ - **Episodic** - Specific events/interactions
161
+ - **Semantic** - Facts, concepts, relationships
162
+ - **Procedural** - How to do things
163
+ - **Working** - Current task context (session-scoped)
164
+
165
+ ### Domain Subtypes
166
+
167
+ - **Solution** - Working fixes to problems
168
+ - **Problem** - Issues encountered
169
+ - **CodePattern** - Reusable patterns
170
+ - **Fix** - Bug fixes with context
171
+ - **Error** - Error patterns and resolutions
172
+ - **Workflow** - Process knowledge
173
+ - **Preference** - User/project preferences
174
+ - **Decision** - Architectural decisions
175
+
176
+ ## Relationship Types
177
+
178
+ Link memories with typed relationships:
179
+
180
+ ```python
181
+ from memorylayer import RelationshipType
182
+
183
+ # Causal
184
+ RelationshipType.CAUSES
185
+ RelationshipType.TRIGGERS
186
+ RelationshipType.LEADS_TO
187
+
188
+ # Solution
189
+ RelationshipType.SOLVES
190
+ RelationshipType.ADDRESSES
191
+ RelationshipType.IMPROVES
192
+
193
+ # Learning
194
+ RelationshipType.BUILDS_ON
195
+ RelationshipType.CONTRADICTS
196
+ RelationshipType.SUPERSEDES
197
+
198
+ # ... and more
199
+ ```
200
+
201
+ ## Error Handling
202
+
203
+ ```python
204
+ from memorylayer import (
205
+ AuthenticationError,
206
+ NotFoundError,
207
+ ValidationError,
208
+ RateLimitError,
209
+ ServerError
210
+ )
211
+
212
+ try:
213
+ memory = await client.get_memory("mem_123")
214
+ except NotFoundError:
215
+ print("Memory not found")
216
+ except AuthenticationError:
217
+ print("Invalid API key")
218
+ except RateLimitError:
219
+ print("Rate limit exceeded")
220
+ ```
221
+
222
+ ## Advanced Usage
223
+
224
+ ### Get Session Briefing
225
+
226
+ ```python
227
+ briefing = await client.get_briefing(lookback_hours=24)
228
+
229
+ print(f"Total memories: {briefing.workspace_summary['total_memories']}")
230
+ print(f"Recent activity: {len(briefing.recent_activity)} events")
231
+
232
+ for thread in briefing.open_threads:
233
+ print(f"Open: {thread.topic} - {thread.status}")
234
+ ```
235
+
236
+ ### Update Memory
237
+
238
+ ```python
239
+ updated = await client.update_memory(
240
+ "mem_123",
241
+ importance=0.9,
242
+ tags=["critical", "preferences"]
243
+ )
244
+ ```
245
+
246
+ ### Get Associations
247
+
248
+ ```python
249
+ associations = await client.get_associations(
250
+ "mem_123",
251
+ direction="both" # or "outgoing" or "incoming"
252
+ )
253
+
254
+ for assoc in associations:
255
+ print(f"{assoc.relationship}: {assoc.target_id}")
256
+ ```
257
+
258
+ ## Development
259
+
260
+ ### Install Development Dependencies
261
+
262
+ ```bash
263
+ pip install -e ".[dev]"
264
+ ```
265
+
266
+ ### Run Tests
267
+
268
+ ```bash
269
+ pytest
270
+ ```
271
+
272
+ ### Type Checking
273
+
274
+ ```bash
275
+ mypy src/memorylayer
276
+ ```
277
+
278
+ ### Linting
279
+
280
+ ```bash
281
+ ruff check src/memorylayer
282
+ black src/memorylayer
283
+ ```
284
+
285
+ ## License
286
+
287
+ Apache 2.0 License - see LICENSE file for details.
288
+
289
+ ## Links
290
+
291
+ - [Documentation](https://docs.memorylayer.ai)
292
+ - [GitHub](https://github.com/scitrera/memorylayer)
293
+ - [Homepage](https://memorylayer.ai)
@@ -0,0 +1,4 @@
1
+ memorylayer_client-0.0.1.post1.dist-info/METADATA,sha256=CiXrdcllh3DLfRoLzZOVFRA1rKQa-q28uxNu6kGmMbA,6785
2
+ memorylayer_client-0.0.1.post1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
3
+ memorylayer_client-0.0.1.post1.dist-info/licenses/LICENSE,sha256=kiPW-nYAlLU1CYR_ZwQndINVMphfJIqMIf62JuwoPFg,1065
4
+ memorylayer_client-0.0.1.post1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Scitrera
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.