/\ ATFGraph /docs
README Downloads
HTTP API & schemas / ATFGraph
Framework reference

This article is retained from the existing framework docs. Self-hosting commands and server-admin access differ from the managed CLI workflow. Start with Get started for the installed product.

Budgets API

Operations grouped under this contract tag.

Operations

OperationMethodPath
listBudgetsGET/api/v2/budgets
createBudgetPOST/api/v2/budgets
budgetStatusGET/api/v2/budgets/status
getBudgetGET/api/v2/budgets/{id}
updateBudgetPATCH/api/v2/budgets/{id}
deleteBudgetDELETE/api/v2/budgets/{id}
budgetUsageGET/api/v2/budgets/{id}/usage

listBudgets

GET /api/v2/budgets

Requires: invoke role

Budgets visible to the caller (every budget of the namespace for admins, otherwise the caller's own), newest first, optionally filtered by scope. Definitions only; read budgetUsage or budgetStatus for consumption.

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.list_budgets()

Parameters

ParameterInRequiredType
scopequerynostring

Responses

StatusBodyMeaning
200BudgetListSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 200

{
  "items": [
    {
      "action": "string",
      "created_at": 0,
      "enabled": false,
      "id": "string",
      "limit": 0.0,
      "metric": "tokens",
      "name": "string",
      "principal": "string",
      "revision": 0,
      "scope": "string",
      "subject": "string",
      "updated_at": 0,
      "window": "string"
    }
  ]
}

createBudget

POST /api/v2/budgets

Requires: invoke role

Create an admission-time budget: one metric (tokens or cost_usd from usage receipts, or runs = admitted root executions) over a rolling window (1h, 24h, 7d, 30d) for one scope. subject is the principal, agent label or label.capability the scope binds and is absent for namespace. A deny budget (the default) refuses traversers.submit with 429 budget_exceeded once consumption in the window has reached the limit; a warn budget never blocks and only adds warnings to access decisions. Namespace budgets and budgets over another principal require admin; label and target budgets require owning the label. The creating principal owns the budget; admins see every budget in the namespace, other callers only their own. Namespaces hold at most 256 budgets (422 budgets_full).

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.create_budget()

Request body

BudgetCreate (required)

{
  "limit": 0.0,
  "metric": "tokens",
  "name": "string",
  "scope": "string",
  "window": "string"
}

Responses

StatusBodyMeaning
201BudgetSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 201

{
  "action": "string",
  "created_at": 0,
  "enabled": false,
  "id": "string",
  "limit": 0.0,
  "metric": "tokens",
  "name": "string",
  "principal": "string",
  "revision": 0,
  "scope": "string",
  "subject": "string",
  "updated_at": 0,
  "window": "string"
}

budgetStatus

GET /api/v2/budgets/status

Requires: invoke role

Every enabled budget that would apply to an admission by principal (the caller unless an admin names another; 403 otherwise) of target (label.capability; without it only principal and namespace budgets apply), each with its headroom. allowed is false when a deny budget is exceeded, exactly as traversers.submit would refuse. Warn budgets are listed but never affect allowed.

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.budget_status()

Parameters

ParameterInRequiredType
principalquerynostring
targetquerynostring

Responses

StatusBodyMeaning
200BudgetStatusSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 200

{
  "allowed": false,
  "items": [
    {
      "action": "string",
      "as_of": 0,
      "budget_id": "string",
      "consumed": 0.0,
      "enabled": false,
      "exceeded": false,
      "limit": 0.0,
      "metric": "tokens",
      "name": "string",
      "remaining": 0.0,
      "scope": "string",
      "subject": "string",
      "window": "string",
      "window_start": 0
    }
  ],
  "principal": "string",
  "target": "string"
}

getBudget

GET /api/v2/budgets/{id}

Requires: invoke role

One budget definition. A budget owned by another principal is 404 budget_not_found rather than 403, the same answer as an unknown id.

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.get_budget()

Parameters

ParameterInRequiredType
idpathyesstring

Responses

StatusBodyMeaning
200BudgetSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 200

{
  "action": "string",
  "created_at": 0,
  "enabled": false,
  "id": "string",
  "limit": 0.0,
  "metric": "tokens",
  "name": "string",
  "principal": "string",
  "revision": 0,
  "scope": "string",
  "subject": "string",
  "updated_at": 0,
  "window": "string"
}

updateBudget

PATCH /api/v2/budgets/{id}

Requires: invoke role

Compare-and-set edit of name, window, limit, action and enabled. expected_revision must equal the current revision or the request fails with 409 revision_mismatch; scope, subject and metric are immutable and any other field is rejected (400 invalid_budget). Disabling a budget suspends enforcement without losing it.

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.update_budget()

Parameters

ParameterInRequiredType
idpathyesstring

Request body

BudgetUpdate (required)

{
  "expected_revision": 0
}

Responses

StatusBodyMeaning
200BudgetSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 200

{
  "action": "string",
  "created_at": 0,
  "enabled": false,
  "id": "string",
  "limit": 0.0,
  "metric": "tokens",
  "name": "string",
  "principal": "string",
  "revision": 0,
  "scope": "string",
  "subject": "string",
  "updated_at": 0,
  "window": "string"
}

deleteBudget

DELETE /api/v2/budgets/{id}

Requires: invoke role

Delete one budget. expected_revision travels as a query parameter and, when given, must match (409 revision_mismatch). Consumption records are the runtime's own and are untouched.

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.delete_budget()

Parameters

ParameterInRequiredType
idpathyesstring
expected_revisionquerynointeger

Responses

StatusBodyMeaning
200DeletedSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 200

{
  "deleted": false
}

budgetUsage

GET /api/v2/budgets/{id}/usage

Requires: invoke role

Consumption of one budget in its current rolling window, read from usage receipts (tokens, cost_usd) or admitted root traversers (runs), with the derived remaining headroom and whether the limit is reached. This is the same reading the admission path takes; nothing is cached.

Generated Python client internals: atfgraph._generated.api.budgets_api.BudgetsApi.budget_usage()

Parameters

ParameterInRequiredType
idpathyesstring

Responses

StatusBodyMeaning
200BudgetUsageSuccessful operation
400ErrorResponseStructured API error
401ErrorResponseMissing or invalid credentials
403ErrorResponseRole or ownership denied
404ErrorResponseResource unavailable to this identity
409ErrorResponseRevision, idempotency, immutable version or lease conflict
413ErrorResponseStructured API error
422ErrorResponseCapability input/output schema violation
429ErrorResponseCapacity exceeded
500ErrorResponseStructured API error
503ErrorResponseStructured API error

Example response 200

{
  "action": "string",
  "as_of": 0,
  "budget_id": "string",
  "consumed": 0.0,
  "enabled": false,
  "exceeded": false,
  "limit": 0.0,
  "metric": "tokens",
  "name": "string",
  "remaining": 0.0,
  "scope": "string",
  "subject": "string",
  "window": "string",
  "window_start": 0
}
ATFGraph documentationHosted workflow · Framework reference