查询Agent列表
更新时间:2026-11-24
接口说明
- 本接口用于分页查询当前账号下的 Agent,支持按名称前缀、内核类型和状态过滤。
- 列表项不含 def 字段,需要完整定义请调用「查询Agent详情」。
- 结果按创建时间倒序返回。
请求结构
Plain Text
1POST /v1/agents/list HTTP/1.1
2Host: aw-harness.bj.baidubce.com
3Authorization: authorization string
4
5{
6 "agentNamePrefix": "my-",
7 "harnessType": "opencode",
8 "status": "created",
9 "pageNo": 1,
10 "pageSize": 20
11}
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| agentNamePrefix | String | 否 | RequestBody参数 | 名称最左前缀匹配。% 与 _ 会先被转义,传 % 时匹配字面字符,通常命中 0 条。 |
| harnessType | String | 否 | RequestBody参数 | 等值过滤。不校验是否为已注册内核,传不存在的类型返回空列表。 |
| status | String | 否 | RequestBody参数 | 按状态过滤:creating、created、failed、deleting;空即不过滤。未知值返回空列表。 |
| pageNo | Integer | 否 | RequestBody参数 | 页码,默认 1;负数返回 400。 |
| pageSize | Integer | 否 | RequestBody参数 | 每页条数,默认 20,上限 100;负数或超限返回 400。 |
返回头域
除公共头域,无其它特殊头域。
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| total | Long | 满足筛选条件的总条数。 |
| size | Integer | 本页实际条数。 |
| list | List<DefBriefResp> | 列表项数组。 |
错误码
| 错误码 | 错误描述 | HTTP状态码 | 中文解释 |
|---|---|---|---|
| InvalidArgument | The request parameters are invalid. | 400 | 分页参数越界或请求体含未识别字段。 |
| Forbidden | Operation requires an admin caller. | 403 | 缺少鉴权账号或跨账号访问他人资源。 |
| PersistFailed | Failed to list agent defs. | 500 | 服务端存储读取失败,可重试。 |
| Internal | Internal server error. | 500 | 服务端内部错误,保留 requestId 联系维护方。 |
请求示例
Plain Text
1POST http://aw-harness.bj.baidubce.com/v1/agents/list
2Host: aw-harness.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4Content-Type: application/json
5
6{
7 "pageNo": 1,
8 "pageSize": 20
9}
返回示例
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3x-bce-request-id: 9f3d0e6a-1c2b-4d5e-8a7f-0b1c2d3e4f5a
4Server: BWS
5
6{
7 "result": {
8 "total": 7,
9 "size": 1,
10 "list": [
11 {
12 "agentId": "ag-7f3c9b2e",
13 "agentName": "my-agent",
14 "description": "示例 Agent",
15 "version": 3,
16 "harnessType": "opencode",
17 "status": "created",
18 "createTime": "2026-09-09T10:00:00Z",
19 "updateTime": "2026-09-09T11:23:45Z"
20 }
21 ]
22 },
23 "requestId": "9f3d0e6a-1c2b-4d5e-8a7f-0b1c2d3e4f5a"
24}
评价此篇文章
