代理
获取代理任务
检索代理作业的当前状态和详细信息。轮询此端点以跟踪作业进度。
GET
/
v2
/
agent
/
{projectId}
/
job
/
{id}
获取代理任务
curl --request GET \
--url https://api.mintlify.com/v2/agent/{projectId}/job/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v2/agent/{projectId}/job/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v2/agent/{projectId}/job/{id}', 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.mintlify.com/v2/agent/{projectId}/job/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.mintlify.com/v2/agent/{projectId}/job/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.mintlify.com/v2/agent/{projectId}/job/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v2/agent/{projectId}/job/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "active",
"source": {
"repository": "<string>",
"ref": "<string>"
},
"model": "<string>",
"prLink": "https://github.com/org/repo/pull/123",
"createdAt": "2023-11-07T05:31:56Z",
"archivedAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}轮询此端点以跟踪代理任务的进度。
status 字段会从 active 变为 completed 或 failed。
代理创建拉取请求 (PR;亦称“合并请求”/Merge Request) 后,prLink 字段会被填入。授权
Authorization 头部需要 Bearer 令牌。请使用以 mint_ 为前缀的管理员 API 密钥。这是服务端使用的机密凭证。你可以在控制台的 API keys 页面 中生成一个。
响应
代理任务详情
代理任务的唯一标识符。
作业的当前状态。active——代理当前正在处理提示词。completed——代理已成功完成,并且可能已创建 PR(请检查 prLink)。archived——作业已归档。failed——代理遇到了不可恢复的错误。请持续轮询,直到状态变为 completed、archived 或 failed。
可用选项:
active, completed, archived, failed 源存储库信息。
Show child attributes
Show child attributes
此作业使用的 AI 模型。
由代理创建的 GitHub 拉取请求(PR;亦称“合并请求”/Merge Request)URL。作业仍处于 active 状态或没有文件变更时,该值为 null。代理成功创建 PR 后,此字段会被填充。
示例:
"https://github.com/org/repo/pull/123"
作业创建时的时间戳。
作业归档时的时间戳。
此页面对您有帮助吗?
⌘I
获取代理任务
curl --request GET \
--url https://api.mintlify.com/v2/agent/{projectId}/job/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v2/agent/{projectId}/job/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v2/agent/{projectId}/job/{id}', 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.mintlify.com/v2/agent/{projectId}/job/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.mintlify.com/v2/agent/{projectId}/job/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.mintlify.com/v2/agent/{projectId}/job/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v2/agent/{projectId}/job/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "active",
"source": {
"repository": "<string>",
"ref": "<string>"
},
"model": "<string>",
"prLink": "https://github.com/org/repo/pull/123",
"createdAt": "2023-11-07T05:31:56Z",
"archivedAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}