Skip to main content
Memory Stores

挂载 Memory Store 到 Identity

将 Memory Store 挂载到指定的 Identity 和 Template。

把一个已存在的 Memory Store 挂载到指定 (identity, template)。挂载后,该 identity 用此 template 创建的 Session 会自动获得这个 Store 的记忆内容。 显式挂载的 Store 一律为 read_only。同一 (identity, template) 最多挂载 10 个显式 Store(不含系统默认库槽位)。 重复挂载幂等:对同一 Store 重复调用返回已存在的挂载记录,created_at 保持首次挂载时间不变。

路径

POST /api/v1/forward/identities/{identity_id}/templates/{template_id}/memory_stores

请求头

头部必选说明
AuthorizationBearer <PAT、admin SAT 或该 identity 的 SAT>
Content-Typeapplication/json
Identity 级 Service Account Token 只能操作自己所属的 identity,操作其他 identity 返回 403

路径参数

参数类型必选说明
identity_idstringIdentity ID(idn_...)。
template_idstringTemplate ID(tmpl_...)。

请求体

字段类型必选说明
memory_store_idstring要挂载的 Memory Store ID(memstore_...)。必须是当前调用方可见的 active Store。

示例请求

curl -X POST "https://api.qoder.com/api/v1/forward/identities/idn_63ee28747a35cff93771c491/templates/tmpl_eb3377fb74ad413e17b3d755/memory_stores" \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "memory_store_id": "memstore_00mc7mukn7lkxr454tjd"
  }'

示例响应

HTTP 200 OK
{
  "memory_store_id": "memstore_00mc7mukn7lkxr454tjd",
  "identity_id": "idn_63ee28747a35cff93771c491",
  "template_id": "tmpl_eb3377fb74ad413e17b3d755",
  "access": "read_only",
  "system_managed": false,
  "name": "team-a",
  "status": "active",
  "entry_count": 12,
  "created_at": "2026-08-14T10:00:00Z"
}

响应字段解释

返回 Memory Store 挂载对象

注意事项

挂载多个 Store 后,Agent 看到的记忆是所有 Store 按 path 合并的扁平命名空间,相同 path 会相互遮蔽。详见 在 Session 中的可见形态

错误码

HTTPtype触发条件
400invalid_request_errormemory_store_id 缺失、Store 已归档,或该 (identity, template) 显式挂载数已达上限 10。
401authentication_error缺少或无效的认证令牌。
403permission_errorIdentity 级 SAT 试图操作其他 identity。
404not_found_errorIdentity、Template 或 Memory Store 不存在或不可见。
500/502/503api_errorForward 或依赖服务失败。