fix(agent): align AM lifecycle paths to /agents/{id} (real-test: create works)
Real production test (user account) confirmed HM->AM POST /agents creates a real
agent (returned subdomain + status). But stop/delete still used the old
/api/agent/agents/{id} defaults and 404'd. Aligned status/stop/delete defaults to
the same namespace as create: /agents/{id}, /agents/{id}/stop. AM contract doc
notes these are HM's best guess pending AM's confirmation of the real lifecycle
endpoints (their doc only specified create).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -51,15 +51,18 @@ HM 用 `Authorization: Bearer <service_token>` 调 AM。统一响应信封建议
|
||||
|
||||
> ⚠️ provisioning 同步:HM 超时默认 60s(`AGENT_RUNTIME_START_TIMEOUT_SECONDS`)。
|
||||
|
||||
> ⚠️ **下面 1.2–1.4 的路径是 HM 的推测**(你们文档只写了创建 + agent 自身 /health + A2A 调用,没写 agent-manager 的生命周期接口)。**实测:创建 `POST /agents` ✅ 通,但 stop/delete 用 `/api/agent/agents/{id}/...` 返回 404。** HM 已把默认改成与创建同命名空间的 `/agents/{id}`。**请 AM 确认真实的 状态/停止/删除 端点(方法 + 路径 + 用哪个 id),不一致我们改 env 覆盖即可。**
|
||||
|
||||
### 1.2 取 agent 状态
|
||||
`GET {AM}/api/agent/agents/{runtime_id}`
|
||||
→ `data: { "status": "running" }`(HM 接受 `status`/`runtime_status`/`state`)。HM 据此判断 agent 是否存活/挂掉。
|
||||
`GET {AM}/agents/{runtime_id}` → `data: { "status": "running" }`(HM 接受 `status`/`runtime_status`/`state`)。
|
||||
|
||||
### 1.3 停止 agent
|
||||
`POST {AM}/api/agent/agents/{runtime_id}/stop` → 2xx 即可。
|
||||
`POST {AM}/agents/{runtime_id}/stop` → 2xx 即可。
|
||||
|
||||
### 1.4 删除 agent
|
||||
`DELETE {AM}/api/agent/agents/{runtime_id}` → 2xx 即可。
|
||||
`DELETE {AM}/agents/{runtime_id}` → 2xx 即可。
|
||||
|
||||
> `runtime_id` = HM 从创建响应取到的实例标识(优先 `runtime_id`/`agent_id`/`id`/`name`/`namespace`)。实测创建时 HM 发的 `name="dep-xxxx"`,若你们生命周期用别的 id,请在响应里明确返回 `runtime_id`。
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user