将 Memory Store 挂载到指定的 Identity 和 Template。
把一个已存在的 Memory Store 挂载到指定
Identity 级 Service Account Token 只能操作自己所属的 identity,操作其他 identity 返回
HTTP 200 OK
返回 Memory Store 挂载对象。
挂载多个 Store 后,Agent 看到的记忆是所有 Store 按
(identity, template)。挂载后,该 identity 用此 template 创建的 Session 会自动获得这个 Store 的记忆内容。
重复挂载:对同一 Store 再次调用,传入 access 时更新权限,省略时保持原权限;不重复创建挂载,created_at 保持首次挂载时间不变。
路径
POST /api/v1/forward/identities/{identity_id}/templates/{template_id}/memory_stores
请求头
| 头部 | 必选 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <PAT、admin SAT 或该 identity 的 SAT> |
Content-Type | 是 | application/json |
403。
路径参数
| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
identity_id | string | 是 | Identity ID(idn_...)。 |
template_id | string | 是 | Template ID(tmpl_...)。 |
请求体
| 字段 | 类型 | 必选 | 说明 |
|---|---|---|---|
memory_store_id | string | 是 | 要挂载的 Memory Store ID(memstore_...)。必须是当前调用方可见的 active Store。 |
access | string | 否 | read_only 或 read_write。省略时,新挂载默认为 read_only,已有挂载保持原权限。 |
示例请求
示例响应
HTTP 200 OK
响应字段解释
返回 Memory Store 挂载对象。
注意事项
挂载多个 Store 后,Agent 看到的记忆是所有 Store 按 path 合并的扁平命名空间,相同 path 会相互遮蔽。详见 在 Session 中的可见形态。
挂载和权限变更对之后创建的 Session 生效,不自动更新已有 Session。
错误码
| HTTP | type | 触发条件 |
|---|---|---|
| 400 | invalid_request_error | memory_store_id 或 access 不合法、Store 已归档,或尝试将系统默认库改为只读。 |
| 401 | authentication_error | 缺少或无效的认证令牌。 |
| 403 | permission_error | Identity 级 SAT 试图操作其他 identity。 |
| 404 | not_found_error | Identity、Template 或 Memory Store 不存在或不可见。 |
| 500/502/503 | api_error | Forward 或依赖服务失败。 |

