接口描述
把会话迁移到另一个沙箱实例(换地域 / 换后端时使用)。
POST /v2/enterprises/{enterpriseId}/managedagent/agents/{agentId}/sessions/{sessionId}/migrate输入参数
路径参数
参数 | 类型 | 说明 |
enterpriseId | string | WorkBuddy 企业 ID |
agentId | string | 等价于请求体字段 AgentId |
sessionId | string | 等价于请求体字段 SessionId |
查询参数
无
请求体
字段 | 类型 | 说明 |
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 | 租户未开通,或企业不存在 |