Skip to content

maximumRemoteCalls does not limit repeated tool calls when using Agent Config with functionCallingConfig.mode: ANY #5665

@hapiiiiGit

Description

@hapiiiiGit

🔴 Required Information

Describe the Bug:
When using ADK’s Agent Config mode with Gemini function calling configured as mode: ANY, I expected automaticFunctionCalling.maximumRemoteCalls to limit the number of tool calls made during a task.
However, in my run, even though maximumRemoteCalls was set to 4, the agent repeatedly called the same tool far more than 4 times.

Steps to Reproduce:

  1. root_agent.yaml:
agent_class: LlmAgent

name: my_agent
model: gemini-2.5-pro
description: Agent for HumanEval-style Python code generation experiments.

instruction: |
  You are a Python coding assistant. Your task is to complete the following Python code from the HumanEval benchmark.  Use tools when they help, and give concise, evidence-aware answers.
tools:
  - name: my_agent_google.tools.submit_answer
  - name: my_agent_google.tools.python_executor
 generate_content_config:
  temperature: 0.0
  responseMimeType: text/plain
  toolConfig:
    functionCallingConfig:
      mode: ANY
  automaticFunctionCalling:
    disable: false
    maximumRemoteCalls: 4
    ignoreCallHistory: true
  1. input:
adk run my_agent
Please complete the code: from typing import List; def has_close_elements(numbers: List[float], threshold: float) -> bool: """Check if in given list of numbers, are any two numbers closer to each other than given threshold."""

Observed Behavior:
The agent called submit_answer once successfully.
But after that, the model continued calling submit_answer repeatedly. Each subsequent call returned:

{
  "ok": false,
  "error": "submit_answer has already been called",
  "system_directive": "submit_answer may only be called once and must be the final tool call. Do not call submit_answer or any other tool again."
}

This repeated far more than 4 times, even though maximumRemoteCalls was set to 4.

Environment Details:

  • ADK Library Version (pip show google-adk): adk 1.33.0
  • Desktop OS:** [e.g., macOS, Linux, Windows] Windows
  • Python Version (python -V): Python 3.11.15

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-2.5-pro

🟡 Optional Information

Providing this information greatly speeds up the resolution process.

log

mode-any-log.txt

Screenshots / Video:
If applicable, add screenshots or screen recordings to help explain
your problem.
N/A

Additional Context:
Add any other context about the problem here.
N/A

Minimal Reproduction Code:
Please provide a code snippet or a link to a Gist/repo that isolates the issue.

// Code snippet here

N/A

How often has this issue occurred?:

  • Always (100%)

Metadata

Metadata

Assignees

Labels

agent config[Component] This issue is related to the Agent Config interface and implementation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions