AP2 icon indicating copy to clipboard operation
AP2 copied to clipboard

feat: cross-merchant budget enforcement sample

Open Ectsang opened this issue 7 months ago • 2 comments

Adds a sample demonstrating the cross-merchant budget enforcement gap from #207 and a solution using an external budget authority.

Part 1 shows the problem: two merchants evaluate BudgetEvaluator independently, each with its own MandateContext. The agent overspends ($120 on a $100 budget).

Part 2 shows the fix: an external authority with four verbs (authorize, commit, refund, query) based on the discussion in #207. The authorize call atomically checks and holds budget, preventing race conditions.

No external dependencies. Runs with python cross_merchant_budget.py.

Ectsang avatar May 01 '26 04:05 Ectsang

All gemini-code-assist feedback addressed in b547f68 (currency rounding, O(1) hold lookups, full UUIDs, dataclasses). Lint failure is pre-existing Biome, unrelated to this PR — other 3 checks green.

Per CONTRIBUTING.md, "contributions going forward are to the samples and sdk only" — this is a sample. @holtskinner anything blocking review from the team side?

Ectsang avatar May 11 '26 01:05 Ectsang

@Ectsang quick heads up: before merging aeoess/agent-governance-vocabulary#91, we renamed the namespace from budget_authority to budget_reservation.

Reason: avoiding overlap with APS's delegation-authority layer. The verb set is about spend control and reservations, not general agent authority.

The six verbs and decision shape are unchanged.

The reserve row is currently staying at proposed until the goodmeta authorize → reserve mapping is confirmed, either through your LGTM on PR#91 or through AP2#252 landing.

No deadline. Just wanted to keep the terminology change visible here.

aeoess avatar May 12 '26 18:05 aeoess