代理
发送后续消息
向现有代理任务发送后续消息。该消息将异步处理——请轮询 get job 端点以跟踪进度。
POST
/
v2
/
agent
/
{projectId}
/
job
/
{id}
/
message
发送后续消息
curl --request POST \
--url https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>"
}
'import requests
url = "https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message"
payload = { "prompt": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>'})
};
fetch('https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message', 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}/message",
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([
'prompt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.mintlify.com/v2/agent/{projectId}/job/{id}/message"
payload := strings.NewReader("{\n \"prompt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.mintlify.com/v2/agent/{projectId}/job/{id}/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"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>"
}{
"error": "<string>"
}{
"error": "<string>"
}向现有代理任务发送后续指令。该消息会异步处理——请轮询 获取代理任务 端点以跟踪进度。
速率限制
- 每个 Mintlify 项目每小时最多可使用 100 次
用法
curl -X POST https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message \
-H "Authorization: Bearer mint_xxxxx" \
-H "Content-Type: application/json" \
-d '{"prompt": "Also add error handling examples to the quickstart guide"}'
授权
Authorization 头部需要 Bearer 令牌。请使用以 mint_ 为前缀的管理员 API 密钥。这是服务端使用的机密凭证。你可以在控制台的 API keys 页面 中生成一个。
请求体
application/json
发送给代理的后续指令。
Minimum string length:
1响应
消息发送成功
代理任务的唯一标识符。
作业的当前状态。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 POST \
--url https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>"
}
'import requests
url = "https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message"
payload = { "prompt": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({prompt: '<string>'})
};
fetch('https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message', 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}/message",
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([
'prompt' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.mintlify.com/v2/agent/{projectId}/job/{id}/message"
payload := strings.NewReader("{\n \"prompt\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.mintlify.com/v2/agent/{projectId}/job/{id}/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v2/agent/{projectId}/job/{id}/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"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>"
}{
"error": "<string>"
}{
"error": "<string>"
}