curl --request POST \
--url https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requestIdempotencyKey": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"instructions": "<string>",
"modelId": "<string>",
"targetPage": "<string>"
}
'import requests
url = "https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs"
payload = {
"requestIdempotencyKey": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"instructions": "<string>",
"modelId": "<string>",
"targetPage": "<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({
requestIdempotencyKey: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
instructions: '<string>',
modelId: '<string>',
targetPage: '<string>'
})
};
fetch('https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs', 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://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs",
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([
'requestIdempotencyKey' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'instructions' => '<string>',
'modelId' => '<string>',
'targetPage' => '<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://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs"
payload := strings.NewReader("{\n \"requestIdempotencyKey\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"instructions\": \"<string>\",\n \"modelId\": \"<string>\",\n \"targetPage\": \"<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://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requestIdempotencyKey\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"instructions\": \"<string>\",\n \"modelId\": \"<string>\",\n \"targetPage\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs")
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 \"requestIdempotencyKey\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"instructions\": \"<string>\",\n \"modelId\": \"<string>\",\n \"targetPage\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attribution": {
"actorType": "key_minting_user",
"apiKeyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdByUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "api_key"
},
"status": "already_queued",
"taskId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflowId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}Trigger a managed-agent run
Queues a manual run of the agent, which spends managed-agent credits. Repeating the request with the same requestIdempotencyKey returns that run as it stands, including a blocked or failed outcome, unless it is still queued without a credit reservation; only then is the retry checked like a new request, and it can be refused. A project with nothing this agent can read is refused with 422 before any credits are spent. An agent that briefs one page (citability-editor) takes an optional targetPage, an absolute URL or a path on a tracked domain; the run briefs that page and no other, and ignores pages the instructions name. A targetPage is refused before any credits are spent, with error target_page_refused and a reason: 400 agent_takes_no_target_page, target_page_unavailable (target pages are turned off for agent runs) or target_page_invalid; 422 target_page_unowned, target_page_not_found (not an active page in the latest crawl), target_page_ambiguous (a path crawled on more than one tracked domain) or target_page_ineligible (neither a failing factor in its current Citability score nor findings from a section review, a path another crawled page on the same host shares, a page the customer locked, a removal candidate, or a page that already has a brief on an open action). A retry with the same requestIdempotencyKey and another targetPage is a 409. An archived custom agent is refused with 409 and reason agent_archived until it is restored. The run is started as the member who created the API key or authorized the OAuth connection; it is refused with 403 unless that member belongs to the project and holds the manage permission. This endpoint has a stricter rate limit than read endpoints. Requires the agents.run scope.
curl --request POST \
--url https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requestIdempotencyKey": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"instructions": "<string>",
"modelId": "<string>",
"targetPage": "<string>"
}
'import requests
url = "https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs"
payload = {
"requestIdempotencyKey": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"instructions": "<string>",
"modelId": "<string>",
"targetPage": "<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({
requestIdempotencyKey: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
instructions: '<string>',
modelId: '<string>',
targetPage: '<string>'
})
};
fetch('https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs', 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://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs",
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([
'requestIdempotencyKey' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'instructions' => '<string>',
'modelId' => '<string>',
'targetPage' => '<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://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs"
payload := strings.NewReader("{\n \"requestIdempotencyKey\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"instructions\": \"<string>\",\n \"modelId\": \"<string>\",\n \"targetPage\": \"<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://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requestIdempotencyKey\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"instructions\": \"<string>\",\n \"modelId\": \"<string>\",\n \"targetPage\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devtune.ai/api/v2/projects/{projectId}/agents/{agentKey}/runs")
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 \"requestIdempotencyKey\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"instructions\": \"<string>\",\n \"modelId\": \"<string>\",\n \"targetPage\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attribution": {
"actorType": "key_minting_user",
"apiKeyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdByUserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"source": "api_key"
},
"status": "already_queued",
"taskId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workflowId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"meta": {
"timestamp": "2023-11-07T05:31:56Z",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}{
"error": "<string>",
"message": "<string>",
"status": 123,
"reason": "<string>",
"details": {
"retryable": true,
"retryAfterSeconds": 2
}
}