Skip to content

Budget per role

A role spends tokens every time it works. The budget is a monthly cap, in tokens, set per role and —optionally— per department. It is not money: the system does not convert tokens to euros anywhere.

Input tokens plus output tokens from the current month’s runs. They are read from the agno.agno_runs table, which is where Agno stores every turn:

Data Where it comes from
Runs Number of agno_runs rows for the role in the month.
Input tokens Sum of run_data->'metrics'->>'input_tokens'.
Output tokens Sum of run_data->'metrics'->>'output_tokens'.
Total Input plus output. This is what gets compared with the cap.
Period Calendar month (YYYY-MM).

PostgreSQL makes the month cut with date_trunc('month', now()), so it starts on day 1 at 00:00 in the container’s time zone (TZ, Europe/Madrid by default). There is nothing to restart: the counter goes back to zero on its own.

Runs are attributed to the role by agent_id, which is the role’s code (finanzas, tecnologia…). The CEO has its own identifier, adrian, and has no cap: it does not appear in the roles table.

On the role’s page, field “Token budget per month”. You get there through Team or Org chart → the role’s page. The value is stored in organtia.puestos.presupuesto_tokens_mes.

Value What it means
0 (default) No cap. The role can work all month. Its spending is still counted.
Any positive integer Cap in tokens for the calendar month.

On save, the field only accepts digits: the interface strips anything else. The database rejects negatives, and the repository returns “the budget cannot be negative” or “the budget has to be a token count” if the value does not fit.

Under the field, the page explains it in one line: with a cap, “when it reaches the cap it stops taking assignments until you raise it or the month starts”; with no cap, “it can work all month. It is charged the same”.

The cap is checked when an assignment is delegated, before the role starts. If the month’s consumption is already equal to or above the limit, the delegation does not happen and the CEO receives:

no se puede delegar a «finanzas»: presupuesto agotado: 912.400 de 900.000 tokens en 2026-11.
El propietario debe ampliar el presupuesto del puesto.

With the same sentence, adapted, if it is the department that has run out.

Three consequences worth being clear about:

  • A turn is not cut halfway. An assignment that started with balance finishes; the cap is looked at before the next one starts.
  • Consumption keeps rising above the cap. There is no clipping: if an assignment goes over, the counter shows what was actually spent and the role is blocked for the next one.
  • The check lives on the delegation path. Turns that do not go through it —an open conversation with the role, a cron job— do not consult the budget. If you need a hard cut, you do not have one.

A department groups roles and can have its own monthly cap (organtia.departamentos.presupuesto_tokens_mes). It is a cap added to each role’s:

Field What it does
presupuesto_tokens_mes = 0 It limits nothing. Only each role’s cap applies.
presupuesto_tokens_mes > 0 It adds up the consumption of all its members and, on reaching it, blocks the whole team.

It is checked before the role’s: if the department is out of balance, nobody gets delegated to even when a particular role still has room. The message says so with the department’s name and asks for that budget to be raised.

It is set in the Departments view, when creating or editing one. The two departments that always exist —direccion and propiedad— are born with a cap of 0.

Three routes, all with immediate effect (no restart and no waiting for day 1):

  1. The role’s page: you change the number and save. This is the normal one when a role fell short.
  2. The Departments view: you change the team’s cap.
  3. Approving a request from the CEO: when management asks for more budget for a role, the request can be approved and the text is interpreted. If it says “raise the budget of the role Director Técnico to 1,200,000 tokens”, that number is set on that role.
Place What it shows
CLI, /consumo Table of all active roles: runs, tokens for the month and limit. It adds an adrian row with no limit.
CLI, /consumo <role> One row with role, month, runs, input, output and limit (or “no limit”).
Reply to a delegation consumo_mes with tokens, runs and the role’s cap.
Departments view Consumption bar per team. Green below 80 %, amber above, red when it is exhausted.

Numbers are shown with the Spanish thousands separator (a full stop), in the error messages too.

Table Field Type What happens if you change it
organtia.puestos presupuesto_tokens_mes bigint, >= 0 Changes the role’s cap for the current month. At 0, it stops limiting. To a value below what is already spent, the role stays blocked until the next month or until you raise it.
organtia.departamentos presupuesto_tokens_mes bigint, 0 by default Same, but over every member of the department. It is evaluated before the role’s.
agno.agno_runs run_data->'metrics' jsonb It is the consumption record; it is not touched by hand. If a turn is missing its metric, that turn does not count.

They are two different things, with different units:

Token budget Spending autonomy
What it limits How much a role can work How much money the CEO can commit
Unit Tokens Cents (limite_centimos)
Where it lives puestos and departamentos organtia.autonomia, faculty gasto
Who sets it The owner, on the page or in Departments The owner, granting the faculty by talking to the CEO; it is recorded in their words and can be revoked
What happens on reaching it No more work is delegated No spending above the cap is committed

Autonomy has five faculties: gasto, contratar, publicar, terceros and precios. Only gasto carries an amount. It is granted per scope (global or one project) and there is a single grant in force per scope and faculty.

  • There is no per-token rate and no estimate in euros: consumption is measured in tokens and nothing else.
  • There is no automatic warning as you approach the cap. The amber in Departments is the closest thing.
  • There is no daily or weekly budget: monthly only.
  • There is no history of previous caps: changing the number overwrites the value without saving the previous figure in any table. The audit records that the role was edited, by whom and when (oficina:puesto_editado), but not the old value or the new one.