agent-memory-server 0.12.4__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.
- agent_memory_server-0.12.4/.gitignore +237 -0
- agent_memory_server-0.12.4/LICENSE +202 -0
- agent_memory_server-0.12.4/PKG-INFO +266 -0
- agent_memory_server-0.12.4/README.md +218 -0
- agent_memory_server-0.12.4/agent_memory_server/__init__.py +3 -0
- agent_memory_server-0.12.4/agent_memory_server/_aws/__init__.py +0 -0
- agent_memory_server-0.12.4/agent_memory_server/_aws/clients.py +74 -0
- agent_memory_server-0.12.4/agent_memory_server/_aws/utils.py +89 -0
- agent_memory_server-0.12.4/agent_memory_server/api.py +1032 -0
- agent_memory_server-0.12.4/agent_memory_server/auth.py +453 -0
- agent_memory_server-0.12.4/agent_memory_server/cli.py +671 -0
- agent_memory_server-0.12.4/agent_memory_server/config.py +429 -0
- agent_memory_server-0.12.4/agent_memory_server/dependencies.py +80 -0
- agent_memory_server-0.12.4/agent_memory_server/docket_tasks.py +59 -0
- agent_memory_server-0.12.4/agent_memory_server/extraction.py +343 -0
- agent_memory_server-0.12.4/agent_memory_server/filters.py +252 -0
- agent_memory_server-0.12.4/agent_memory_server/healthcheck.py +20 -0
- agent_memory_server-0.12.4/agent_memory_server/llms.py +454 -0
- agent_memory_server-0.12.4/agent_memory_server/logging.py +109 -0
- agent_memory_server-0.12.4/agent_memory_server/long_term_memory.py +1801 -0
- agent_memory_server-0.12.4/agent_memory_server/main.py +157 -0
- agent_memory_server-0.12.4/agent_memory_server/mcp.py +1085 -0
- agent_memory_server-0.12.4/agent_memory_server/memory_strategies.py +573 -0
- agent_memory_server-0.12.4/agent_memory_server/migrations.py +135 -0
- agent_memory_server-0.12.4/agent_memory_server/models.py +735 -0
- agent_memory_server-0.12.4/agent_memory_server/prompt_security.py +262 -0
- agent_memory_server-0.12.4/agent_memory_server/summarization.py +281 -0
- agent_memory_server-0.12.4/agent_memory_server/utils/__init__.py +0 -0
- agent_memory_server-0.12.4/agent_memory_server/utils/api_keys.py +26 -0
- agent_memory_server-0.12.4/agent_memory_server/utils/keys.py +89 -0
- agent_memory_server-0.12.4/agent_memory_server/utils/recency.py +161 -0
- agent_memory_server-0.12.4/agent_memory_server/utils/redis.py +50 -0
- agent_memory_server-0.12.4/agent_memory_server/utils/redis_query.py +94 -0
- agent_memory_server-0.12.4/agent_memory_server/vectorstore_adapter.py +1427 -0
- agent_memory_server-0.12.4/agent_memory_server/vectorstore_factory.py +335 -0
- agent_memory_server-0.12.4/agent_memory_server/working_memory.py +400 -0
- agent_memory_server-0.12.4/pyproject.toml +168 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/python,venv,macos
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,venv,macos
|
|
3
|
+
|
|
4
|
+
### macOS ###
|
|
5
|
+
# General
|
|
6
|
+
.DS_Store
|
|
7
|
+
.AppleDouble
|
|
8
|
+
.LSOverride
|
|
9
|
+
|
|
10
|
+
# Icon must end with two \r
|
|
11
|
+
Icon
|
|
12
|
+
|
|
13
|
+
# Thumbnails
|
|
14
|
+
._*
|
|
15
|
+
|
|
16
|
+
# Files that might appear in the root of a volume
|
|
17
|
+
.DocumentRevisions-V100
|
|
18
|
+
.fseventsd
|
|
19
|
+
.Spotlight-V100
|
|
20
|
+
.TemporaryItems
|
|
21
|
+
.Trashes
|
|
22
|
+
.VolumeIcon.icns
|
|
23
|
+
.com.apple.timemachine.donotpresent
|
|
24
|
+
|
|
25
|
+
# Directories potentially created on remote AFP share
|
|
26
|
+
.AppleDB
|
|
27
|
+
.AppleDesktop
|
|
28
|
+
Network Trash Folder
|
|
29
|
+
Temporary Items
|
|
30
|
+
.apdisk
|
|
31
|
+
|
|
32
|
+
### macOS Patch ###
|
|
33
|
+
# iCloud generated files
|
|
34
|
+
*.icloud
|
|
35
|
+
|
|
36
|
+
### Python ###
|
|
37
|
+
# Byte-compiled / optimized / DLL files
|
|
38
|
+
__pycache__/
|
|
39
|
+
*.py[cod]
|
|
40
|
+
*$py.class
|
|
41
|
+
|
|
42
|
+
# C extensions
|
|
43
|
+
*.so
|
|
44
|
+
|
|
45
|
+
# Distribution / packaging
|
|
46
|
+
.Python
|
|
47
|
+
build/
|
|
48
|
+
develop-eggs/
|
|
49
|
+
dist/
|
|
50
|
+
downloads/
|
|
51
|
+
eggs/
|
|
52
|
+
.eggs/
|
|
53
|
+
lib/
|
|
54
|
+
lib64/
|
|
55
|
+
parts/
|
|
56
|
+
sdist/
|
|
57
|
+
var/
|
|
58
|
+
wheels/
|
|
59
|
+
share/python-wheels/
|
|
60
|
+
*.egg-info/
|
|
61
|
+
.installed.cfg
|
|
62
|
+
*.egg
|
|
63
|
+
MANIFEST
|
|
64
|
+
|
|
65
|
+
# PyInstaller
|
|
66
|
+
# Usually these files are written by a python script from a template
|
|
67
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
68
|
+
*.manifest
|
|
69
|
+
*.spec
|
|
70
|
+
|
|
71
|
+
# Installer logs
|
|
72
|
+
pip-log.txt
|
|
73
|
+
pip-delete-this-directory.txt
|
|
74
|
+
|
|
75
|
+
# Unit test / coverage reports
|
|
76
|
+
htmlcov/
|
|
77
|
+
.tox/
|
|
78
|
+
.nox/
|
|
79
|
+
.coverage
|
|
80
|
+
.coverage.*
|
|
81
|
+
.cache
|
|
82
|
+
nosetests.xml
|
|
83
|
+
coverage.xml
|
|
84
|
+
*.cover
|
|
85
|
+
*.py,cover
|
|
86
|
+
.hypothesis/
|
|
87
|
+
.pytest_cache/
|
|
88
|
+
cover/
|
|
89
|
+
|
|
90
|
+
# Translations
|
|
91
|
+
*.mo
|
|
92
|
+
*.pot
|
|
93
|
+
|
|
94
|
+
# Django stuff:
|
|
95
|
+
*.log
|
|
96
|
+
local_settings.py
|
|
97
|
+
db.sqlite3
|
|
98
|
+
db.sqlite3-journal
|
|
99
|
+
|
|
100
|
+
# Flask stuff:
|
|
101
|
+
instance/
|
|
102
|
+
.webassets-cache
|
|
103
|
+
|
|
104
|
+
# Scrapy stuff:
|
|
105
|
+
.scrapy
|
|
106
|
+
|
|
107
|
+
# Sphinx documentation
|
|
108
|
+
docs/_build/
|
|
109
|
+
|
|
110
|
+
# PyBuilder
|
|
111
|
+
.pybuilder/
|
|
112
|
+
target/
|
|
113
|
+
|
|
114
|
+
# Jupyter Notebook
|
|
115
|
+
.ipynb_checkpoints
|
|
116
|
+
|
|
117
|
+
# IPython
|
|
118
|
+
profile_default/
|
|
119
|
+
ipython_config.py
|
|
120
|
+
|
|
121
|
+
# pyenv
|
|
122
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
123
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
124
|
+
.python-version
|
|
125
|
+
|
|
126
|
+
# pipenv
|
|
127
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
128
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
129
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
130
|
+
# install all needed dependencies.
|
|
131
|
+
#Pipfile.lock
|
|
132
|
+
|
|
133
|
+
# poetry
|
|
134
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
135
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
136
|
+
# commonly ignored for libraries.
|
|
137
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
138
|
+
#poetry.lock
|
|
139
|
+
|
|
140
|
+
# pdm
|
|
141
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
142
|
+
#pdm.lock
|
|
143
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
144
|
+
# in version control.
|
|
145
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
146
|
+
.pdm.toml
|
|
147
|
+
|
|
148
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
149
|
+
__pypackages__/
|
|
150
|
+
|
|
151
|
+
# Celery stuff
|
|
152
|
+
celerybeat-schedule
|
|
153
|
+
celerybeat.pid
|
|
154
|
+
|
|
155
|
+
# SageMath parsed files
|
|
156
|
+
*.sage.py
|
|
157
|
+
|
|
158
|
+
# Environments
|
|
159
|
+
.env
|
|
160
|
+
.venv
|
|
161
|
+
env/
|
|
162
|
+
venv/
|
|
163
|
+
ENV/
|
|
164
|
+
env.bak/
|
|
165
|
+
venv.bak/
|
|
166
|
+
.venv/
|
|
167
|
+
|
|
168
|
+
# Spyder project settings
|
|
169
|
+
.spyderproject
|
|
170
|
+
.spyproject
|
|
171
|
+
|
|
172
|
+
# Rope project settings
|
|
173
|
+
.ropeproject
|
|
174
|
+
|
|
175
|
+
# mkdocs documentation
|
|
176
|
+
/site
|
|
177
|
+
|
|
178
|
+
# mypy
|
|
179
|
+
.mypy_cache/
|
|
180
|
+
.dmypy.json
|
|
181
|
+
dmypy.json
|
|
182
|
+
|
|
183
|
+
# Pyre type checker
|
|
184
|
+
.pyre/
|
|
185
|
+
|
|
186
|
+
# pytype static type analyzer
|
|
187
|
+
.pytype/
|
|
188
|
+
|
|
189
|
+
# Cython debug symbols
|
|
190
|
+
cython_debug/
|
|
191
|
+
|
|
192
|
+
# PyCharm
|
|
193
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
194
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
195
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
196
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
197
|
+
#.idea/
|
|
198
|
+
|
|
199
|
+
### Python Patch ###
|
|
200
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
201
|
+
poetry.toml
|
|
202
|
+
|
|
203
|
+
# ruff
|
|
204
|
+
.ruff_cache/
|
|
205
|
+
|
|
206
|
+
# LSP config files
|
|
207
|
+
pyrightconfig.json
|
|
208
|
+
|
|
209
|
+
# Security: Exclude files that may contain secrets
|
|
210
|
+
.env-old
|
|
211
|
+
auth0-test-config.env
|
|
212
|
+
*.env.backup
|
|
213
|
+
*.env.local
|
|
214
|
+
*-config.env
|
|
215
|
+
|
|
216
|
+
### venv ###
|
|
217
|
+
# Virtualenv
|
|
218
|
+
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
|
|
219
|
+
[Bb]in
|
|
220
|
+
[Ii]nclude
|
|
221
|
+
[Ll]ib
|
|
222
|
+
[Ll]ib64
|
|
223
|
+
[Ll]ocal
|
|
224
|
+
pyvenv.cfg
|
|
225
|
+
pip-selfcheck.json
|
|
226
|
+
|
|
227
|
+
libs/redis/docs/.Trash*
|
|
228
|
+
.python-version
|
|
229
|
+
.idea/*
|
|
230
|
+
.vscode/settings.json
|
|
231
|
+
.cursor
|
|
232
|
+
|
|
233
|
+
*.pyc
|
|
234
|
+
.ai
|
|
235
|
+
.claude
|
|
236
|
+
TASK_MEMORY.md
|
|
237
|
+
*.code-workspace
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Copyright (c) 2025 Redis, Inc. Released under the Apache License 2.0:
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2023 Metal Technologies Inc
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-memory-server
|
|
3
|
+
Version: 0.12.4
|
|
4
|
+
Summary: A Memory Server for LLM Agents and Applications
|
|
5
|
+
Project-URL: Homepage, https://github.com/redis-developer/agent-memory-server
|
|
6
|
+
Project-URL: Repository, https://github.com/redis-developer/agent-memory-server
|
|
7
|
+
Project-URL: Documentation, https://github.com/redis-developer/agent-memory-server/tree/main/docs
|
|
8
|
+
Project-URL: Issues, https://github.com/redis-developer/agent-memory-server/issues
|
|
9
|
+
Author-email: Andrew Brookins <andrew.brookins@redis.com>
|
|
10
|
+
License: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Python: <3.13,>=3.12
|
|
13
|
+
Requires-Dist: agent-memory-client
|
|
14
|
+
Requires-Dist: anthropic>=0.15.0
|
|
15
|
+
Requires-Dist: bcrypt>=4.0.0
|
|
16
|
+
Requires-Dist: cachetools<7.0.0,>=6.2.2
|
|
17
|
+
Requires-Dist: click>=8.1.0
|
|
18
|
+
Requires-Dist: cryptography>=3.4.8
|
|
19
|
+
Requires-Dist: fastapi>=0.115.11
|
|
20
|
+
Requires-Dist: httpx>=0.25.0
|
|
21
|
+
Requires-Dist: langchain-community>=0.3.27
|
|
22
|
+
Requires-Dist: langchain-core>=0.3.0
|
|
23
|
+
Requires-Dist: langchain-openai>=0.3.18
|
|
24
|
+
Requires-Dist: langchain-redis>=0.2.1
|
|
25
|
+
Requires-Dist: mcp>=1.6.0
|
|
26
|
+
Requires-Dist: numpy>=2.1.0
|
|
27
|
+
Requires-Dist: openai>=1.3.7
|
|
28
|
+
Requires-Dist: pydantic-settings>=2.8.1
|
|
29
|
+
Requires-Dist: pydantic>=2.5.2
|
|
30
|
+
Requires-Dist: pydocket>=0.6.3
|
|
31
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
32
|
+
Requires-Dist: python-jose[cryptography]>=3.3.0
|
|
33
|
+
Requires-Dist: python-ulid>=3.0.0
|
|
34
|
+
Requires-Dist: pyyaml>=6.0
|
|
35
|
+
Requires-Dist: redisvl>=0.6.0
|
|
36
|
+
Requires-Dist: sniffio>=1.3.1
|
|
37
|
+
Requires-Dist: structlog>=25.2.0
|
|
38
|
+
Requires-Dist: tiktoken>=0.5.1
|
|
39
|
+
Requires-Dist: transformers>=4.51.1
|
|
40
|
+
Requires-Dist: uvicorn>=0.24.0
|
|
41
|
+
Provides-Extra: aws
|
|
42
|
+
Requires-Dist: boto3<2.0.0,>=1.42.1; extra == 'aws'
|
|
43
|
+
Requires-Dist: botocore<2.0.0,>=1.42.1; extra == 'aws'
|
|
44
|
+
Requires-Dist: langchain-aws<2.0.0,>=1.1.0; extra == 'aws'
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: agent-memory-client; extra == 'dev'
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
|
|
49
|
+
# Redis Agent Memory Server
|
|
50
|
+
|
|
51
|
+
A memory layer for AI agents using Redis as the vector database.
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- **Dual Interface**: REST API and Model Context Protocol (MCP) server
|
|
56
|
+
- **Two-Tier Memory**: Working memory (session-scoped) and long-term memory (persistent)
|
|
57
|
+
- **Configurable Memory Strategies**: Customize how memories are extracted (discrete, summary, preferences, custom)
|
|
58
|
+
- **Semantic Search**: Vector-based similarity search with metadata filtering
|
|
59
|
+
- **Flexible Backends**: Pluggable vector store factory system
|
|
60
|
+
- **AI Integration**: Automatic topic extraction, entity recognition, and conversation summarization
|
|
61
|
+
- **Python SDK**: Easy integration with AI applications
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
### 1. Installation
|
|
66
|
+
|
|
67
|
+
#### Using Docker
|
|
68
|
+
|
|
69
|
+
Pre-built Docker images are available from:
|
|
70
|
+
- **Docker Hub**: [redislabs/agent-memory-server](https://hub.docker.com/r/redislabs/agent-memory-server)
|
|
71
|
+
- **GitHub Packages**: [ghcr.io/redis/agent-memory-server](https://github.com/redis/agent-memory-server/pkgs/container/agent-memory-server)
|
|
72
|
+
|
|
73
|
+
**Quick Start (Development Mode)**:
|
|
74
|
+
```bash
|
|
75
|
+
# Start with docker-compose (includes Redis, API, MCP, and worker)
|
|
76
|
+
docker-compose up
|
|
77
|
+
|
|
78
|
+
# Or run just the API server (requires separate Redis)
|
|
79
|
+
docker run -p 8000:8000 \
|
|
80
|
+
-e REDIS_URL=redis://your-redis:6379 \
|
|
81
|
+
-e OPENAI_API_KEY=your-key \
|
|
82
|
+
redislabs/agent-memory-server:latest
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The default image runs in development mode (`--no-worker`), which is perfect for testing and development.
|
|
86
|
+
|
|
87
|
+
**Production Deployment**:
|
|
88
|
+
|
|
89
|
+
For production, run separate containers for the API and background workers:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# API Server (without background worker)
|
|
93
|
+
docker run -p 8000:8000 \
|
|
94
|
+
-e REDIS_URL=redis://your-redis:6379 \
|
|
95
|
+
-e OPENAI_API_KEY=your-key \
|
|
96
|
+
-e DISABLE_AUTH=false \
|
|
97
|
+
redislabs/agent-memory-server:latest \
|
|
98
|
+
agent-memory api --host 0.0.0.0 --port 8000
|
|
99
|
+
|
|
100
|
+
# Background Worker (separate container)
|
|
101
|
+
docker run \
|
|
102
|
+
-e REDIS_URL=redis://your-redis:6379 \
|
|
103
|
+
-e OPENAI_API_KEY=your-key \
|
|
104
|
+
redislabs/agent-memory-server:latest \
|
|
105
|
+
agent-memory task-worker --concurrency 10
|
|
106
|
+
|
|
107
|
+
# MCP Server (if needed)
|
|
108
|
+
docker run -p 9000:9000 \
|
|
109
|
+
-e REDIS_URL=redis://your-redis:6379 \
|
|
110
|
+
-e OPENAI_API_KEY=your-key \
|
|
111
|
+
redislabs/agent-memory-server:latest \
|
|
112
|
+
agent-memory mcp --mode sse --port 9000
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### From Source
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Install dependencies
|
|
119
|
+
pip install uv
|
|
120
|
+
uv install --all-extras
|
|
121
|
+
|
|
122
|
+
# Start Redis
|
|
123
|
+
docker-compose up redis
|
|
124
|
+
|
|
125
|
+
# Start the server (development mode)
|
|
126
|
+
uv run agent-memory api --no-worker
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 2. Python SDK
|
|
130
|
+
|
|
131
|
+
Allowing the server to extract memories from working memory is easiest. However, you can also manually create memories:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Install the client
|
|
135
|
+
pip install agent-memory-client
|
|
136
|
+
|
|
137
|
+
# For LangChain integration
|
|
138
|
+
pip install agent-memory-client langchain-core
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from agent_memory_client import MemoryAPIClient
|
|
143
|
+
|
|
144
|
+
# Connect to server
|
|
145
|
+
client = MemoryAPIClient(base_url="http://localhost:8000")
|
|
146
|
+
|
|
147
|
+
# Store memories
|
|
148
|
+
await client.create_long_term_memories([
|
|
149
|
+
{
|
|
150
|
+
"text": "User prefers morning meetings",
|
|
151
|
+
"user_id": "user123",
|
|
152
|
+
"memory_type": "preference"
|
|
153
|
+
}
|
|
154
|
+
])
|
|
155
|
+
|
|
156
|
+
# Search memories
|
|
157
|
+
results = await client.search_long_term_memory(
|
|
158
|
+
text="What time does the user like meetings?",
|
|
159
|
+
user_id="user123"
|
|
160
|
+
)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
> **Note**: While you can call client functions directly as shown above, using **MCP or SDK-provided tool calls** is recommended for AI agents as it provides better integration, automatic context management, and follows AI-native patterns. For the best performance, you can add messages to working memory and allow the server to extract memories in the background. See **[Memory Integration Patterns](https://redis.github.io/agent-memory-server/memory-integration-patterns/)** for guidance on when to use each approach.
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
#### LangChain Integration
|
|
167
|
+
|
|
168
|
+
For LangChain users, the SDK provides automatic conversion of memory client tools to LangChain-compatible tools, eliminating the need for manual wrapping with `@tool` decorators.
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from agent_memory_client import create_memory_client
|
|
172
|
+
from agent_memory_client.integrations.langchain import get_memory_tools
|
|
173
|
+
from langchain.agents import create_tool_calling_agent, AgentExecutor
|
|
174
|
+
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
|
175
|
+
from langchain_openai import ChatOpenAI
|
|
176
|
+
|
|
177
|
+
# Get LangChain-compatible tools automatically
|
|
178
|
+
memory_client = await create_memory_client("http://localhost:8000")
|
|
179
|
+
tools = get_memory_tools(
|
|
180
|
+
memory_client=memory_client,
|
|
181
|
+
session_id="my_session",
|
|
182
|
+
user_id="alice"
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
# Create prompt and agent
|
|
186
|
+
prompt = ChatPromptTemplate.from_messages([
|
|
187
|
+
("system", "You are a helpful assistant with memory."),
|
|
188
|
+
("human", "{input}"),
|
|
189
|
+
MessagesPlaceholder("agent_scratchpad"),
|
|
190
|
+
])
|
|
191
|
+
|
|
192
|
+
llm = ChatOpenAI(model="gpt-4o")
|
|
193
|
+
agent = create_tool_calling_agent(llm, tools, prompt)
|
|
194
|
+
executor = AgentExecutor(agent=agent, tools=tools)
|
|
195
|
+
|
|
196
|
+
# Use the agent
|
|
197
|
+
result = await executor.ainvoke({"input": "Remember that I love pizza"})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 3. MCP Integration
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Start MCP server (stdio mode - recommended for Claude Desktop)
|
|
204
|
+
uv run agent-memory mcp
|
|
205
|
+
|
|
206
|
+
# Or with SSE mode (development mode)
|
|
207
|
+
uv run agent-memory mcp --mode sse --port 9000 --no-worker
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Documentation
|
|
211
|
+
|
|
212
|
+
📚 **[Full Documentation](https://redis.github.io/agent-memory-server/)** - Complete guides, API reference, and examples
|
|
213
|
+
|
|
214
|
+
### Key Documentation Sections:
|
|
215
|
+
|
|
216
|
+
- **[Quick Start Guide](https://redis.github.io/agent-memory-server/quick-start/)** - Get up and running in minutes
|
|
217
|
+
- **[Python SDK](https://redis.github.io/agent-memory-server/python-sdk/)** - Complete SDK reference with examples
|
|
218
|
+
- **[LangChain Integration](https://redis.github.io/agent-memory-server/langchain-integration/)** - Automatic tool conversion for LangChain
|
|
219
|
+
- **[Vector Store Backends](https://redis.github.io/agent-memory-server/vector-store-backends/)** - Configure different vector databases
|
|
220
|
+
- **[Authentication](https://redis.github.io/agent-memory-server/authentication/)** - OAuth2/JWT setup for production
|
|
221
|
+
- **[Memory Types](https://redis.github.io/agent-memory-server/long-term-memory/#memory-types)** - Understanding semantic vs episodic memory
|
|
222
|
+
- **[API Reference](https://redis.github.io/agent-memory-server/api/)** - REST API endpoints
|
|
223
|
+
- **[MCP Protocol](https://redis.github.io/agent-memory-server/mcp/)** - Model Context Protocol integration
|
|
224
|
+
|
|
225
|
+
## Architecture
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
Working Memory (Session-scoped) → Long-term Memory (Persistent)
|
|
229
|
+
↓ ↓
|
|
230
|
+
- Messages - Semantic search
|
|
231
|
+
- Structured memories - Topic modeling
|
|
232
|
+
- Summary of past messages - Entity recognition
|
|
233
|
+
- Metadata - Deduplication
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Use Cases
|
|
237
|
+
|
|
238
|
+
- **AI Assistants**: Persistent memory across conversations
|
|
239
|
+
- **Customer Support**: Context from previous interactions
|
|
240
|
+
- **Personal AI**: Learning user preferences and history
|
|
241
|
+
- **Research Assistants**: Accumulating knowledge over time
|
|
242
|
+
- **Chatbots**: Maintaining context and personalization
|
|
243
|
+
|
|
244
|
+
## Development
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Install dependencies
|
|
248
|
+
uv install --all-extras
|
|
249
|
+
|
|
250
|
+
# Run tests
|
|
251
|
+
uv run pytest
|
|
252
|
+
|
|
253
|
+
# Format code
|
|
254
|
+
uv run ruff format
|
|
255
|
+
uv run ruff check
|
|
256
|
+
|
|
257
|
+
# Start development stack
|
|
258
|
+
docker-compose up
|
|
259
|
+
```
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
Apache License 2.0 - see [LICENSE](LICENSE) file for details.
|
|
263
|
+
|
|
264
|
+
## Contributing
|
|
265
|
+
|
|
266
|
+
We welcome contributions! Please see the [development documentation](docs/development.md) for guidelines.
|