创建 A2A 智能体
curl --request POST \
--url 'https://api.flashcat.cloud/safari/a2a-agent/create?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"agent_name": "deploy-bot",
"instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
"card_url": "https://agents.example.com/deploy-bot/card",
"auth_type": "bearer",
"auth_config": {
"token": "sk-agent-token-example-9f2c"
},
"streaming": true,
"team_id": 0,
"environments": [
"env_8s7Hn2kLpQ3xYbVc4Wd2m"
]
}
'import requests
url = "https://api.flashcat.cloud/safari/a2a-agent/create?app_key="
payload = {
"agent_name": "deploy-bot",
"instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
"card_url": "https://agents.example.com/deploy-bot/card",
"auth_type": "bearer",
"auth_config": { "token": "sk-agent-token-example-9f2c" },
"streaming": True,
"team_id": 0,
"environments": ["env_8s7Hn2kLpQ3xYbVc4Wd2m"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: 'deploy-bot',
instructions: 'Inspect deployment pipelines and propose rollbacks when a canary fails health checks.',
card_url: 'https://agents.example.com/deploy-bot/card',
auth_type: 'bearer',
auth_config: {token: 'sk-agent-token-example-9f2c'},
streaming: true,
team_id: 0,
environments: ['env_8s7Hn2kLpQ3xYbVc4Wd2m']
})
};
fetch('https://api.flashcat.cloud/safari/a2a-agent/create?app_key=', 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.flashcat.cloud/safari/a2a-agent/create?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => 'deploy-bot',
'instructions' => 'Inspect deployment pipelines and propose rollbacks when a canary fails health checks.',
'card_url' => 'https://agents.example.com/deploy-bot/card',
'auth_type' => 'bearer',
'auth_config' => [
'token' => 'sk-agent-token-example-9f2c'
],
'streaming' => true,
'team_id' => 0,
'environments' => [
'env_8s7Hn2kLpQ3xYbVc4Wd2m'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/safari/a2a-agent/create?app_key="
payload := strings.NewReader("{\n \"agent_name\": \"deploy-bot\",\n \"instructions\": \"Inspect deployment pipelines and propose rollbacks when a canary fails health checks.\",\n \"card_url\": \"https://agents.example.com/deploy-bot/card\",\n \"auth_type\": \"bearer\",\n \"auth_config\": {\n \"token\": \"sk-agent-token-example-9f2c\"\n },\n \"streaming\": true,\n \"team_id\": 0,\n \"environments\": [\n \"env_8s7Hn2kLpQ3xYbVc4Wd2m\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/safari/a2a-agent/create?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"deploy-bot\",\n \"instructions\": \"Inspect deployment pipelines and propose rollbacks when a canary fails health checks.\",\n \"card_url\": \"https://agents.example.com/deploy-bot/card\",\n \"auth_type\": \"bearer\",\n \"auth_config\": {\n \"token\": \"sk-agent-token-example-9f2c\"\n },\n \"streaming\": true,\n \"team_id\": 0,\n \"environments\": [\n \"env_8s7Hn2kLpQ3xYbVc4Wd2m\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/a2a-agent/create?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"deploy-bot\",\n \"instructions\": \"Inspect deployment pipelines and propose rollbacks when a canary fails health checks.\",\n \"card_url\": \"https://agents.example.com/deploy-bot/card\",\n \"auth_type\": \"bearer\",\n \"auth_config\": {\n \"token\": \"sk-agent-token-example-9f2c\"\n },\n \"streaming\": true,\n \"team_id\": 0,\n \"environments\": [\n \"env_8s7Hn2kLpQ3xYbVc4Wd2m\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}A2A 智能体
创建 A2A 智能体
通过智能体卡片 URL 注册新的 A2A 远程智能体。
POST
/
safari
/
a2a-agent
/
create
创建 A2A 智能体
curl --request POST \
--url 'https://api.flashcat.cloud/safari/a2a-agent/create?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"agent_name": "deploy-bot",
"instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
"card_url": "https://agents.example.com/deploy-bot/card",
"auth_type": "bearer",
"auth_config": {
"token": "sk-agent-token-example-9f2c"
},
"streaming": true,
"team_id": 0,
"environments": [
"env_8s7Hn2kLpQ3xYbVc4Wd2m"
]
}
'import requests
url = "https://api.flashcat.cloud/safari/a2a-agent/create?app_key="
payload = {
"agent_name": "deploy-bot",
"instructions": "Inspect deployment pipelines and propose rollbacks when a canary fails health checks.",
"card_url": "https://agents.example.com/deploy-bot/card",
"auth_type": "bearer",
"auth_config": { "token": "sk-agent-token-example-9f2c" },
"streaming": True,
"team_id": 0,
"environments": ["env_8s7Hn2kLpQ3xYbVc4Wd2m"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
agent_name: 'deploy-bot',
instructions: 'Inspect deployment pipelines and propose rollbacks when a canary fails health checks.',
card_url: 'https://agents.example.com/deploy-bot/card',
auth_type: 'bearer',
auth_config: {token: 'sk-agent-token-example-9f2c'},
streaming: true,
team_id: 0,
environments: ['env_8s7Hn2kLpQ3xYbVc4Wd2m']
})
};
fetch('https://api.flashcat.cloud/safari/a2a-agent/create?app_key=', 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.flashcat.cloud/safari/a2a-agent/create?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_name' => 'deploy-bot',
'instructions' => 'Inspect deployment pipelines and propose rollbacks when a canary fails health checks.',
'card_url' => 'https://agents.example.com/deploy-bot/card',
'auth_type' => 'bearer',
'auth_config' => [
'token' => 'sk-agent-token-example-9f2c'
],
'streaming' => true,
'team_id' => 0,
'environments' => [
'env_8s7Hn2kLpQ3xYbVc4Wd2m'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/safari/a2a-agent/create?app_key="
payload := strings.NewReader("{\n \"agent_name\": \"deploy-bot\",\n \"instructions\": \"Inspect deployment pipelines and propose rollbacks when a canary fails health checks.\",\n \"card_url\": \"https://agents.example.com/deploy-bot/card\",\n \"auth_type\": \"bearer\",\n \"auth_config\": {\n \"token\": \"sk-agent-token-example-9f2c\"\n },\n \"streaming\": true,\n \"team_id\": 0,\n \"environments\": [\n \"env_8s7Hn2kLpQ3xYbVc4Wd2m\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/safari/a2a-agent/create?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"agent_name\": \"deploy-bot\",\n \"instructions\": \"Inspect deployment pipelines and propose rollbacks when a canary fails health checks.\",\n \"card_url\": \"https://agents.example.com/deploy-bot/card\",\n \"auth_type\": \"bearer\",\n \"auth_config\": {\n \"token\": \"sk-agent-token-example-9f2c\"\n },\n \"streaming\": true,\n \"team_id\": 0,\n \"environments\": [\n \"env_8s7Hn2kLpQ3xYbVc4Wd2m\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/a2a-agent/create?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_name\": \"deploy-bot\",\n \"instructions\": \"Inspect deployment pipelines and propose rollbacks when a canary fails health checks.\",\n \"card_url\": \"https://agents.example.com/deploy-bot/card\",\n \"auth_type\": \"bearer\",\n \"auth_config\": {\n \"token\": \"sk-agent-token-example-9f2c\"\n },\n \"streaming\": true,\n \"team_id\": 0,\n \"environments\": [\n \"env_8s7Hn2kLpQ3xYbVc4Wd2m\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"agent_id": "a2a_6mWqZ2pK9nLcR3tY8uVb4D"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 300 次/分钟;20 次/秒 |
| 权限要求 | Agent 管理(ai-sre) |
使用说明
instructions为必填:Markdown 文档,可带summaryfrontmatter,正文不能为空,最多 51,200 字节。已弃用的description字段仍可传入,若与instructions同时传入,两者必须完全一致。agent_name不能包含@,也不能是内置智能体保留的general/explore,且在其作用域(账户级或单个团队)内必须唯一;违反时返回InvalidParameter。card_url必须是带 host 的绝对http/httpsURL。若该智能体有在线的执行环境,服务端会通过该环境拉取智能体卡片(card_url不带路径时自动补/.well-known/agent-card.json),卡片不是合法 JSON、或未声明协议绑定为JSONRPC/HTTP+JSON的 A2A 1.x 接口时拒绝;卡片不可达、返回非 2xx 或没有在线环境时不阻断调用。auth_type=bearer时以Authorization: Bearer <token>发送auth_config.token;auth_type=api_key时把auth_config.api_key放进auth_config.header指定名称的请求头;为none或空值时不发送共享凭据请求头。environments的每一项必须是cloud,或某个账户级 BYOC Runner、调用者所属团队的 BYOC Runner 的环境 ID;重复项会被去除,空字符串会被拒绝。省略或为空表示所有环境。- 创建到团队(
team_id > 0)要求调用者属于该团队;只有账户 owner 或管理员可以在账户级(team_id=0)创建。 - 新建的智能体
status为enabled。 - 每次调用都会记录到账户审计日志。
授权
请求体
application/json
新建 A2A 智能体的注册参数。
凭据由谁提供:
shared(默认,空值等同):使用保存在智能体上的一份凭据(auth_type+auth_config),所有调用者共用。per_user_secret:每位用户各自保存密钥,放在secret_schema.header_name指定的请求头中发送。per_user_oauth:每位用户各自完成 OAuth 授权,首次使用时完成发现与客户端注册。
per_user_secret 要求 secret_schema 带非空的 header_name;其他取值返回 InvalidParameter。
可用选项:
shared, per_user_secret, per_user_oauth 响应
成功
所有 Flashduty 公开 API 共用的标准响应结构。成功时 data 为接口专属载荷且不含 error;失败时 error 存在而 data 缺失。request_id 始终存在,并会同步写入 Flashcat-Request-Id 响应头。
此页面对您有帮助吗?