Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| The Spend page says what a workspace spent, where it went and the budgets that hold it, in Workspace under Money: spent at price, agents' spend and the spend limit; by day; by agent, person, channel, model, kind of work and product; budgets from the workspace down to each person, agent and task, with what happens at 100%; the costliest tasks, each with a receipt of every session at the provider's price and what was charged; and how it's priced. Everyone sees what agents spent for them, and owners and billing managers the whole workspace; each person can have a monthly budget agents keep to, and the spend pill in the top bar shows your month or the workspace's against its limit. The spend guide says how. | 1 | -- Budgets per person (docs.g1t.sh/guides/agent-budgets/): what the agents |
| 2 | -- working for one person, the replies and sessions that person asked for, | |
| 3 | -- may spend together in a month. Budgets nest: the workspace's spend limit | |
| 4 | -- (billing), the workspace's agent budget, a person's, an agent's, a task's. | |
| 5 | ||
| 6 | -- The budget every person has unless they have their own. Null: none. | |
| 7 | ALTER TABLE agent_policies ADD COLUMN person_monthly_micros INTEGER; | |
| 8 | ||
| 9 | -- A person's own budget, set by an owner. 0: no budget at all, whatever | |
| 10 | -- the default. No row: the default. | |
| 11 | CREATE TABLE person_budgets ( | |
| 12 | workspace_id TEXT NOT NULL, | |
| 13 | username TEXT NOT NULL, | |
| 14 | monthly_micros INTEGER NOT NULL, | |
| 15 | updated_by TEXT NOT NULL, | |
| 16 | updated_at TEXT NOT NULL, | |
| 17 | PRIMARY KEY (workspace_id, username) | |
| 18 | ); | |
| 19 | ||
| 20 | -- What a person's agents spent is summed from the replies and sessions they | |
| 21 | -- asked for, so it counts from the first one, before any budget was set. | |
| 22 | CREATE INDEX agent_replies_asker ON agent_replies (workspace_id, asked_by_username, created_at); | |
| 23 | CREATE INDEX agent_sessions_asker ON agent_sessions (workspace_id, asked_by_username, created_at); |