Skip to content

feat(agents): weekly spending limits for agents - #7904

Open
benjaminshafii wants to merge 1 commit into
feat/agent-connector-changesfrom
feat/agent-weekly-budgets
Open

benjaminshafii wants to merge 1 commit into
feat/agent-connector-changesfrom
feat/agent-weekly-budgets

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

What is this about?

An admin can cap what an agent may spend in a week, for one agent or for every agent in the organization. Off by default behind agentWeeklyBudgets.

What problem does it solve?

An agent had a monthly limit only, so a runaway routine could use the whole month's money in a few days before anyone noticed.

What was the situation before?

Before After
Limits on an agent Monthly Monthly and weekly; the lower of the agent's and the organization's weekly limit applies
Agent at its weekly limit n/a Starts no new routine runs until the next week
Both limits reached Monthly message Monthly message wins

How is this implemented?

  • Migration 0233_personal_agent_weekly_budgets: weekly_budget_micros on the organization's agent policy and admin_weekly_budget_micros on the agent.
  • PUT /v1/org/personal-agents/:id/budget and PUT /v1/org/personal-agent-policy take an optional weeklyBudgetMicros. Reads gain weekMicros, weeklyBudgetMicros and overWeeklyBudget when the flag is on.
  • personal-agents/run-admission.ts and spend.ts refuse a run over the weekly limit with "This agent reached its budget for the week, so it did not run."
  • A week is Monday 05:00 UTC to the next Monday 05:00 UTC, the same week spending limits for people use.
  • openwork agents budget <agent> <usd|none> --per week, and agents budget --all.
  • Flag and doc: packages/features/src/flags/agent-weekly-budgets.ts, docs/features/agent-weekly-budgets/README.md.

What else changed?

Release note

none

Evidence

  • No E2E spec: API and CLI only. personal-agent-weekly-budgets.api.test.ts (5 tests against MySQL) and the CLI tests.
  • Known limits: only routine runs count, chat with an agent does not (true of the monthly limit too); with the flag off a stored weekly limit is kept and ignored.
  • Not built: a Den page.

@vercel

vercel Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Dec 1, 2026 3:18am UTC
openwork-den Ready Ready Preview Dec 1, 2026 3:18am UTC
openwork-landing Ready Ready Preview, v0 Dec 1, 2026 3:18am UTC

Request Review

This branch was successfully deployed

3 active deployments
Preview – openwork-landing — d1153546 Deployed Dec 1, 2026 by vercel[bot]
Preview – openwork-den — d1153546 Deployed Dec 1, 2026 by vercel[bot]
Preview – openwork-app — d1153546 Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant