curl --request POST \
--url https://api.eddy.engineer/v1/agents.control \
--header 'Content-Type: application/json' \
--data '
{
"ceilings": {
"app_day_credits": 123,
"per_day_credits": 123,
"per_run_credits": 123
},
"defaults": {},
"expected_version": 123,
"lock": true
}
'import requests
url = "https://api.eddy.engineer/v1/agents.control"
payload = {
"ceilings": {
"app_day_credits": 123,
"per_day_credits": 123,
"per_run_credits": 123
},
"defaults": {},
"expected_version": 123,
"lock": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ceilings: {app_day_credits: 123, per_day_credits: 123, per_run_credits: 123},
defaults: {},
expected_version: 123,
lock: true
})
};
fetch('https://api.eddy.engineer/v1/agents.control', 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.eddy.engineer/v1/agents.control",
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([
'ceilings' => [
'app_day_credits' => 123,
'per_day_credits' => 123,
'per_run_credits' => 123
],
'defaults' => [
],
'expected_version' => 123,
'lock' => true
]),
CURLOPT_HTTPHEADER => [
"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.eddy.engineer/v1/agents.control"
payload := strings.NewReader("{\n \"ceilings\": {\n \"app_day_credits\": 123,\n \"per_day_credits\": 123,\n \"per_run_credits\": 123\n },\n \"defaults\": {},\n \"expected_version\": 123,\n \"lock\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.eddy.engineer/v1/agents.control")
.header("Content-Type", "application/json")
.body("{\n \"ceilings\": {\n \"app_day_credits\": 123,\n \"per_day_credits\": 123,\n \"per_run_credits\": 123\n },\n \"defaults\": {},\n \"expected_version\": 123,\n \"lock\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/agents.control")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"ceilings\": {\n \"app_day_credits\": 123,\n \"per_day_credits\": 123,\n \"per_run_credits\": 123\n },\n \"defaults\": {},\n \"expected_version\": 123,\n \"lock\": true\n}"
response = http.request(request)
puts response.read_body{
"agent": {
"can_pause": true,
"id": "<string>",
"org": "<string>",
"paused": {
"at_unix_ms": 123,
"by": "<string>",
"note": "<string>"
},
"policy": [
{
"agent": "<string>",
"effect": "<string>",
"effective": "allow",
"engine": "<string>",
"locked": true,
"org": "<string>",
"source": "agent"
}
]
},
"billing": "off",
"can_edit": true,
"ceilings": {
"per_day_credits": 123,
"per_run_credits": 123
},
"defaults": {},
"effects": [
{
"effect": "<string>",
"engine": "<string>",
"org": "<string>"
}
],
"lock": true,
"org": "<string>",
"paused": [
{
"agent": "<string>",
"at_unix_ms": 123,
"by": "<string>",
"name": "<string>",
"note": "<string>"
}
],
"stopped": {
"at_unix_ms": 123,
"by": "<string>",
"note": "<string>"
},
"today": {
"day": "<string>",
"held_credits": 123,
"left_credits": 123,
"running": 123,
"runs": 123,
"spent_credits": 123
},
"updated_at_unix_ms": 123,
"updated_by": "<string>",
"version": 123
}Set the org's ceilings and policy defaults (AS19)
An org admin sets the org’s ceilings on its agents (credits per run and per UTC day, above every agent’s own budget: a run’s budget and its credit hold are the lowest of the agent’s budget, the ceiling per run and what is left of the day; a start the day cannot cover is refused 402 CAP_REACHED) and its policy defaults per effect (allow / ask / deny for agents that leave an effect out; lock makes them a floor no agent goes under). null clears a ceiling or a default. Each change is on the org’s log. AS19.b: the apps’ ceilings for the day sit beside them (app_day_credits for every app, app:<id> for one app’s own): a billable call of an app whose day is spent is refused 402 CAP_REACHED (cap: app_day:<id>) until 00:00 UTC, under billing record and enforce; GET /v1/agents.control answers each app’s day as apps_today.
curl --request POST \
--url https://api.eddy.engineer/v1/agents.control \
--header 'Content-Type: application/json' \
--data '
{
"ceilings": {
"app_day_credits": 123,
"per_day_credits": 123,
"per_run_credits": 123
},
"defaults": {},
"expected_version": 123,
"lock": true
}
'import requests
url = "https://api.eddy.engineer/v1/agents.control"
payload = {
"ceilings": {
"app_day_credits": 123,
"per_day_credits": 123,
"per_run_credits": 123
},
"defaults": {},
"expected_version": 123,
"lock": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
ceilings: {app_day_credits: 123, per_day_credits: 123, per_run_credits: 123},
defaults: {},
expected_version: 123,
lock: true
})
};
fetch('https://api.eddy.engineer/v1/agents.control', 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.eddy.engineer/v1/agents.control",
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([
'ceilings' => [
'app_day_credits' => 123,
'per_day_credits' => 123,
'per_run_credits' => 123
],
'defaults' => [
],
'expected_version' => 123,
'lock' => true
]),
CURLOPT_HTTPHEADER => [
"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.eddy.engineer/v1/agents.control"
payload := strings.NewReader("{\n \"ceilings\": {\n \"app_day_credits\": 123,\n \"per_day_credits\": 123,\n \"per_run_credits\": 123\n },\n \"defaults\": {},\n \"expected_version\": 123,\n \"lock\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.eddy.engineer/v1/agents.control")
.header("Content-Type", "application/json")
.body("{\n \"ceilings\": {\n \"app_day_credits\": 123,\n \"per_day_credits\": 123,\n \"per_run_credits\": 123\n },\n \"defaults\": {},\n \"expected_version\": 123,\n \"lock\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/agents.control")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"ceilings\": {\n \"app_day_credits\": 123,\n \"per_day_credits\": 123,\n \"per_run_credits\": 123\n },\n \"defaults\": {},\n \"expected_version\": 123,\n \"lock\": true\n}"
response = http.request(request)
puts response.read_body{
"agent": {
"can_pause": true,
"id": "<string>",
"org": "<string>",
"paused": {
"at_unix_ms": 123,
"by": "<string>",
"note": "<string>"
},
"policy": [
{
"agent": "<string>",
"effect": "<string>",
"effective": "allow",
"engine": "<string>",
"locked": true,
"org": "<string>",
"source": "agent"
}
]
},
"billing": "off",
"can_edit": true,
"ceilings": {
"per_day_credits": 123,
"per_run_credits": 123
},
"defaults": {},
"effects": [
{
"effect": "<string>",
"engine": "<string>",
"org": "<string>"
}
],
"lock": true,
"org": "<string>",
"paused": [
{
"agent": "<string>",
"at_unix_ms": 123,
"by": "<string>",
"name": "<string>",
"note": "<string>"
}
],
"stopped": {
"at_unix_ms": 123,
"by": "<string>",
"note": "<string>"
},
"today": {
"day": "<string>",
"held_credits": 123,
"left_credits": 123,
"running": 123,
"runs": 123,
"spent_credits": 123
},
"updated_at_unix_ms": 123,
"updated_by": "<string>",
"version": 123
}Body
Response
The org's controls