创建 Agent

最近更新时间:2026-06-26 14:46:07

我的收藏

1. 接口描述

接口请求域名: adp.tencentcloudapi.com 。

创建Agent

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:CreateAgent。
Version String 公共参数,本接口取值:2026-05-20。
Region String 公共参数,详见产品支持的 地域列表
AppId String

应用Id


示例值:2068***2288
Agent AgentSpec

Agent 配置

Kind Integer

Agent 类型,区分 B 端配置态 Agent 与 C 端用户态 Agent

枚举值:

  • 0: 配置端Agent
  • 1: 用户态 Agent

示例值:1

3. 输出参数

参数名称 类型 描述
AgentId String

Agent Id


示例值:0f050c95-31b6-4d31-8c31-1fd6a6bafb4c
RequestId String 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 配置短创建主Agent

输入示例

POST / HTTP/1.1
Host: adp.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAgent
<公共请求参数>

{
    "AppId": "2068***********2288",
    "Agent": {
        "Profile": {
            "Name": "My Main Agent",
            "IconUrl": "https://cdn.xiaowei.qq.com/static/adp/agent-robot.png",
            "Role": 0,
            "Description": "Agent"
        },
        "Instructions": "User Agent",
        "Model": {
            "ModelId": "Moonshot/moonshot-v1-128k",
            "Alias": "moonshot-v1-128k",
            "ContextWordsLimit": 20000,
            "InstructionsWordsLimit": 20000
        },
        "ToolList": [
            {
                "Config": {
                    "PluginId": "bf8ad2f3-1e5c-410a-ae81-abd7c5c14f1c",
                    "ToolId": "959ea8eb-2772-4981-a92f-c4f43625b0c1",
                    "Description": "根据输入的文本描述,智能生成与之相关的结果图(极速版)",
                    "InputList": [
                        {
                            "Name": "Image",
                            "Description": "参考图。Base64 和 Url 必须提供一个,如果都提供以 Url 为准。当传入Image参数时,Style和Resolution参数不生效,输出图分辨率将保持Image传入图分辨率。图片限制:单边分辨率大于128且小于2048;图片小于6M;格式支持 jpg、jpeg、png、bmp、tiff、webp。",
                            "Type": 4,
                            "IsRequired": false,
                            "IsHidden": false,
                            "Input": {
                                "InputType": 0
                            },
                            "SubParameterList": [],
                            "OneOfList": [],
                            "AnyOfList": []
                        }
                    ],
                    "OutputList": [],
                    "HeaderParameterList": [],
                    "QueryParameterList": [],
                    "ToolSource": 0,
                    "IsDisabled": false
                }
            }
        ],
        "PluginList": [
            {
                "PluginId": "bf8ad2f3-1e5c-410a-ae81-abd7c5c14f1c",
                "HeaderParameterList": [],
                "QueryParameterList": [],
                "EnableCamRoleAuth": false,
                "AuthType": 0
            }
        ],
        "SkillList": [
            {
                "SkillId": "f5fc841f-82fc-46ca-8152-d3bab786d52c"
            }
        ],
        "AdvancedConfig": {
            "MaxReasoningRound": 100
        }
    }
}

输出示例

{
    "Response": {
        "AgentId": "0f050c95-31b6-4d31-8c31-1fd6a6bafb4c",
        "RequestId": "c3e001ca-0abc-40cf-a16a-6e5e38f39df7"
    }
}

示例2 配置端创建子Agent

输入示例

POST / HTTP/1.1
Host: adp.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAgent
<公共请求参数>

{
    "AppId": "2068***********2288",
    "Agent": {
        "Profile": {
            "Name": "My Agent",
            "IconUrl": "https://cdn.xiaowei.qq.com/static/adp/agent-robot.png",
            "Role": 1,
            "Description": "Agent"
        },
        "Instructions": "User Agent",
        "Model": {
            "ModelId": "Moonshot/moonshot-v1-128k",
            "Alias": "moonshot-v1-128k",
            "ContextWordsLimit": 20000,
            "InstructionsWordsLimit": 20000
        },
        "ToolList": [
            {
                "Config": {
                    "PluginId": "bf8ad2f3-1e5c-410a-ae81-abd7c5c14f1c",
                    "ToolId": "959ea8eb-2772-4981-a92f-c4f43625b0c1",
                    "Description": "根据输入的文本描述,智能生成与之相关的结果图(极速版)",
                    "InputList": [
                        {
                            "Name": "Image",
                            "Description": "参考图。Base64 和 Url 必须提供一个,如果都提供以 Url 为准。当传入Image参数时,Style和Resolution参数不生效,输出图分辨率将保持Image传入图分辨率。图片限制:单边分辨率大于128且小于2048;图片小于6M;格式支持 jpg、jpeg、png、bmp、tiff、webp。",
                            "Type": 4,
                            "IsRequired": false,
                            "IsHidden": false,
                            "Input": {
                                "InputType": 0
                            },
                            "SubParameterList": [],
                            "OneOfList": [],
                            "AnyOfList": []
                        }
                    ],
                    "OutputList": [],
                    "HeaderParameterList": [],
                    "QueryParameterList": [],
                    "ToolSource": 0,
                    "IsDisabled": false
                }
            }
        ],
        "PluginList": [
            {
                "PluginId": "bf8ad2f3-1e5c-410a-ae81-abd7c5c14f1c",
                "HeaderParameterList": [],
                "QueryParameterList": [],
                "EnableCamRoleAuth": false,
                "AuthType": 0
            }
        ],
        "SkillList": [
            {
                "SkillId": "f5fc841f-82fc-46ca-8152-d3bab786d52c"
            }
        ],
        "AdvancedConfig": {
            "MaxReasoningRound": 100
        }
    }
}

输出示例

{
    "Response": {
        "AgentId": "e86a4137-2a19-469f-9b47-6fd4a8c6c115",
        "RequestId": "31d23269-e98c-47df-a90d-963a00bbc4f4"
    }
}

示例3 用户端创建子Agent

输入示例

POST / HTTP/1.1
Host: adp.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateAgent
<公共请求参数>

{
    "AppId": "2068***********2288",
    "Agent": {
        "Profile": {
            "Name": "User Agent",
            "IconUrl": "https://cdn.xiaowei.qq.com/static/adp/agent-robot.png",
            "Role": 1,
            "Description": "User Agent",
            "ParentAgentId": "user_e55be224-3cb4-4951-abdd-3454bd70b6a1"
        },
        "Instructions": "User Agent",
        "Model": {
            "ModelId": "Moonshot/moonshot-v1-128k",
            "Alias": "moonshot-v1-128k",
            "ContextWordsLimit": 20000,
            "InstructionsWordsLimit": 20000
        },
        "ToolList": [
            {
                "Config": {
                    "PluginId": "bf8ad2f3-1e5c-410a-ae81-abd7c5c14f1c",
                    "ToolId": "959ea8eb-2772-4981-a92f-c4f43625b0c1",
                    "Description": "根据输入的文本描述,智能生成与之相关的结果图(极速版)",
                    "InputList": [
                        {
                            "Name": "Image",
                            "Description": "参考图。Base64 和 Url 必须提供一个,如果都提供以 Url 为准。当传入Image参数时,Style和Resolution参数不生效,输出图分辨率将保持Image传入图分辨率。图片限制:单边分辨率大于128且小于2048;图片小于6M;格式支持 jpg、jpeg、png、bmp、tiff、webp。",
                            "Type": 4,
                            "IsRequired": false,
                            "IsHidden": false,
                            "Input": {
                                "InputType": 0
                            },
                            "SubParameterList": [],
                            "OneOfList": [],
                            "AnyOfList": []
                        }
                    ],
                    "OutputList": [],
                    "HeaderParameterList": [],
                    "QueryParameterList": [],
                    "ToolSource": 0,
                    "IsDisabled": false
                }
            }
        ],
        "PluginList": [
            {
                "PluginId": "bf8ad2f3-1e5c-410a-ae81-abd7c5c14f1c",
                "HeaderParameterList": [],
                "QueryParameterList": [],
                "EnableCamRoleAuth": false,
                "AuthType": 0
            }
        ],
        "SkillList": [
            {
                "SkillId": "f5fc841f-82fc-46ca-8152-d3bab786d52c"
            }
        ],
        "AdvancedConfig": {
            "MaxReasoningRound": 100
        }
    },
    "Kind": 1
}

输出示例

{
    "Response": {
        "AgentId": "user_cc760218-4bb4-4c4e-b6d2-4996e212597e",
        "RequestId": "5b14e728-55b3-44cb-9d49-9dac2c96423b"
    }
}

5. 开发者资源

腾讯云 API 平台

腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。

API Inspector

用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

该接口暂无业务逻辑相关的错误码,其他错误码详见 公共错误码