feat(agent): complete closed-loop runtime and pricing fallback

This commit is contained in:
qzl
2026-03-05 15:34:37 +08:00
parent b02a322bf3
commit b486e78ff3
67 changed files with 3832 additions and 7 deletions
+80
View File
@@ -786,6 +786,86 @@
---
## Agent Runtime
### POST /agent/runs
创建一次 Agent 异步运行任务(需要认证)。
**Request:**
```json
{
"session_id": "string? (optional, 为空时自动创建会话)",
"prompt": "string (1-5000 chars)"
}
```
**Response:** 202 Accepted
```json
{
"task_id": "string",
"session_id": "string",
"created": true
}
```
**Errors:**
- 401: 未认证
- 403: 非会话 owner
- 422: 请求参数无效
---
### POST /agent/runs/{session_id}/resume
恢复一次等待工具结果的 Agent 运行(需要认证)。
**Request:**
```json
{
"tool_call_id": "string"
}
```
**Response:** 202 Accepted
```json
{
"task_id": "string",
"session_id": "string",
"created": false
}
```
**Errors:**
- 401: 未认证
- 403: 非会话 owner
- 422: 请求参数无效
---
### GET /agent/runs/{session_id}/events
订阅 Agent SSE 事件流(需要认证)。
**Headers:**
- `Last-Event-ID` (optional): 断点续传游标
**Response:** 200 OK
`Content-Type: text/event-stream`
```text
id: 2-0
event: RUN_STARTED
data: {"session_id":"..."}
```
**Errors:**
- 401: 未认证
- 403: 非会话 owner
---
## Infra
### GET /infra/health