Skip to content

feat: add BudgetPolicy rules for token/cost/tool-call limits #409

@imran-siddique

Description

@imran-siddique

Summary

PolicyEvaluator handles capability checks but not resource consumption limits. Consumers must implement token budgets, tool call limits, and dollar cost caps custom.

Proposal

Add built-in BudgetPolicy rules:

  • max_tokens_per_task: int (e.g., 8000)
  • max_tool_calls_per_task: int (e.g., 20)
  • max_cost_per_task: float (e.g., 0.50 USD)
  • max_cost_per_agent_per_day: float (e.g., 10.00 USD)
  • Accumulator that tracks consumption within a task/session
  • Automatic DENY when budget exceeded, with remaining_budget in response

Why This Matters

Resource consumption governance is table stakes for production agent deployments. LLM API costs can spiral without limits. Every consumer needs token/cost budgets — this shouldn't be reimplemented.

Real-World Evidence

ai-native-team daemon governance.py implements: token_budget (default 8000), max_tool_calls (default 20), per-agent cost tracking in reliability.py. All generic, all reimplemented from scratch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions