You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+78-51Lines changed: 78 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,6 @@
3
3
MemOS is an open-source **Agent Memory framework** that empowers AI agents with **long-term memory, personality consistency, and contextual recall**. It enables agents to **remember past interactions**, **learn over time**, and **build evolving identities** across sessions.
4
4
5
5
Designed for **AI companions, role-playing NPCs, and multi-agent systems**, MemOS provides a unified API for **memory representation, retrieval, and update** — making it the foundation for next-generation **memory-augmented AI agents**.
6
-
7
-
🆕 **MemOS 2.0** introduces **knowledge base system**, **multi-modal memory** (images & documents), **tool memory** for Agent optimization, **memory feedback mechanism** for precise control, and **enterprise-grade architecture** with Redis Streams scheduler and advanced DB optimizations.
Here's a quick example of how to create a **`MemCube`**, load it from a directory, access its memories, and save it.
142
+
### Interface SDK
143
+
#### Here is a quick example showing how to create all interface SDK
158
144
145
+
This interface is used to add messages, supporting multiple types of content and batch additions. MemOS will automatically parse the messages and handle memory for reference in subsequent conversations.
159
146
```python
160
-
from memos.mem_cube.general import GeneralMemCube
147
+
# Please make sure MemoS is installed (pip install MemoryOS -U)
148
+
from memos.api.client import MemOSClient
149
+
150
+
# Initialize the client using the API Key
151
+
client = MemOSClient(api_key="YOUR_API_KEY")
152
+
153
+
messages = [
154
+
{"role": "user", "content": "I have planned to travel to Guangzhou during the summer vacation. What chain hotels are available for accommodation?"},
155
+
{"role": "assistant", "content": "You can consider [7 Days, All Seasons, Hilton], and so on."},
This interface is used to retrieve the memories of a specified user, returning the memory fragments most relevant to the input query for Agent use. The recalled memory fragments include 'factual memory', 'preference memory', and 'tool memory'.
167
+
```python
168
+
# Please make sure MemoS is installed (pip install MemoryOS -U)
169
+
from memos.api.client import MemOSClient
164
170
165
-
# Access and print all memories
166
-
print("--- Textual Memories ---")
167
-
for item in mem_cube.text_mem.get_all():
168
-
print(item)
171
+
# Initialize the client using the API Key
172
+
client = MemOSClient(api_key="YOUR_API_KEY")
169
173
170
-
print("\n--- Activation Memories ---")
171
-
for item in mem_cube.act_mem.get_all():
172
-
print(item)
174
+
query ="I want to go out to play during National Day. Can you recommend a city I haven't been to and a hotel brand I haven't stayed at?"
175
+
user_id ="memos_user_123"
176
+
conversation_id ="0928"
177
+
res = client.search_memory(query=query, user_id=user_id, conversation_id=conversation_id)
173
178
174
-
# Save the MemCube to a new directory
175
-
mem_cube.dump("tmp/mem_cube")
179
+
print(f"result: {res}")
176
180
```
177
181
178
-
**`MOS`** (Memory Operating System) is a higher-level orchestration layer that manages multiple MemCubes and provides a unified API for memory operations. Here's a quick example of how to use MOS:
179
-
182
+
This interface is used to delete the memory of specified users and supports batch deletion.
180
183
```python
181
-
from memos.configs.mem_os import MOSConfig
182
-
from memos.mem_os.mainimportMOS
184
+
# Please make sure MemoS is installed (pip install MemoryOS -U)
feedback_content ="No, let's change it now to a meal allowance of 150 yuan per day and a lodging subsidy of 700 yuan per day for first-tier cities; for second- and third-tier cities, it remains the same as before."
0 commit comments