POST /v1/memory_stores
创建一个 Memory Store,并返回 Memory Store 对象。
请求头
| 头部 | 必选 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <PAT> |
Content-Type | 是 | application/json |
请求体
| 字段 | 类型 | 必选 | 说明 |
|---|---|---|---|
name | string | 是 | Store 名称。服务端会去除首尾空白,最长 64 字符 |
description | string | 是 | Store 描述。服务端会去除首尾空白,最长 1024 字符 |
metadata | Metadata 对象 | 否 | 自定义元数据,省略时为 {} |
示例请求
示例响应
HTTP 201 Created响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | Memory Store ID,前缀为 memstore_ |
type | string | 固定值 "memory_store" |
name | string | Store 名称 |
description | string | Store 描述 |
status | string | Store 状态,见 Memory Store status |
entry_count | integer | active memory entry 数量 |
total_size | integer | active memory entry 总大小,单位 byte |
metadata | Metadata 对象 | 自定义元数据 |
archived_at | string | 仅 Store 已归档时返回 |
created_at | string | UTC 创建时间 |
updated_at | string | UTC 最后更新时间 |
注意事项
- 允许创建同名 Store。
- 新建 Store 初始状态为
active。 entry_count和total_size初始值为0。
错误码
| HTTP | type | 触发条件 |
|---|---|---|
| 400 | invalid_request_error | name、description 或 metadata 缺失或非法 |
| 401 | authentication_error | 缺少或无效的认证令牌 |
相关
Memory Stores
让 Agent 拥有跨 Session 的持久记忆。