curl --request POST \
--url https://api.kordio.io/control/v1/agent/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"budget_cents": 50000,
"currency": "USD",
"parent_budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.kordio.io/control/v1/agent/budgets"
payload = {
"budget_cents": 50000,
"currency": "USD",
"parent_budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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({
budget_cents: 50000,
currency: 'USD',
parent_budget_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.kordio.io/control/v1/agent/budgets', 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.kordio.io/control/v1/agent/budgets",
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([
'budget_cents' => 50000,
'currency' => 'USD',
'parent_budget_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.kordio.io/control/v1/agent/budgets"
payload := strings.NewReader("{\n \"budget_cents\": 50000,\n \"currency\": \"USD\",\n \"parent_budget_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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.kordio.io/control/v1/agent/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budget_cents\": 50000,\n \"currency\": \"USD\",\n \"parent_budget_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/control/v1/agent/budgets")
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 \"budget_cents\": 50000,\n \"currency\": \"USD\",\n \"parent_budget_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"budget_cents": 123,
"spent_cents": 123,
"remaining_cents": 123,
"currency": "<string>",
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "Agent key is required",
"code": "runtime_key_required"
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}A budget is the budget envelope for one agent run. Every authorized action commits against it, and it is what a runaway loop runs into.
Budget is claimed with a single conditional update rather than a lock, so parallel sub-agents under one agent contend at the row instead of queueing.
curl --request POST \
--url https://api.kordio.io/control/v1/agent/budgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"budget_cents": 50000,
"currency": "USD",
"parent_budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.kordio.io/control/v1/agent/budgets"
payload = {
"budget_cents": 50000,
"currency": "USD",
"parent_budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
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({
budget_cents: 50000,
currency: 'USD',
parent_budget_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
})
};
fetch('https://api.kordio.io/control/v1/agent/budgets', 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.kordio.io/control/v1/agent/budgets",
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([
'budget_cents' => 50000,
'currency' => 'USD',
'parent_budget_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
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.kordio.io/control/v1/agent/budgets"
payload := strings.NewReader("{\n \"budget_cents\": 50000,\n \"currency\": \"USD\",\n \"parent_budget_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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.kordio.io/control/v1/agent/budgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"budget_cents\": 50000,\n \"currency\": \"USD\",\n \"parent_budget_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kordio.io/control/v1/agent/budgets")
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 \"budget_cents\": 50000,\n \"currency\": \"USD\",\n \"parent_budget_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_budget_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"budget_cents": 123,
"spent_cents": 123,
"remaining_cents": 123,
"currency": "<string>",
"status": "active",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "Agent key is required",
"code": "runtime_key_required"
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}{
"error": {
"message": "<string>",
"code": "runtime_key_required"
}
}Authorizations
An agent API key, krt_live_... or krt_test_..., shown exactly once at creation. Kordio stores only a digest. This credential can ask for authorization and can never write policy.
Body
The ceiling for this run, in minor units. Refused with budget_ceiling if it exceeds the agent's max_budget_cents, and with parent_budget_exhausted if a parent is named and has less than this left.
x >= 150000
"USD"
Delegates from an existing session belonging to the same agent.
Response
The open session.
Show child attributes
Show child attributes