应用 Dream 动作

更新时间:
复制 MD 格式

使用 ApplyMemoryDreamActions 接口应用结构化记忆 Dream 产生的提案动作,或批准 applyMode=plan 生成的计划。

前提条件

  • 已创建 AgentStorage 实例且状态为 normal,并获取实例访问地址(endpoint)和实例名。

  • 已创建 API Key。

  • 本接口仅适用于结构化记忆 Dream;文件 Dream 的动作由服务自动应用,不支持调用本接口。

请求参数

字段

类型

必填

说明

memoryStoreName

string

是

记忆库名称。

dreamId

string

是

整理任务 ID。

mode

string

否

actions(默认)或 plan。

actionIds

array

mode=actions 时

待应用的动作 ID 列表,单次最多 100 个。

applier

string

否

应用者标识,记录在审计中。

approver

string

mode=plan 时

计划批准者标识,记录在审计中。

请求示例

使用 API Key 认证时,通过 x-ots-instancename 和 x-ots-apikey 请求头传入实例名和 API Key。

curl -X POST https://<endpoint>/ApplyMemoryDreamActions \
  -H "x-ots-instancename: <instance-name>" \
  -H "x-ots-apikey: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
  "memoryStoreName": "agent_memory",
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "actionIds": ["968768529cdfde8d56686a71e1c28227", "a0f4715245920ea7b6a34c1828c6f1ae"]
}'

响应

{
  "memoryStoreName": "agent_memory",
  "dreamId": "2a528008111f5dc3500c73fd965089f7",
  "applied": 2,
  "failed": 0,
  "results": [
    { "actionId": "968768529cdfde8d56686a71e1c28227", "status": "applied", "memoryId": "bd14a67ed215c114896325d912c8fa71" },
    { "actionId": "a0f4715245920ea7b6a34c1828c6f1ae", "status": "applied", "memoryId": "fa253856113f78d51a3b84a1fdf2d110" }
  ]
}

EMIT_SKILL/EMIT_PROFILE 动作由整理任务直接写入,没有手动 apply 流程,混入此类动作 ID 会被拒绝。