Skip to content

[BUG] Agent shows "Maximum tool execution iterations (15) reached" when actual issue is Max Output Tokens limit #2350

@epamLDadayan

Description

@epamLDadayan

Title: Agent shows "Maximum tool execution iterations (15) reached" when actual issue is Max Output Tokens limit

Description:
When an agent with an Anthropic LLM model stops execution due to reaching the Max Output Tokens limit (default 1024), it incorrectly displays "Maximum tool execution iterations (15) reached. Stopping tool execution," even though the agent's Step limit is set to 25. Increasing Max Output Tokens resolves the issue, indicating the error message is misleading.

Steps to reproduce:

  1. Create or open an agent.
  2. Add a toolkit that will be used during execution.
  3. Set an Anthropic LLM model (default Max Output Tokens: 1024).
  4. Execute the agent with a task that requires multiple tool calls or long responses.

Actual Result:
Execution stops with the message:
"Maximum tool execution iterations (15) reached. Stopping tool execution."
(Agent Step limit is 25, so this message is incorrect.)

Expected Result:
Display an accurate error message indicating the actual cause, e.g.:

  • "Max Output Tokens limit (1024) reached. Increase Max Output Tokens in model settings to continue."
  • Or a clear indication that the model's token budget was exhausted.

Notes (optional):

  • Workaround: Increase Max Output Tokens (e.g., to 4096) in model settings.
  • The issue is specific to Anthropic models with low Max Output Tokens.
  • Ensure error handling distinguishes between iteration/step limits and token limits, and surfaces the correct constraint to the user.

Metadata

Metadata

Assignees

Labels

AgentsTo group issues regarding Agents functionality

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions