查询可用Agent
curl --request GET \
--url https://api.example.com/api/v1/agentsimport requests
url = "https://api.example.com/api/v1/agents"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/agents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/agents"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/agents")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/agents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"total": 2,
"agents": [
{
"name": "dify",
"type": "DifyAgent",
"module": "agent.dify",
"capabilities": {
"streaming": true,
"file_upload": true
}
},
{
"name": "fastgpt",
"type": "FastGPTAgent",
"module": "agent.fastgpt",
"capabilities": {
"streaming": true,
"file_upload": true
}
}
]
}
}Agent管理
获取Agent列表
GET
/
api
/
v1
/
agents
查询可用Agent
curl --request GET \
--url https://api.example.com/api/v1/agentsimport requests
url = "https://api.example.com/api/v1/agents"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/agents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/agents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/agents"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/agents")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/agents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"total": 2,
"agents": [
{
"name": "dify",
"type": "DifyAgent",
"module": "agent.dify",
"capabilities": {
"streaming": true,
"file_upload": true
}
},
{
"name": "fastgpt",
"type": "FastGPTAgent",
"module": "agent.fastgpt",
"capabilities": {
"streaming": true,
"file_upload": true
}
}
]
}
}概述
获取当前系统中所有可用的AI Agent列表,包括每个Agent的详细信息和支持的功能。认证方式
该接口不需要特殊的认证信息,可以直接访问。响应说明
成功响应
返回当前系统中所有已注册的Agent信息,包括Agent名称、类型、模块路径以及支持的功能特性。响应字段说明
使用示例
获取Agent列表
curl -X GET 'https://your-domain.com/api/v1/agents'
响应示例
{
"success": true,
"data": {
"total": 2,
"agents": [
{
"name": "dify",
"type": "DifyAgent",
"module": "agent.dify",
"capabilities": {
"streaming": true,
"file_upload": true
}
},
{
"name": "fastgpt",
"type": "FastGPTAgent",
"module": "agent.fastgpt",
"capabilities": {
"streaming": true,
"file_upload": true
}
}
]
}
}
支持的Agent
Dify Agent
- 名称:
dify - 类型: DifyAgent
- 功能: 支持流式传输和文件上传
- 用途: 基于Dify平台的AI对话服务
FastGPT Agent
- 名称:
fastgpt - 类型: FastGPTAgent
- 功能: 支持流式传输和文件上传
- 用途: 基于FastGPT平台的AI对话服务
使用建议
- Agent选择:根据您的具体需求选择合适的Agent
- 功能检查:在调用前检查Agent支持的功能特性
- 兼容性:确保您的应用逻辑与所选Agent的功能兼容
- 错误处理:处理可能的Agent不可用情况
