curl --request POST \
--url https://api.outerlayer.ai/v1/work-items/build \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Outerlayer-App-Id: <api-key>' \
--data '
{
"agent": "<string>",
"attestor": "<string>",
"continueSession": true,
"fresh": true,
"instructions": "<string>",
"model": "<string>",
"note": "<string>",
"runner": "managed",
"sessionId": "<string>",
"subject": {
"key": "<string>",
"number": 1,
"repository": "<string>",
"url": "<string>"
},
"workItemId": "<string>"
}
'import requests
url = "https://api.outerlayer.ai/v1/work-items/build"
payload = {
"agent": "<string>",
"attestor": "<string>",
"continueSession": True,
"fresh": True,
"instructions": "<string>",
"model": "<string>",
"note": "<string>",
"runner": "managed",
"sessionId": "<string>",
"subject": {
"key": "<string>",
"number": 1,
"repository": "<string>",
"url": "<string>"
},
"workItemId": "<string>"
}
headers = {
"X-Outerlayer-App-Id": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Outerlayer-App-Id': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
agent: '<string>',
attestor: '<string>',
continueSession: true,
fresh: true,
instructions: '<string>',
model: '<string>',
note: '<string>',
runner: 'managed',
sessionId: '<string>',
subject: {key: '<string>', number: 1, repository: '<string>', url: '<string>'},
workItemId: '<string>'
})
};
fetch('https://api.outerlayer.ai/v1/work-items/build', 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.outerlayer.ai/v1/work-items/build",
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' => '<string>',
'attestor' => '<string>',
'continueSession' => true,
'fresh' => true,
'instructions' => '<string>',
'model' => '<string>',
'note' => '<string>',
'runner' => 'managed',
'sessionId' => '<string>',
'subject' => [
'key' => '<string>',
'number' => 1,
'repository' => '<string>',
'url' => '<string>'
],
'workItemId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Outerlayer-App-Id: <api-key>"
],
]);
$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.outerlayer.ai/v1/work-items/build"
payload := strings.NewReader("{\n \"agent\": \"<string>\",\n \"attestor\": \"<string>\",\n \"continueSession\": true,\n \"fresh\": true,\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"note\": \"<string>\",\n \"runner\": \"managed\",\n \"sessionId\": \"<string>\",\n \"subject\": {\n \"key\": \"<string>\",\n \"number\": 1,\n \"repository\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"workItemId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Outerlayer-App-Id", "<api-key>")
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.outerlayer.ai/v1/work-items/build")
.header("X-Outerlayer-App-Id", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"<string>\",\n \"attestor\": \"<string>\",\n \"continueSession\": true,\n \"fresh\": true,\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"note\": \"<string>\",\n \"runner\": \"managed\",\n \"sessionId\": \"<string>\",\n \"subject\": {\n \"key\": \"<string>\",\n \"number\": 1,\n \"repository\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"workItemId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.outerlayer.ai/v1/work-items/build")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Outerlayer-App-Id"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": \"<string>\",\n \"attestor\": \"<string>\",\n \"continueSession\": true,\n \"fresh\": true,\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"note\": \"<string>\",\n \"runner\": \"managed\",\n \"sessionId\": \"<string>\",\n \"subject\": {\n \"key\": \"<string>\",\n \"number\": 1,\n \"repository\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"workItemId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attestor": "<string>",
"number": 123,
"requestedAt": "<string>",
"runner": "managed",
"section": "<string>",
"stage": "<string>",
"workItemId": "<string>",
"agent": "<string>",
"children": {
"held": 123,
"items": [
{
"number": 123,
"outcome": "queued",
"reason": "<string>",
"waitsOn": [
123
]
}
],
"queued": 123,
"skipped": 123
},
"continueSession": true,
"fresh": true,
"model": "<string>",
"repositoryTokens": {
"earnable": false,
"message": "<string>",
"reason": "key_has_no_member"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Request a host build an item
Records a build-requested attestation naming who asked and when — the fact claim_work_item and the queue listings read to decide whether a host may pick the item up. With no open pull request it feeds the implement queue; with an open pull request whose general thread waits on an agent it feeds the amend queue as a new trigger. An open pull request with no review waiting on an agent is refused as nothing_to_rerun, and nothing is stored. A closed item (its issue is closed, or it is shipped or dropped) is refused as work_item_closed, and nothing is stored: no agent works on a closed item. A draft (an item with no issue yet) is refused as work_item_draft, and nothing is stored. Adds the item to Work first (admitting it, the same as POST /v1/work-items) when subject names one not already there; workItemId addresses an item that must already exist. Never links the calling session and never takes a lease, even when called from inside one — POST /v1/work-items alone never queues an item for a host, and this route is the only thing that does. A request from a key with no member recorded on it, or from a key that holds work.claim, is accepted, and the response carries repositoryTokens with earnable: false and the reason: a container host takes repository tokens only for a build a member asked for, so it will fail that build, while a host that runs builds with its own hooks can still take it. The optional instructions (at most 2000 characters) are guidance for the agent that runs the build: control characters other than newline and tab are removed, the text is trimmed, and text with nothing left is stored as null. They belong to this request alone and are returned as instructions on its buildRequests entry. The optional continueSession (true) asks the build to continue the agent session of the item’s previous build, where the runner keeps one: the claim that answers the request then carries continueSession, and a runner with no session to continue starts a new one. It is refused with a 400 together with fresh. A session belongs to the agent that started it. When the item’s newest build or agent job recorded the agent it ran with, and the agent of this build differs from it, the request is refused as session_agent_mismatch, and nothing is stored. The agent of this build is the request’s, else the repository config’s or the previous request’s, else on managed runners the factory’s Default agent. A job that recorded no agent ran with a self-hosted runner’s own agent and is not compared. The optional fresh (true) asks the build to start from a fresh disk: the runner then restores no disk that the item’s previous job left on its machine, and the response echoes fresh when the request recorded it. A request with fresh on an item whose open pull request feeds the amend queue is refused as fresh_disk_unavailable, and nothing is stored: an agent job has no fresh-disk choice. A request from a member who holds a live personal runner key in the factory asks for a self-hosted runner, and only that member’s personal runner takes it. Otherwise the factory’s “Builds run on” setting decides the kind of runner that takes the build. The optional runner (managed) builds the item on a managed runner, also when the requester has a personal runner. It moves a build of the requester’s own that waits. It is refused with a 400, and nothing is stored, unless the factory’s builds run on managed runners (managed_runners_off) and the caller is a member (runner_choice_not_requester). It is refused as runner_choice_not_requester too while another member’s build of the item waits, and for an open pull request whose newest build another member asked for. Any other runner is refused as invalid_request_body. A request in a factory whose builds run on managed runners is refused, and nothing is stored, when the factory stores no key for the model provider of the build’s agent (managed_credential_missing), or when managed runners do not build with the build’s agent (agent_not_managed). A repository names no agent when it has no .outerlayer/config.json, or when GitHub answers 403 with no sign of a rate limit, so the GitHub App may not read the file. When the file cannot be read for a reason a retry can heal (a rate limit, a 5xx, a network error, or no answer within 10 seconds), the request is refused with a 503 repository_config_unreadable, nothing is stored, and the same request can be sent again. A file larger than 65536 bytes is refused as repository_config_invalid. The answer carries the runner the request asks for.
curl --request POST \
--url https://api.outerlayer.ai/v1/work-items/build \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Outerlayer-App-Id: <api-key>' \
--data '
{
"agent": "<string>",
"attestor": "<string>",
"continueSession": true,
"fresh": true,
"instructions": "<string>",
"model": "<string>",
"note": "<string>",
"runner": "managed",
"sessionId": "<string>",
"subject": {
"key": "<string>",
"number": 1,
"repository": "<string>",
"url": "<string>"
},
"workItemId": "<string>"
}
'import requests
url = "https://api.outerlayer.ai/v1/work-items/build"
payload = {
"agent": "<string>",
"attestor": "<string>",
"continueSession": True,
"fresh": True,
"instructions": "<string>",
"model": "<string>",
"note": "<string>",
"runner": "managed",
"sessionId": "<string>",
"subject": {
"key": "<string>",
"number": 1,
"repository": "<string>",
"url": "<string>"
},
"workItemId": "<string>"
}
headers = {
"X-Outerlayer-App-Id": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Outerlayer-App-Id': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
agent: '<string>',
attestor: '<string>',
continueSession: true,
fresh: true,
instructions: '<string>',
model: '<string>',
note: '<string>',
runner: 'managed',
sessionId: '<string>',
subject: {key: '<string>', number: 1, repository: '<string>', url: '<string>'},
workItemId: '<string>'
})
};
fetch('https://api.outerlayer.ai/v1/work-items/build', 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.outerlayer.ai/v1/work-items/build",
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' => '<string>',
'attestor' => '<string>',
'continueSession' => true,
'fresh' => true,
'instructions' => '<string>',
'model' => '<string>',
'note' => '<string>',
'runner' => 'managed',
'sessionId' => '<string>',
'subject' => [
'key' => '<string>',
'number' => 1,
'repository' => '<string>',
'url' => '<string>'
],
'workItemId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Outerlayer-App-Id: <api-key>"
],
]);
$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.outerlayer.ai/v1/work-items/build"
payload := strings.NewReader("{\n \"agent\": \"<string>\",\n \"attestor\": \"<string>\",\n \"continueSession\": true,\n \"fresh\": true,\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"note\": \"<string>\",\n \"runner\": \"managed\",\n \"sessionId\": \"<string>\",\n \"subject\": {\n \"key\": \"<string>\",\n \"number\": 1,\n \"repository\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"workItemId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Outerlayer-App-Id", "<api-key>")
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.outerlayer.ai/v1/work-items/build")
.header("X-Outerlayer-App-Id", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"<string>\",\n \"attestor\": \"<string>\",\n \"continueSession\": true,\n \"fresh\": true,\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"note\": \"<string>\",\n \"runner\": \"managed\",\n \"sessionId\": \"<string>\",\n \"subject\": {\n \"key\": \"<string>\",\n \"number\": 1,\n \"repository\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"workItemId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.outerlayer.ai/v1/work-items/build")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Outerlayer-App-Id"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": \"<string>\",\n \"attestor\": \"<string>\",\n \"continueSession\": true,\n \"fresh\": true,\n \"instructions\": \"<string>\",\n \"model\": \"<string>\",\n \"note\": \"<string>\",\n \"runner\": \"managed\",\n \"sessionId\": \"<string>\",\n \"subject\": {\n \"key\": \"<string>\",\n \"number\": 1,\n \"repository\": \"<string>\",\n \"url\": \"<string>\"\n },\n \"workItemId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"attestor": "<string>",
"number": 123,
"requestedAt": "<string>",
"runner": "managed",
"section": "<string>",
"stage": "<string>",
"workItemId": "<string>",
"agent": "<string>",
"children": {
"held": 123,
"items": [
{
"number": 123,
"outcome": "queued",
"reason": "<string>",
"waitsOn": [
123
]
}
],
"queued": 123,
"skipped": 123
},
"continueSession": true,
"fresh": true,
"model": "<string>",
"repositoryTokens": {
"earnable": false,
"message": "<string>",
"reason": "key_has_no_member"
}
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Body
The agent that builds the item. Leave it out for the agent key of the repository's .outerlayer/config.json. When the config names no agent, a request for an item already on Work carries the agent and the model of the item's previous request together, and only when that request named an agent. A previous request that named a model and no agent carries nothing. Otherwise the request records no agent: a self-hosted runner builds the item with its own default agent, and a fleet machine with the factory's default agent. A config that is not valid JSON, is larger than 65536 bytes, or names an agent no build can use, refuses the request with repository_config_invalid. A config that cannot be read for a reason a retry can heal, such as a rate limit or a 5xx, refuses it with repository_config_unreadable.
true asks the build to continue the agent session of the item's previous build, where the runner keeps one. Leave it out for the default, which starts a new session. Refused together with fresh, and refused as session_agent_mismatch when the build's agent differs from the agent the item's newest job ran with.
true managed builds the item on a managed runner, also when the requester has a personal runner. It moves a build of the requester's own that waits. Accepted only from a member, in a factory whose builds run on managed runners (else managed_runners_off). While another member's build of the item waits, or the item has an open pull request that another member asked for, it is refused as runner_choice_not_requester. Any other value is refused as invalid_request_body. Leave it out for the default.
managed