FruxonDocs
AgentsBudget

Creates or updates the budget configuration for an agent

Upserts a single cap in place, identified by (origin, environment, period) — the same call creates the cap if none exists or replaces the existing one. The window is taken from `period` in the body (default `MONTHLY`); several caps on different windows can coexist on one bucket and all enforce together. Once a cap is set, the execution engine rejects new runs that would push that window's accumulated cost above it, and alert thresholds fire notifications as usage crosses them. The mandatory agent-wide daily, weekly, and monthly caps (on Production and Test) cannot be removed — set `enforceLimit: false` for a notify-only cap instead; optional caps can be removed via M:Fruxon.Server.Controllers.AgentBudgetController.Delete(System.String,Fruxon.Model.AgentSessions.ExecutionOrigin,System.String,Fruxon.Model.AgentBudgets.BudgetPeriod).

PUT
/v1/tenants/{tenant}/agents/{agent}/budget
AuthorizationBearer <token>

JWT Authorization header using the Bearer scheme. Enter 'Bearer' [space] and then your token.

In: header

Path Parameters

agent*string

The agent ID.

tenant*string

The tenant identifier

Query Parameters

origin?string

Which spend bucket this budget caps — default PRODUCTION; pass TEST for the developer test bucket.

Value in"UNSPECIFIED" | "PRODUCTION" | "TEST"
environment?string

Which environment this budget caps. Omitted (default) sets the agent-wide cap spanning all environments; a slug caps only that environment's spend (the environment is auto-created if needed). An execution must fit under every configured cap.

The budget configuration (amount, period, thresholds, enforce flag).

amount?number

Budget amount in USD.

Formatdouble
period?string

The billing window an Fruxon.Model.AgentBudgets.AgentBudget caps spend over. Windows are calendar-aligned in UTC: Fruxon.Model.AgentBudgets.BudgetPeriod.Daily is midnight to midnight, Fruxon.Model.AgentBudgets.BudgetPeriod.Weekly is the ISO week (Monday start), and Fruxon.Model.AgentBudgets.BudgetPeriod.Monthly is the first of the month. The accumulated cost resets when the agent's first execution crosses into a new window (lazy rollover keyed on Fruxon.Model.AgentBudgets.AgentBudget.CostPeriodStart). Wire and storage form is UPPER_SNAKE per project convention.

Value in"UNSPECIFIED" | "DAILY" | "WEEKLY" | "MONTHLY"
thresholdRules?|null

Threshold rules defining at which percentages notifications are sent. If null, existing thresholds are preserved on update.

enforceLimit?boolean|null

When true, execution is blocked when spend reaches 100% of the budget. When null on create, defaults to true (budgets enforce by default); set false for notify-only. On update, null preserves the existing value.

[key: string]?never

Response Body

curl -X PUT "https://api.fruxon.com/v1/tenants/string/agents/string/budget" \  -H "Content-Type: application/json" \  -d '{}'
{
  "agentId": "string",
  "origin": "PRODUCTION",
  "environment": "string",
  "amount": 0,
  "period": "DAILY",
  "thresholdRules": [
    {
      "percent": 0
    }
  ],
  "enforceLimit": false,
  "currentPeriodCost": 0,
  "usagePercent": 0,
  "periodStart": 0,
  "periodEnd": 0,
  "createdAt": 0,
  "modifiedAt": 0
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "property1": null,
  "property2": null
}
Empty
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "property1": null,
  "property2": null
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "property1": null,
  "property2": null
}