Skip to content

Token Budget / Cap for Agentic Tool Call Loops #958

@ntentes

Description

@ntentes

Describe the problem
When running unsupervised/scheduled agentic workflows that involve tool calls, there is currently no built-in way to enforce an upper token limit on the full multi-turn loop. Without this, a runaway loop can consume far more tokens than intended with no mechanism to stop it gracefully.

Desired behavior
It would be useful to have a supported way to:

  1. Set a hard token budget for the entire tool call loop, causing it to stop (and error/fail gracefully) if the limit is exceeded.
  2. Optionally inject a system-level message (e.g. "You are approaching your token limit — wrap up your response now") once a soft threshold is reached, giving the model a chance to return a partial result rather than hard-stopping.

Use case
Unsupervised scheduled reports with tool access, where cost/token control is a requirement to prevent silent runaway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions