将会话写入记忆
curl --request PATCH \
--url http://localhost:8000/apps/{app_name}/users/{user_id}/memory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "session-001"
}
'import requests
url = "http://localhost:8000/apps/{app_name}/users/{user_id}/memory"
payload = { "sessionId": "session-001" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({sessionId: 'session-001'})
};
fetch('http://localhost:8000/apps/{app_name}/users/{user_id}/memory', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));null{
"detail": "<string>"
}{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}记忆
将会话写入记忆
将 sessionId 对应会话交给配置的记忆服务处理;成功返回 JSON null
PATCH
/
apps
/
{app_name}
/
users
/
{user_id}
/
memory
将会话写入记忆
curl --request PATCH \
--url http://localhost:8000/apps/{app_name}/users/{user_id}/memory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sessionId": "session-001"
}
'import requests
url = "http://localhost:8000/apps/{app_name}/users/{user_id}/memory"
payload = { "sessionId": "session-001" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({sessionId: 'session-001'})
};
fetch('http://localhost:8000/apps/{app_name}/users/{user_id}/memory', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));null{
"detail": "<string>"
}{
"detail": "<string>"
}{
"error": "CONTENT_LENGTH_REQUIRED"
}{
"error": "REQUEST_TOO_LARGE"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}先确认服务已配置记忆后端,并使用同一应用、用户下的有效
成功返回 JSON
sessionId。未配置记忆服务返回 400,会话不存在返回 404
此操作将会话事件交给已配置的记忆服务保存或处理,后续检索可能使用这些内容。提交前确认会话包含的数据适合写入该后端
null,表示写入调用已完成;返回体不包含提取出的记忆,也不保证后续检索一定命中这些内容最后修改于 2026年9月19日