Poll for the next lease
curl --request POST \
--url https://api.agentsfleet.net/v1/runners/me/leases \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.agentsfleet.net/v1/runners/me/leases"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.agentsfleet.net/v1/runners/me/leases', 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.agentsfleet.net/v1/runners/me/leases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.agentsfleet.net/v1/runners/me/leases"
req, _ := http.NewRequest("POST", 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.post("https://api.agentsfleet.net/v1/runners/me/leases")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentsfleet.net/v1/runners/me/leases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"lease": {
"event": {
"actor": "<string>",
"created_at": 123,
"event_id": "<string>",
"event_type": "chat",
"fleet_id": "<string>",
"request_json": "<string>",
"workspace_id": "<string>"
},
"fencing_token": 1,
"instructions": "<string>",
"lease_expires_at": 123,
"lease_id": "<string>",
"policy": {
"api_key": "<string>",
"context": {
"context_cap_tokens": 1,
"memory_checkpoint_every": 1,
"model": "<string>",
"stage_chunk_threshold": 123,
"tool_window": 1
},
"http_origin_policies": [
{
"credential_names": [
"<string>"
],
"host": "<string>",
"requests": [
{
"json_fields": [
{
"name": "<string>",
"boolean_value": true,
"string_value": "<string>"
}
],
"method": "get",
"path": "<string>",
"path_match": "exact"
}
]
}
],
"inference_host": "<string>",
"mintable": [
{
"integration": "<string>",
"name": "<string>"
}
],
"network_policy": {
"allow": [
"<string>"
],
"read_only": true,
"read_post_paths": [
"<string>"
]
},
"provider": "<string>",
"tools": [
"<string>"
],
"base_url": "<string>",
"repository_binding": {
"access": "read",
"base_branch": "<string>",
"repositories": [
"<string>"
]
},
"secrets_map": "<unknown>"
},
"secret_delivery": "inline",
"bundle": {
"content_hash": "<string>"
}
},
"retry_after_ms": 1
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}Runner plane
Poll for the next lease
The poll a runner lives on. Answers either a lease to run or a backoff to wait out. The claim, the money, the gates and the policy are all decided before the answer is written.
POST
/
v1
/
runners
/
me
/
leases
Poll for the next lease
curl --request POST \
--url https://api.agentsfleet.net/v1/runners/me/leases \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.agentsfleet.net/v1/runners/me/leases"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.agentsfleet.net/v1/runners/me/leases', 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.agentsfleet.net/v1/runners/me/leases",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.agentsfleet.net/v1/runners/me/leases"
req, _ := http.NewRequest("POST", 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.post("https://api.agentsfleet.net/v1/runners/me/leases")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.agentsfleet.net/v1/runners/me/leases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"lease": {
"event": {
"actor": "<string>",
"created_at": 123,
"event_id": "<string>",
"event_type": "chat",
"fleet_id": "<string>",
"request_json": "<string>",
"workspace_id": "<string>"
},
"fencing_token": 1,
"instructions": "<string>",
"lease_expires_at": 123,
"lease_id": "<string>",
"policy": {
"api_key": "<string>",
"context": {
"context_cap_tokens": 1,
"memory_checkpoint_every": 1,
"model": "<string>",
"stage_chunk_threshold": 123,
"tool_window": 1
},
"http_origin_policies": [
{
"credential_names": [
"<string>"
],
"host": "<string>",
"requests": [
{
"json_fields": [
{
"name": "<string>",
"boolean_value": true,
"string_value": "<string>"
}
],
"method": "get",
"path": "<string>",
"path_match": "exact"
}
]
}
],
"inference_host": "<string>",
"mintable": [
{
"integration": "<string>",
"name": "<string>"
}
],
"network_policy": {
"allow": [
"<string>"
],
"read_only": true,
"read_post_paths": [
"<string>"
]
},
"provider": "<string>",
"tools": [
"<string>"
],
"base_url": "<string>",
"repository_binding": {
"access": "read",
"base_branch": "<string>",
"repositories": [
"<string>"
]
},
"secrets_map": "<unknown>"
},
"secret_delivery": "inline",
"bundle": {
"content_hash": "<string>"
}
},
"retry_after_ms": 1
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}{
"detail": "<string>",
"docs_uri": "<string>",
"error_code": "<string>",
"request_id": "<string>",
"title": "<string>",
"action_id": "<string>",
"current_state": "<string>",
"etag": "<string>",
"gate_id": "<string>",
"missing_secrets": [
"<string>"
],
"outcome": "<string>",
"resolved_at": 123,
"resolved_by": "<string>",
"user_message": "<string>"
}Authorizations
The opaque agt_r token minted when the runner enrols (POST /v1/runners)
Response
A lease to run, or a backoff to wait out
POST /v1/runners/me/leases reply. Always 200.
lease is the work, or null with retry_after_ms set when there is none —
a backoff hint rather than a 204.