Base store
Simplified Async-First Base Store for TAF Framework
This module provides a clean, modern interface for memory stores with: - Async-first design for better performance - Core CRUD operations only - Message-specific convenience methods - Extensible for different backends (vector stores, managed services, etc.)
Classes:
| Name | Description |
|---|---|
BaseStore |
Simplified async-first base class for memory stores in TAF. |
Attributes:
| Name | Type | Description |
|---|---|---|
logger |
|
Attributes¶
Classes¶
BaseStore
¶
Bases: ABC
Simplified async-first base class for memory stores in TAF.
This class provides a clean interface that supports: - Vector stores (Qdrant, Pinecone, Chroma, etc.) - Managed memory services (mem0, Zep, etc.) - Graph databases (Neo4j, etc.)
Key Design Principles: - Async-first for better performance - Core CRUD operations only - User and agent-centric operations - Extensible filtering and metadata
Methods:
| Name | Description |
|---|---|
adelete |
Delete a memory by ID. |
aforget_memory |
Delete a memory by for a user or agent. |
aget |
Get a specific memory by ID. |
aget_all |
Get a specific memory by user_id. |
arelease |
Clean up any resources used by the store (override in subclasses if needed). |
asearch |
Search memories by content similarity. |
asetup |
Asynchronous setup method for checkpointer. |
astore |
Add a new memory. |
aupdate |
Update an existing memory. |
delete |
Synchronous wrapper for |
forget_memory |
Delete a memory by for a user or agent. |
get |
Synchronous wrapper for |
get_all |
Synchronous wrapper for |
release |
Clean up any resources used by the store (override in subclasses if needed). |
search |
Synchronous wrapper for |
setup |
Synchronous setup method for checkpointer. |
store |
Synchronous wrapper for |
update |
Synchronous wrapper for |
Source code in agentflow/store/base_store.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
Functions¶
adelete
abstractmethod
async
¶
adelete(config, memory_id, **kwargs)
Delete a memory by ID.
Source code in agentflow/store/base_store.py
238 239 240 241 242 243 244 245 246 | |
aforget_memory
abstractmethod
async
¶
aforget_memory(config, **kwargs)
Delete a memory by for a user or agent.
Source code in agentflow/store/base_store.py
252 253 254 255 256 257 258 259 | |
aget
abstractmethod
async
¶
aget(config, memory_id, **kwargs)
Get a specific memory by ID.
Source code in agentflow/store/base_store.py
174 175 176 177 178 179 180 181 182 | |
aget_all
abstractmethod
async
¶
aget_all(config, limit=100, **kwargs)
Get a specific memory by user_id.
Source code in agentflow/store/base_store.py
184 185 186 187 188 189 190 191 192 | |
arelease
async
¶
arelease()
Clean up any resources used by the store (override in subclasses if needed).
Source code in agentflow/store/base_store.py
271 272 273 | |
asearch
abstractmethod
async
¶
asearch(config, query, memory_type=None, category=None, limit=10, score_threshold=None, filters=None, retrieval_strategy=RetrievalStrategy.SIMILARITY, distance_metric=DistanceMetric.COSINE, max_tokens=4000, **kwargs)
Search memories by content similarity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Search query |
required |
|
Filter by user |
required | |
|
Filter by agent |
required | |
|
MemoryType | None
|
Filter by memory type |
None
|
|
str | None
|
Filter by category |
None
|
|
int
|
Maximum results |
10
|
|
float | None
|
Minimum similarity score |
None
|
|
dict[str, Any] | None
|
Additional filters |
None
|
|
Store-specific parameters |
{}
|
Returns:
| Type | Description |
|---|---|
list[MemorySearchResult]
|
List of matching memories |
Source code in agentflow/store/base_store.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
asetup
async
¶
asetup()
Asynchronous setup method for checkpointer.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Implementation-defined setup result. |
Source code in agentflow/store/base_store.py
49 50 51 52 53 54 55 56 | |
astore
abstractmethod
async
¶
astore(config, content, memory_type=MemoryType.EPISODIC, category='general', metadata=None, **kwargs)
Add a new memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | Message
|
The memory content |
required |
|
User identifier |
required | |
|
Agent identifier |
required | |
|
MemoryType
|
Type of memory (episodic, semantic, etc.) |
EPISODIC
|
|
str
|
Memory category for organization |
'general'
|
|
dict[str, Any] | None
|
Additional metadata |
None
|
|
Store-specific parameters |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
Memory ID |
Source code in agentflow/store/base_store.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
aupdate
abstractmethod
async
¶
aupdate(config, memory_id, content, metadata=None, **kwargs)
Update an existing memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
ID of memory to update |
required |
|
str | Message
|
New content (optional) |
required |
|
dict[str, Any] | None
|
New/additional metadata (optional) |
None
|
|
Store-specific parameters |
{}
|
Source code in agentflow/store/base_store.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
delete
¶
delete(config, memory_id, **kwargs)
Synchronous wrapper for adelete that runs the async implementation.
Source code in agentflow/store/base_store.py
248 249 250 | |
forget_memory
¶
forget_memory(config, **kwargs)
Delete a memory by for a user or agent.
Source code in agentflow/store/base_store.py
261 262 263 264 265 266 267 | |
get
¶
get(config, memory_id, **kwargs)
Synchronous wrapper for aget that runs the async implementation.
Source code in agentflow/store/base_store.py
194 195 196 | |
get_all
¶
get_all(config, limit=100, **kwargs)
Synchronous wrapper for aget that runs the async implementation.
Source code in agentflow/store/base_store.py
198 199 200 201 202 203 204 205 | |
release
¶
release()
Clean up any resources used by the store (override in subclasses if needed).
Source code in agentflow/store/base_store.py
275 276 277 | |
search
¶
search(config, query, memory_type=None, category=None, limit=10, score_threshold=None, filters=None, retrieval_strategy=RetrievalStrategy.SIMILARITY, distance_metric=DistanceMetric.COSINE, max_tokens=4000, **kwargs)
Synchronous wrapper for asearch that runs the async implementation.
Source code in agentflow/store/base_store.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
setup
¶
setup()
Synchronous setup method for checkpointer.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Implementation-defined setup result. |
Source code in agentflow/store/base_store.py
40 41 42 43 44 45 46 47 | |
store
¶
store(config, content, memory_type=MemoryType.EPISODIC, category='general', metadata=None, **kwargs)
Synchronous wrapper for astore that runs the async implementation.
Source code in agentflow/store/base_store.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
update
¶
update(config, memory_id, content, metadata=None, **kwargs)
Synchronous wrapper for aupdate that runs the async implementation.
Source code in agentflow/store/base_store.py
227 228 229 230 231 232 233 234 235 236 | |