AbstractMemory 0.0.1__tar.gz → 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.
Files changed (33) hide show
  1. abstractmemory-0.1.0/AbstractMemory.egg-info/PKG-INFO +331 -0
  2. abstractmemory-0.1.0/AbstractMemory.egg-info/SOURCES.txt +25 -0
  3. abstractmemory-0.1.0/AbstractMemory.egg-info/requires.txt +12 -0
  4. {abstractmemory-0.0.1 → abstractmemory-0.1.0}/LICENSE +4 -1
  5. abstractmemory-0.1.0/PKG-INFO +331 -0
  6. abstractmemory-0.1.0/README.md +294 -0
  7. abstractmemory-0.1.0/abstractmemory/__init__.py +754 -0
  8. abstractmemory-0.1.0/abstractmemory/cognitive/__init__.py +1 -0
  9. abstractmemory-0.1.0/abstractmemory/components/__init__.py +1 -0
  10. abstractmemory-0.1.0/abstractmemory/components/core.py +112 -0
  11. abstractmemory-0.1.0/abstractmemory/components/episodic.py +68 -0
  12. abstractmemory-0.1.0/abstractmemory/components/semantic.py +102 -0
  13. abstractmemory-0.1.0/abstractmemory/components/working.py +50 -0
  14. abstractmemory-0.1.0/abstractmemory/core/__init__.py +1 -0
  15. abstractmemory-0.1.0/abstractmemory/core/interfaces.py +95 -0
  16. abstractmemory-0.1.0/abstractmemory/core/temporal.py +100 -0
  17. abstractmemory-0.1.0/abstractmemory/graph/__init__.py +1 -0
  18. abstractmemory-0.1.0/abstractmemory/graph/knowledge_graph.py +178 -0
  19. abstractmemory-0.1.0/abstractmemory/simple.py +151 -0
  20. abstractmemory-0.1.0/abstractmemory/storage/__init__.py +16 -0
  21. abstractmemory-0.1.0/abstractmemory/storage/dual_manager.py +278 -0
  22. abstractmemory-0.1.0/abstractmemory/storage/lancedb_storage.py +425 -0
  23. abstractmemory-0.1.0/abstractmemory/storage/markdown_storage.py +447 -0
  24. abstractmemory-0.1.0/pyproject.toml +52 -0
  25. abstractmemory-0.0.1/PKG-INFO +0 -94
  26. abstractmemory-0.0.1/README.md +0 -67
  27. abstractmemory-0.0.1/pyproject.toml +0 -42
  28. abstractmemory-0.0.1/src/AbstractMemory.egg-info/PKG-INFO +0 -94
  29. abstractmemory-0.0.1/src/AbstractMemory.egg-info/SOURCES.txt +0 -8
  30. abstractmemory-0.0.1/src/abstractmemory/__init__.py +0 -41
  31. {abstractmemory-0.0.1/src → abstractmemory-0.1.0}/AbstractMemory.egg-info/dependency_links.txt +0 -0
  32. {abstractmemory-0.0.1/src → abstractmemory-0.1.0}/AbstractMemory.egg-info/top_level.txt +0 -0
  33. {abstractmemory-0.0.1 → abstractmemory-0.1.0}/setup.cfg +0 -0
