一、接口介绍
·目标范围:由参数组合决定,不传 team_id 和 agent_ids 为实例级;仅传 team_id 为团队级;同时传 team_id 和 agent_ids 为 Agent 级(支持批量设置 1 至 100 个 Agent)。
·应用操作(action=apply):必须传 memory_prompt_id,且 Prompt 自身的 layer 必须与请求的 layer 一致,否则返回 400 错误。
·清除操作(action=clear):无需传入 memory_prompt_id(即使传入也不生效),清除目标范围上已有的自定义设置,恢复向上继承。
·幂等性:重复应用相同 Prompt 或清除不存在的设置时,affected 返回 0。
注意:说明:
注意:为不同业务团队或 Agent 配置差异化的记忆生成策略。例如,为客服 Agent 应用“仅提取用户投诉要点”的 Prompt,为销售 Agent 应用“重点记录客户偏好”的 Prompt。
二、Method 与 URL
POST https://memory.tdai.tencentyun.com/v3/memory-prompt/set
三、应用到团队
curl -i -X POST \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer *********************************' \\ -H "x-tdai-service-id: tdai-mem-xxxxxxxx" \\ -H "x-tdai-user-id: user-001" \\ https://memory.tdai.tencentyun.com/v3/memory-prompt/set \\ -d '{ "action":"apply", "memory_prompt_id":"mp-550e8400-e29b-41d4-a716-446655440000", "team_id":"team-001", "layer":"l1" }'
四、批量清除 Agent 设置
curl -i -X POST \\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer *********************************' \\ -H "x-tdai-service-id: tdai-mem-xxxxxxxx" \\ -H "x-tdai-user-id: user-001" \\ https://memory.tdai.tencentyun.com/v3/memory-prompt/set \\ -d '{ "action":"clear", "team_id":"team-001", "agent_ids":["agent-001","agent-002"], "layer":"l1" }'
五、请求参数
| 参数 | 必选 | 参数含义 | 配置方法及要求 |
| action | 是 | 操作类型 | 数据类型:String取值范围:apply(应用 Prompt)、clear(清除设置) |
| memory_prompt_id | 是 | 要应用的 Prompt ID | 数据类型:Stringaction=apply 时必填;action=clear 时无需传入,即使传入也不生效 |
| team_id | 否 | 团队目标 ID | 数据类型:String不设置该参数表示实例级设置 |
| agent_ids | 否 | Agent 目标 ID 列表 | 数据类型:Array<String>数量限制:[1, 100],元素不可重复传入该参数时必须同时传 team_id |
| layer | 是 | 操作的 Memory 层级 | 数据类型:String取值范围:l1、l2、l3action=apply 时,Prompt 自身 layer 必须与此一致 |
六、响应示例
{ "code":0, "message":"ok", "request_id":"req-7fd3b2dd", "data":{ "affected":3 }}
七、响应参数说明
| 参数名(一级) | 参数名(二级) | 参数含义 |
| data | affected | 实际新增、替换或清除的设置数量。重复操作时为 0。 |
八、错误码
| HTTP 状态码 | 错误信息 | 说明 |
| 400 | memory_prompt_id: memory_prompt_id is required for apply | action=apply 时未提供 memory_prompt_id。 |
| 400 | PROMPT_LAYER_MISMATCH | Prompt 自身的层级与请求指定的 layer 不一致。 |
| 401 | Missing or invalid Authorization header | Bearer API Key 缺失或格式不正确。 |
| 401 | Missing x-tdai-service-id header | 请求头中未携带 x-tdai-service-id。 |
| 404 | MEMORY_PROMPT_NOT_FOUND | 指定 Prompt 不存在或已不可用。 |
| 503 | Memory prompt store not available | Prompt 存储服务暂时不可用,请稍后重试。 |
| 503 | Memory prompt store does not support this operation | 当前存储实现不支持该操作。 |