# 删除智能体 - DeleteCoreAgent
#### 功能介绍
根据agent_id删除智能体。
**适用场景：**
删除不再需要的智能体实例。
**约束限制**：
当存在活跃Session引用该智能体时，删除操作将被拒绝，需先终止或等待Session结束。
#### 调用方法
请参见[如何调用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:deleteCoreAgent | Write | managedAgent \* | g:ResourceTag/\<tag-key\> | -  | - agentarts:runtime:deleteCoreRuntime  - vpc:routeTables:update  - vpc:nativePorts:delete  - eip:publicIps:disassociateInstance   |
   
#### URI
DELETE /v1/core/agents/{agent_id}
表1路径参数 
| 参数       | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
|:---|:---|:---|:---|
| agent_id | 是    | String | **参数解释**： 智能体ID，用于唯一标识一个智能体实例。获取方式：通过创建智能体接口返回的agent_id字段获取，或通过查询智能体列表接口获取，具体参见[查询智能体列表](https://support.huaweicloud.com/api-agentarts/ListCoreAgents.html)。 **约束限制**： 不涉及。 **取值范围**： 匹配标准的UUID格式（8-4-4-4-12的十六进制数字串，由连字符分隔），例如0451ff49-3c47-4049-851c-51c23fe7fe69。 **默认取值**： 不涉及。 |
   
#### 请求参数
无
#### 响应参数
**状态码：204**
无
**状态码：400**
表2响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000400表示客户端请求参数错误。 **取值范围**： 固定值：AgentArts.03000400。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                             |
   
**状态码：401**
表3响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000401表示未授权（认证令牌缺失、无效或已过期）。 **取值范围**： 固定值：AgentArts.03000401。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                                      |
   
**状态码：403**
表4响应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。                                         |
   
 表5ManagedAgentErrorDetail 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                      |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。 **取值范围**： 长度为18个字符。      |
| error_msg  | String | **参数解释**： 错误信息。 **取值范围**： 长度为1-1024个字符。 |
   
**状态码：404**
表6响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                               |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000404表示资源不存在。 **取值范围**： 固定值：AgentArts.03000404。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                         |
   
**状态码：409**
表7响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                              |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000409表示资源冲突。 **取值范围**： 固定值：AgentArts.03000409。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                        |
   
**状态码：429**
表8响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000429表示请求过于频繁（触发限流）。 **取值范围**： 固定值：AgentArts.03000429。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                                |
   
**状态码：500**
表9响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|
| error_code | String | **参数解释**： 错误码。枚举值说明：AgentArts.03000500表示服务器内部错误。 **取值范围**： 固定值：AgentArts.03000500。 |
| error_msg  | String | **参数解释**： 错误详细信息。 **取值范围**： 长度为1-512个字符。                                           |
   
#### 请求示例
删除智能体
```
DELETE https://{Endpoint}/v1/core/agents/{agent_id}
```
#### 响应示例
无
#### 状态码
| 状态码 | 描述            |
|:---|:---|
| 204 | 删除成功，无响应body。 |
| 400 | 请求参数错误。       |
| 401 | 未授权。          |
| 403 | 禁止访问。         |
| 404 | 资源不存在。        |
| 409 | 资源冲突。         |
| 429 | 请求过于频繁。       |
| 500 | 服务器内部错误。      |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-agentarts/ErrorCode.html)。