@@ -0,0 +1,331 @@
1
+ Metadata-Version: 2.4
2
+ Name: AbstractMemory
3
+ Version: 0.1.0
4
+ Summary: Intelligent memory system for LLM agents with two-tier architecture - temporal knowledge graph memory for sophisticated AI agents
5
+ Author-email: AbstractMemory Team <lpalbou@gmail.com>
6
+ Maintainer-email: AbstractMemory Team <palbou@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/lpalbou/AbstractAgent
9
+ Project-URL: Documentation, https://github.com/lpalbou/AbstractAgent#readme
10
+ Project-URL: Repository, https://github.com/lpalbou/AbstractAgent
11
+ Project-URL: Bug Reports, https://github.com/lpalbou/AbstractAgent/issues
12
+ Keywords: llm,memory,stateful,ai,agents,knowledge-graph,temporal,grounded-memory
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: networkx>=3.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest; extra == "dev"
30
+ Requires-Dist: black; extra == "dev"
31
+ Requires-Dist: mypy; extra == "dev"
32
+ Provides-Extra: llm
33
+ Requires-Dist: abstractllm>=0.5.0; extra == "llm"
34
+ Provides-Extra: storage
35
+ Requires-Dist: lancedb; extra == "storage"
36
+ Dynamic: license-file
37
+
38
+ # AbstractMemory
39
+
40
+ **Intelligent memory system for LLM agents with two-tier architecture**
41
+
42
+ AbstractMemory provides efficient, purpose-built memory solutions for different types of LLM agents - from simple task-specific tools to sophisticated autonomous agents with persistent, grounded memory.
43
+
44
+ ## 🎯 Project Goals
45
+
46
+ AbstractMemory is part of the **AbstractLLM ecosystem** refactoring, designed to power both simple and complex AI agents:
47
+
48
+ - **Simple agents** (ReAct, task tools) get lightweight, efficient memory
49
+ - **Autonomous agents** get sophisticated temporal memory with user tracking
50
+ - **No over-engineering** - memory complexity matches agent purpose
51
+
52
+ ## 🏗️ Architecture Overview
53
+
54
+ ```
55
+ ┌─────────────────────────────────────────────────────────────┐
56
+ │ AbstractLLM Ecosystem │
57
+ ├─────────────────┬─────────────────┬─────────────────────────┤
58
+ │ AbstractCore │ AbstractMemory │ AbstractAgent │
59
+ │ │ │ │
60
+ │ • LLM Providers │ • Simple Memory │ • ReAct Agents │
61
+ │ • Sessions │ • Complex Memory│ • Autonomous Agents │
62
+ │ • Tools │ • Temporal KG │ • Multi-user Agents │
63
+ └─────────────────┴─────────────────┴─────────────────────────┘
64
+ ```
65
+
66
+ ## 🧠 Two-Tier Memory Strategy
67
+
68
+ ### Tier 1: Simple Memory (Task Agents)
69
+ Perfect for focused, single-purpose agents:
70
+
71
+ ```python
72
+ from abstractmemory import create_memory
73
+
74
+ # ReAct agent memory
75
+ scratchpad = create_memory("scratchpad", max_entries=50)
76
+ scratchpad.add_thought("User wants to learn Python")
77
+ scratchpad.add_action("search", {"query": "Python tutorials"})
78
+ scratchpad.add_observation("Found great tutorials")
79
+
80
+ # Simple chatbot memory
81
+ buffer = create_memory("buffer", max_messages=100)
82
+ buffer.add_message("user", "Hello!")
83
+ buffer.add_message("assistant", "Hi there!")
84
+ ```
85
+
86
+ ### Tier 2: Complex Memory (Autonomous Agents)
87
+ For sophisticated agents with persistence and learning:
88
+
89
+ ```python
90
+ # Autonomous agent with full memory capabilities
91
+ memory = create_memory("grounded", working_capacity=10, enable_kg=True)
92
+
93
+ # Multi-user context
94
+ memory.set_current_user("alice", relationship="owner")
95
+ memory.add_interaction("I love Python", "Python is excellent!")
96
+ memory.learn_about_user("Python developer")
97
+
98
+ # Get personalized context
99
+ context = memory.get_full_context("programming", user_id="alice")
100
+ ```
101
+
102
+ ## 🔧 Quick Start
103
+
104
+ ### Installation
105
+
106
+ ```bash
107
+ pip install abstractmemory
108
+
109
+ # For real LLM integration tests
110
+ pip install abstractmemory[llm]
111
+
112
+ # For LanceDB storage (optional)
113
+ pip install lancedb
114
+ ```
115
+
116
+ ### Basic Usage
117
+
118
+ ```python
119
+ from abstractmemory import create_memory
120
+
121
+ # 1. Choose memory type based on agent purpose
122
+ memory = create_memory("scratchpad") # Simple task agent
123
+ memory = create_memory("buffer") # Simple chatbot
124
+ memory = create_memory("grounded") # Autonomous agent
125
+
126
+ # 2. Use memory in your agent
127
+ if agent_type == "react":
128
+ memory.add_thought("Planning the solution...")
129
+ memory.add_action("execute", {"command": "analyze"})
130
+ memory.add_observation("Analysis complete")
131
+
132
+ elif agent_type == "autonomous":
133
+ memory.set_current_user("user123")
134
+ memory.add_interaction(user_input, agent_response)
135
+ context = memory.get_full_context(query)
136
+ ```
137
+
138
+ ### 🗂️ Persistent Storage Options
139
+
140
+ AbstractMemory now supports sophisticated storage for observable, searchable AI memory:
141
+
142
+ #### Observable Markdown Storage
143
+ Perfect for development, debugging, and transparency:
144
+
145
+ ```python
146
+ # Human-readable, version-controllable AI memory
147
+ memory = create_memory(
148
+ "grounded",
149
+ storage_backend="markdown",
150
+ storage_path="./memory"
151
+ )
152
+
153
+ # Generates organized structure:
154
+ # memory/
155
+ # ├── verbatim/alice/2025/09/24/10-30-45_python_int_abc123.md
156
+ # ├── experiential/2025/09/24/10-31-02_learning_note_def456.md
157
+ # ├── links/2025/09/24/int_abc123_to_note_def456.json
158
+ # └── index.json
159
+ ```
160
+
161
+ #### Powerful Vector Search
162
+ High-performance search with AbstractCore embeddings:
163
+
164
+ ```python
165
+ from abstractllm import create_llm
166
+
167
+ # Create provider with embedding support
168
+ provider = create_llm("openai", embedding_model="text-embedding-3-small")
169
+
170
+ # Vector search storage
171
+ memory = create_memory(
172
+ "grounded",
173
+ storage_backend="lancedb",
174
+ storage_uri="./memory.db",
175
+ embedding_provider=provider
176
+ )
177
+
178
+ # Semantic search across stored interactions
179
+ results = memory.search_stored_interactions("machine learning concepts")
180
+ ```
181
+
182
+ #### Dual Storage - Best of Both Worlds
183
+ Complete observability with powerful search:
184
+
185
+ ```python
186
+ # Dual storage: markdown (observable) + LanceDB (searchable)
187
+ memory = create_memory(
188
+ "grounded",
189
+ storage_backend="dual",
190
+ storage_path="./memory",
191
+ storage_uri="./memory.db",
192
+ embedding_provider=provider
193
+ )
194
+
195
+ # Every interaction stored in both formats
196
+ # - Markdown files for complete transparency
197
+ # - Vector database for semantic search
198
+ ```
199
+
200
+ ## 📚 Documentation
201
+
202
+ - **[Architecture Guide](docs/architecture.md)** - Complete system design
203
+ - **[Memory Types](docs/memory-types.md)** - Detailed component guide
204
+ - **[Storage Systems](docs/storage-systems.md)** - Persistent storage with dual backends
205
+ - **[Usage Patterns](docs/usage-patterns.md)** - Real-world examples
206
+ - **[API Reference](docs/api-reference.md)** - Complete API documentation
207
+ - **[Integration Guide](docs/integration.md)** - AbstractLLM ecosystem integration
208
+ - **[AbstractCore Embedding Specs](docs/abstractcore-embedding-specs.md)** - Embedding integration requirements
209
+
210
+ ## 🔬 Key Features
211
+
212
+ ### ✅ Purpose-Built Memory Types
213
+ - **ScratchpadMemory**: ReAct thought-action-observation cycles
214
+ - **BufferMemory**: Simple conversation history
215
+ - **GroundedMemory**: Multi-dimensional temporal memory
216
+
217
+ ### ✅ State-of-the-Art Research Integration
218
+ - **MemGPT/Letta Pattern**: Self-editing core memory
219
+ - **Temporal Grounding**: WHO (relational) + WHEN (temporal) context
220
+ - **Zep/Graphiti Architecture**: Bi-temporal knowledge graphs
221
+
222
+ ### ✅ Four-Tier Memory Architecture (Autonomous Agents)
223
+ ```
224
+ Core Memory ──→ Semantic Memory ──→ Working Memory ──→ Episodic Memory
225
+ (Identity) (Validated Facts) (Recent Context) (Event Archive)
226
+ ```
227
+
228
+ ### ✅ Learning Capabilities
229
+ - **Failure/Success Tracking**: Learn from experience
230
+ - **User Personalization**: Multi-user context separation
231
+ - **Fact Validation**: Confidence-based knowledge consolidation
232
+
233
+ ### ✅ Dual Storage Architecture
234
+ - **📄 Markdown Storage**: Human-readable, observable AI memory evolution
235
+ - **🔍 LanceDB Storage**: Vector search with SQL capabilities via AbstractCore
236
+ - **🔄 Dual Mode**: Best of both worlds - transparency + powerful search
237
+ - **🧠 AI Reflections**: Automatic experiential notes about interactions
238
+ - **🔗 Bidirectional Links**: Connect interactions to AI insights
239
+ - **📊 Search Capabilities**: Text-based and semantic similarity search
240
+
241
+ ## 🧪 Testing & Validation
242
+
243
+ AbstractMemory includes **200+ comprehensive tests** with real implementations:
244
+
245
+ ```bash
246
+ # Run all tests
247
+ python -m pytest tests/ -v
248
+
249
+ # Run specific test suites
250
+ python -m pytest tests/simple/ -v # Simple memory types
251
+ python -m pytest tests/components/ -v # Memory components
252
+ python -m pytest tests/storage/ -v # Storage system tests
253
+ python -m pytest tests/integration/ -v # Full system integration
254
+
255
+ # Test with real LLM providers (requires AbstractCore)
256
+ python -m pytest tests/integration/test_llm_real_usage.py -v
257
+
258
+ # Test comprehensive dual storage serialization
259
+ python -m pytest tests/storage/test_dual_storage_comprehensive.py -v
260
+ ```
261
+
262
+ ## 🔗 AbstractLLM Ecosystem Integration
263
+
264
+ AbstractMemory seamlessly integrates with the broader ecosystem:
265
+
266
+ ### With AbstractCore
267
+ ```python
268
+ from abstractllm import create_llm
269
+ from abstractmemory import create_memory
270
+
271
+ # Create LLM provider
272
+ provider = create_llm("anthropic", model="claude-3-5-haiku-latest")
273
+
274
+ # Create memory with embedding integration
275
+ memory = create_memory(
276
+ "grounded",
277
+ enable_kg=True,
278
+ storage_backend="dual",
279
+ storage_path="./memory",
280
+ storage_uri="./memory.db",
281
+ embedding_provider=provider
282
+ )
283
+
284
+ # Use together in agent reasoning
285
+ context = memory.get_full_context(query)
286
+ response = provider.generate(prompt, system_prompt=context)
287
+ memory.add_interaction(query, response.content)
288
+
289
+ # Search stored memories with semantic similarity
290
+ similar_memories = memory.search_stored_interactions("related concepts")
291
+ ```
292
+
293
+ ### With AbstractAgent (Future)
294
+ ```python
295
+ from abstractagent import create_agent
296
+ from abstractmemory import create_memory
297
+
298
+ # Autonomous agent with sophisticated memory
299
+ memory = create_memory("grounded", working_capacity=20)
300
+ agent = create_agent("autonomous", memory=memory, provider=provider)
301
+
302
+ # Agent automatically uses memory for consistency and personalization
303
+ response = agent.execute(task, user_id="alice")
304
+ ```
305
+
306
+ ## 🏛️ Architecture Principles
307
+
308
+ 1. **No Over-Engineering**: Memory complexity matches agent requirements
309
+ 2. **Real Implementation Testing**: No mocks - all tests use real implementations
310
+ 3. **SOTA Research Foundation**: Built on proven patterns (MemGPT, Zep, Graphiti)
311
+ 4. **Clean Abstractions**: Simple interfaces, powerful implementations
312
+ 5. **Performance Optimized**: Fast operations for simple agents, scalable for complex ones
313
+
314
+ ## 📈 Performance Characteristics
315
+
316
+ - **Simple Memory**: < 1ms operations, minimal overhead
317
+ - **Complex Memory**: < 100ms context generation, efficient consolidation
318
+ - **Scalability**: Handles thousands of memory items efficiently
319
+ - **Real LLM Integration**: Context + LLM calls complete in seconds
320
+
321
+ ## 🤝 Contributing
322
+
323
+ AbstractMemory is part of the AbstractLLM ecosystem. See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
324
+
325
+ ## 📄 License
326
+
327
+ [License details]
328
+
329
+ ---
330
+
331
+ **AbstractMemory: Smart memory for smart agents** 🧠✨
@@ -0,0 +1,25 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ AbstractMemory.egg-info/PKG-INFO
5
+ AbstractMemory.egg-info/SOURCES.txt
6
+ AbstractMemory.egg-info/dependency_links.txt
7
+ AbstractMemory.egg-info/requires.txt
8
+ AbstractMemory.egg-info/top_level.txt
9
+ abstractmemory/__init__.py
10
+ abstractmemory/simple.py
11
+ abstractmemory/cognitive/__init__.py
12
+ abstractmemory/components/__init__.py
13
+ abstractmemory/components/core.py
14
+ abstractmemory/components/episodic.py
15
+ abstractmemory/components/semantic.py
16
+ abstractmemory/components/working.py
17
+ abstractmemory/core/__init__.py
18
+ abstractmemory/core/interfaces.py
19
+ abstractmemory/core/temporal.py
20
+ abstractmemory/graph/__init__.py
21
+ abstractmemory/graph/knowledge_graph.py
22
+ abstractmemory/storage/__init__.py
23
+ abstractmemory/storage/dual_manager.py
24
+ abstractmemory/storage/lancedb_storage.py
25
+ abstractmemory/storage/markdown_storage.py
@@ -0,0 +1,12 @@
1
+ networkx>=3.0
2
+
3
+ [dev]
4
+ pytest
5
+ black
6
+ mypy
7
+
8
+ [llm]
9
+ abstractllm>=0.5.0
10
+
11
+ [storage]
12
+ lancedb
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 AbstractMemory Team
3
+ Copyright (c) 2025 Laurent-Philippe Albou
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+
24
+