Agent Configuration

You can control the agent's behavior via the agent section in the anyllm.json file.

Managing Iterations

To prevent infinite loops and to control token consumption, especially during complex tasks, the agent has a limit on the number of consecutive steps (iterations) it can perform.

You can manage this limit using the max_iterations parameter.

{
  "provider": {
    "...": "..."
  },
  "agent": {
    "max_iterations": 25
  }
}
  • Parameter: agent.max_iterations
  • Default Value: 10 (if not specified).

If the agent reaches this limit, its operation will be paused with the message: Error: Agent reached maximum number of iterations (10)..

What to do in this case?

You have two options:

  1. Continue Execution: Simply type continue in the chat, and the agent will resume its work from where it left off for another N iterations.
  2. Increase the Limit: If you frequently work on complex tasks that require many steps, you can increase the max_iterations value in your anyllm.json to avoid frequent interruptions.