# 查询智能体列表 - ListCoreAgents
#### 功能介绍
查询当前租户下的智能体列表，支持分页和过滤。
**适用场景：**
查看租户下所有智能体实例。
按名称筛选智能体。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-agentarts/agentarts_07_0003.html)。
#### 授权信息
账号根用户具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备如下身份策略权限，更多的权限说明请参见[权限和授权项](https://support.huaweicloud.com/api-agentarts/Permission.html)。
| 授权项                                   | 访问级别 | 资源类型（\*为必须）     | 条件键                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | 别名 | 依赖的授权项 |
|:---|:---|:---|:---|:---|:---|
| agentarts:managedAgent:listCoreAgents | List | managedAgent \* | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | -  | -      |
| agentarts:managedAgent:listCoreAgents | List | -               | - g:RequestTag/\<tag-key\>   - g:TagKeys    | -  | -      |
   
#### URI
GET /v1/core/agents
表1Query参数 
| 参数          | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|:---|
| name        | 否    | String  | **参数解释**： 按智能体名称过滤，支持模糊匹配，不传时返回所有智能体。 **约束限制**： 不涉及。 **取值范围**： 长度为1-64个字符，可包含中文、字母、数字、下划线和中划线。 **默认取值**： 不涉及。 |
| description | 否    | String  | **参数解释**： 按智能体描述过滤，支持模糊匹配，不传时返回所有智能体。 **约束限制**： 不涉及。 **取值范围**： 不涉及。 **默认取值**： 不涉及。                            |
| limit       | 否    | Integer | **参数解释**： 每页返回的记录数。 **约束限制**： 不涉及。 **取值范围**： 10-100，单位：条。 **默认取值**： 10                                        |
| offset      | 否    | Integer | **参数解释**： 分页查询偏移量，表示从第几条记录开始查询，从1开始。 **约束限制**： 不涉及。 **取值范围**： 1-1000。 **默认取值**： 1                             |
   
#### 请求参数
无
#### 响应参数
**状态码：200**
表2响应Body参数 
| 参数    | 参数类型                                                                                           | 描述                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| items | Array of [AgentItem] objects | **参数解释**： 智能体列表（列表模式仅返回摘要字段，详情请调用获取[智能体详情接口](https://support.huaweicloud.com/api-agentarts/ShowCoreAgent.html)），元素个数0-100个。 **取值范围**： 不涉及。 |
| total | Integer                                                                                        | **参数解释**： 符合条件的智能体总数。 **取值范围**： 0-100000。                                                                                                  |
   
 表3AgentItem 
| 参数               | 参数类型                                                                                                       | 描述                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| agent_id         | String                                                                                                     | **参数解释**： 智能体唯一标识。 **取值范围**： 匹配标准的UUID格式（8-4-4-4-12的十六进制数字串，由连字符分隔），例如0451ff49-3c47-4049-851c-51c23fe7fe69。                                                                                                             |
| name             | String                                                                                                     | **参数解释**： 智能体名称。 **取值范围**： 长度为2-40个字符，必须以小写字母开头、以小写字母或数字结尾，只能包含小写字母、数字和中划线。                                                                                                                                             |
| description      | String                                                                                                     | **参数解释**： 智能体描述信息。 **取值范围**： 长度为0-4096个字符。                                                                                                                                                                              |
| environment_id   | String                                                                                                     | **参数解释**： 关联的环境ID。 **取值范围**： 匹配标准的UUID格式（8-4-4-4-12的十六进制数字串，由连字符分隔），例如0451ff49-3c47-4049-851c-51c23fe7fe69。                                                                                                             |
| agent_gateway_id | String                                                                                                     | **参数解释**： 智能体网关的唯一ID，用于智能体的入站流量路由。获取方式：通过[查询网关实例列表](https://support.huaweicloud.com/api-agentarts/ListCoreIngresses.html)接口获取。 **取值范围**： 匹配标准的UUID格式（8-4-4-4-12的十六进制数字串，由连字符分隔），例如0451ff49-3c47-4049-851c-51c23fe7fe69。 |
| model            | Array of [ModelConfigResp] objects | **参数解释**： 模型配置列表，包含模型提供商和模型的详细信息，元素个数1个。 **取值范围**： 不涉及。                                                                                                                                                                 |
| latest_version   | String                                                                                                     | **参数解释**： 最新版本号。 **取值范围**： 匹配小写字母开头、数字结尾的版本号格式，如v1、v2。                                                                                                                                                                  |
| created_at       | String                                                                                                     | **参数解释**： 创建时间，UTC时间格式，格式为YYYY-MM-DDTHH:mm:ssZ，由系统自动生成。例如：2024-05-20T14:30:00Z。 **取值范围**： 不涉及。                                                                                                                          |
| updated_at       | String                                                                                                     | **参数解释**： 更新时间，UTC时间格式，格式为YYYY-MM-DDTHH:mm:ssZ，由系统自动生成。例如：2024-05-20T14:30:00Z。 **取值范围**： 不涉及。                                                                                                                          |
   
 表4ModelConfigResp 
| 参数            | 参数类型   | 描述                                                                                                                                                                                                                                                                                                       |
|:---|:---|:---|
| provider_id   | String | **参数解释**： 模型提供商ID。 **取值范围**： 匹配标准的UUID格式（8-4-4-4-12的十六进制数字串，由连字符分隔），例如0451ff49-3c47-4049-851c-51c23fe7fe69。 |
| provider_name | String | **参数解释**： 模型提供商名称。 **取值范围**： 长度为0-64个字符。                                                                    |
| model_id      | String | **参数解释**： 模型ID。 **取值范围**： 匹配标准的UUID格式（8-4-4-4-12的十六进制数字串，由连字符分隔），例如0451ff49-3c47-4049-851c-51c23fe7fe69。    |
| model_name    | String | **参数解释**： 模型名称。 **取值范围**： 长度为0-128个字符。                                                                      |
   
**状态码：400**
表5响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000400表示客户端请求参数错误。 **取值范围**： 固定值：AgentArts.03000400。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                             |
   
**状态码：401**
表6响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000401表示未授权（认证令牌缺失、无效或已过期）。 **取值范围**： 固定值：AgentArts.03000401。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                                      |
   
**状态码：403**
表7响应Body参数 
| 参数                          | 参数类型                                                                                                                       | 描述                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|
| error_code                  | String                                                                                                                     | **参数解释**： 错误码。枚举值说明：AgentArts.03000403表示禁止访问（认证后权限不足）。 **取值范围**： 固定值：AgentArts.03000403。 |
| error_msg                   | String                                                                                                                     | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                                 |
| coded_authorization_message | String                                                                                                                     | **参数解释**： 当API无访问权限时报错信息。 **取值范围**： 长度为1-1024个字符。                                        |
| details                     | Array of [ManagedAgentErrorDetail] objects | **参数解释**： 依赖的下游服务错误信息列表。 **取值范围**： 最小数量0，最大数量10。                                         |
   
 表8ManagedAgentErrorDetail 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                   |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。 **取值范围**： 长度为18个字符。      |
| error_msg  | String | **参数解释**： 错误信息。 **取值范围**： 长度为1-1024个字符。 |
   
**状态码：429**
表9响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000429表示请求过于频繁（触发限流）。 **取值范围**： 固定值：AgentArts.03000429。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                                |
   
**状态码：500**
表10响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                              |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000500表示服务器内部错误。 **取值范围**： 固定值：AgentArts.03000500。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                           |
   
#### 请求示例
查询所有智能体
```
GET https://{Endpoint}/v1/core/agents
```
#### 响应示例
**状态码：200**
```
{
  "items" : [ {
    "agent_id" : "a1b2c3d4-1234-5678-abcd-e1f2a3b4c5d6",
    "name" : "agent-l1ppk",
    "description" : "智能客服助手",
    "environment_id" : "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "agent_gateway_id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "model" : [ {
      "provider_id" : "a1b2c3d4-1234-5678-abcd-e1f2a3b4c5d6",
      "provider_name" : "huawei",
      "model_id" : "b2c3d4e5-1234-5678-abcd-e1f2a3b4c5d6",
      "model_name" : "claude-sonnet-4-6"
    } ],
    "latest_version" : "v1",
    "created_at" : "2024-05-20T14:30:00Z",
    "updated_at" : "2024-05-20T14:30:00Z"
  } ],
  "total" : 1
}
```
#### 状态码
| 状态码 | 描述            |
|:---|:---|
| 200 | 查询成功，返回智能体列表。 |
| 400 | 请求参数错误。       |
| 401 | 未授权。          |
| 403 | 禁止访问。         |
| 429 | 请求过于频繁。       |
| 500 | 服务器内部错误。      |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-agentarts/ErrorCode.html)。
