Add maxTokenBudget with automatic abort

Author: ibrahimkzmvCreated Apr 5, 2026Updated Sep 16, 2026

Issue:

  • There is currently no mechanism to enforce a budget or abort when spending exceeds a threshold.
  • A single agent stuck in a tool loop can consume thousands of tokens per turn.
  • Users running against paid APIs (e.g., Anthropic, OpenAI) have no safeguards against runaway costs.
  • Implementing token budget enforcement would be high-value and low-effort.

Proposed implementation:

  • Allow passing a max_token_budget configuration value.

Source: TauricResearch/TradingAgents