对话创建
更新时间:2025-12-10
POST
https://qianfan.baidubce.com/v2/agent/{agent_code}/create
本接口用于创建一个新的 Agent 对话会话,调用成功后将返回一个conversation_id。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
URL 参数
agent_code
string
支持以下Agent:
- code_interpreter:代码解释器
- browser_use:浏览器使用
- deepresearch:深度研究
由特定agent_code生成时,仅限在该智能体(Agent)内部使用,禁止跨智能体调用。
必选
请求结构
POST /v2/agent/{agent_code}/create HTTP/1.1
HOST: qianfan.baidubce.com
Authorization: Bearer <Access_Token>
Content-Type: application/json
示例代码
请求示例
curl -X POST "https://qianfan.baidubce.com/v2/agent/deepresearch/create" \
-H "Host: qianfan.baidubce.com" \
-H "Authorization: Bearer <API Key>" \
-H "Content-Type: application/json" \
-d '{
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
request_id
string
请求的唯一标识 ID
必选
result
object {1}
返回结果对象
必选
显示子属性
隐藏子属性
conversation_id
string
对话ID,新创建的会话唯一标识。
必选
响应示例
{
"request_id": "e84f1058-0b15-4983-ba18-ed140bd480aa",
"result": {
"conversation_id": "de65bd4c-f44f-4081-8435-9f99e671d18b"
}
}
