CodeBuddy 迁移 Agent 会话

把会话迁移到另一个沙箱实例(换地域 / 换后端时使用)。POST /v2/enterprises/{enterpriseId}/managedagent/agents/{agentId}/sessions/{sessionId}/migrate。

相关产品
CodeBuddy 产品页,含版本规格、价格与购买入口。

一、路径参数

参数 类型 说明
enterpriseId string WorkBuddy 企业 ID
agentId string 等价于请求体字段 AgentId
sessionId string 等价于请求体字段 SessionId

二、查询参数

无

三、请求体

MigrateAgentSessionRequest 请求体。

字段 类型 说明
SessionId string SessionId 待迁移的会话 ID(必填)。
AgentId string AgentId 目标 Agent 业务 ID(必填),必须与 Session 原 Agent 相同。
TargetVersionId string TargetVersionId 目标版本 ID(必填,字符串形式)。需归属同一 Agent 且状态为 ENABLED。

四、输出参数

(200,业务出参包装在 code / data / msg / requestId 中)

MigrateAgentSessionResponse 对应 /MigrateAgentSession 响应体。

字段 类型 说明
sessionId string SessionId 被迁移的会话 ID。
status string Status 迁移后的会话状态(迁移成功为 MIGRATING,随后由运行时推进到 ACTIVE)。

五、输入示例

POST /v2/enterprises/{enterpriseId}/managedagent/agents/{agentId}/sessions/{sessionId}/migrateAuthorization: Bearer pt_<YOUR_APP_KEY>Content-Type: application/json{ "AgentId": "736918300000000001", "SessionId": "736918300000000002", "TargetVersionId": "2087791755109965825"}

六、输出示例

{ "code": 0, "data": { "sessionId": "736918300000000002", "status": "string" }, "msg": "OK", "requestId": "3c6d138e-1234-5678-9abc-def012345678"}

七、错误码

注意:说明:

注意:以下仅列出了接口业务逻辑相关的错误码,其他错误码详见错误响应与公共错误码。

错误码 说明
FailedOperation.SessionCrossAgentMigrate 不允许跨 Agent 迁移会话
FailedOperation.SessionNotMigrable 当前会话状态不允许迁移
InternalError.SessionOperationFailed 会话操作失败
InvalidParameter.AgentIDRequired 缺少 AgentId
InvalidParameter.InvalidRequestBody 请求体不合法
InvalidParameter.SessionIDRequired 缺少 SessionId
InvalidParameter.VersionIDRequired 缺少 VersionId
MissingParameter.UinRequired 公共参数中缺少 Uin
ResourceNotFound.Agent Agent 不存在
ResourceNotFound.Session 会话不存在
ResourceNotFound.Version 版本不存在
UnauthorizedOperation.UnprovisionedTenant 租户未开通,或企业不存在
赞 (0)
上一篇 4天前
下一篇 4天前