-
Notifications
You must be signed in to change notification settings - Fork 81
docs: add agent budget enforcement gates #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
catcherintheroad-hub
wants to merge
1
commit into
UnitOneAI:main
Choose a base branch
from
catcherintheroad-hub:improve/agent-budget-enforcement-evidence
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+146
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
skills/ai-security/agent-security/tests/budget-enforcement-edge-cases.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Budget Enforcement Edge Cases | ||
|
|
||
| These fixtures validate agent architecture review behavior for resource budget, quota, and denial-of-wallet controls. | ||
|
|
||
| ## Case 1: Per-Request Limit Without Cumulative Session Budget | ||
|
|
||
| ```yaml | ||
| agent: | ||
| max_tokens_per_request: 8000 | ||
| request_timeout_seconds: 120 | ||
| max_requests_per_minute: 100 | ||
| session: | ||
| max_steps: null | ||
| max_total_tokens: null | ||
| max_total_tool_calls: null | ||
| ``` | ||
|
|
||
| **Expected result:** High severity finding. | ||
|
|
||
| **Reason:** Each individual request is bounded, but an autonomous workflow can continue indefinitely and consume unbounded cumulative resources. | ||
|
|
||
| ## Case 2: Retries and Fallback Provider Bypass Metering | ||
|
|
||
| ```yaml | ||
| llm: | ||
| primary: provider-a | ||
| fallback: provider-b | ||
| budget: | ||
| ledger: provider-a-only | ||
| retry: | ||
| max_retries: 5 | ||
| backoff: exponential | ||
| count_retry_costs: false | ||
| count_fallback_costs: false | ||
| ``` | ||
|
|
||
| **Expected result:** High severity finding. | ||
|
|
||
| **Reason:** Timeout retries and fallback calls can consume spend outside the enforced budget ledger. | ||
|
|
||
| ## Case 3: Sub-Agent Fan-Out Gets Fresh Budgets | ||
|
|
||
| ```yaml | ||
| orchestrator: | ||
| max_child_agents: 20 | ||
| parent_budget_usd: 10 | ||
| child_agent: | ||
| budget_policy: fresh_default_budget | ||
| max_budget_usd: 10 | ||
| inherits_parent_budget: false | ||
| ``` | ||
|
|
||
| **Expected result:** High severity finding. | ||
|
|
||
| **Reason:** Delegation multiplies the effective budget and bypasses the parent's intended containment. | ||
|
|
||
| ## Case 4: Shared Budget Ledger With Fail-Closed Enforcement | ||
|
|
||
| ```yaml | ||
| budget_enforcement: | ||
| scopes: | ||
| - tenant | ||
| - user | ||
| - session | ||
| - agent_identity | ||
| - tool | ||
| ledger: | ||
| includes: | ||
| - llm_tokens | ||
| - browser_minutes | ||
| - code_execution_seconds | ||
| - external_api_calls | ||
| - storage_writes | ||
| - retries | ||
| - fallback_provider_calls | ||
| - child_agents | ||
| enforcement_point: before_tool_execution | ||
| quota_service_unavailable: fail_closed | ||
| alerts: | ||
| - threshold: 70 | ||
| action: notify_owner | ||
| - threshold: 90 | ||
| action: require_approval | ||
| - threshold: 100 | ||
| action: halt_workflow | ||
| kill_switch: | ||
| owner: security-operations | ||
| scope: tenant_or_global | ||
| ``` | ||
|
|
||
| **Expected result:** Pass for budget enforcement if implementation evidence confirms each enforcement point. | ||
|
|
||
| **Reason:** The controls cover cumulative workflow cost, tool costs, retries, fallback providers, sub-agent fan-out, fail mode, and operational response. | ||
|
|
||
| ## Review Assertions | ||
|
|
||
| - Do not credit request-level `max_tokens` as session-level containment. | ||
| - Confirm retries and provider fallbacks consume the same budget ledger. | ||
| - Confirm child agents inherit or reserve from the parent budget. | ||
| - Confirm quota service failures halt execution or degrade to a safe read-only mode. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Step 2A produces a budget-related finding, reports that follow this template have no matching
Review Areavalue in the Findings section above, even though this new summary row now treats Budget Enforcement as a first-class area. This makes the generated assessment internally inconsistent for the new high-severity cases; please addBudget Enforcementto the FindingReview Areaoptions as well.Useful? React with 👍 / 👎.