Skip to content

Empty final output after successful tool call when functionCallingConfig.mode=AUTO #5631

@hapiiiiGit

Description

@hapiiiiGit

🔴 Required Information

Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected / deprioritized.
If an item is not applicable to you - please mark it as N/A

Describe the Bug:
I am testing Google ADK with a simple HumanEval-style Python code generation agent.
When functionCallingConfig.mode is set to AUTO, I sometimes get an empty final output after the model decides to call a tool.

The issue does not happen when the model directly returns text in the first LLM response. It happens when the first model response contains a function_call, the tool executes successfully, and then the second model response returns an empty content.parts list with finish_reason: "STOP".

As a result, ADK treats the final model event as empty and the final agent output becomes an empty string.

Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:

  1. Model: gemini-2.5-flash-lite
  2. Agent task: HumanEval-style Python code generation
  3. Agent Config
  4. Yaml
agent_class: LlmAgent

name: my_agent
model: gemini-2.5-flash-lite
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.
  Note:
    1. Output only final valid Python code. The final answer must be executable Python code.

tools:
  - name: my_agent.tools.python_executor

generate_content_config:
  temperature: 0.0
  maxOutputTokens: 8024
  responseMimeType: text/plain
  toolConfig:
    functionCallingConfig:
      mode: AUTO
  automaticFunctionCalling:
    disable: false
    maximumRemoteCalls: 8
    ignoreCallHistory: true

Expected Behavior:
After a successful tool call, the model should continue and produce the final answer text, for example the completed Python code.

Or, if the model returns an empty response after a tool call, ADK should probably retry, surface an error, or avoid treating the empty model event as the final output.

Observed Behavior:
The tool call succeeds, but the second model response is empty:

{
  "role": "model",
  "text": "",
  "content": {
    "parts": [],
    "role": "model"
  },
  "raw_response": {
    "finish_reason": "STOP",
    "usage_metadata": {
      "candidates_token_count": 0
    }
  }
}

Then ADK emits a final model event with empty text:

{
  "author": "my_agent",
  "role": "model",
  "text": "",
  "function_calls": [],
  "function_responses": []
}

And the final agent output is:

"final_output": ""

Environment Details:

  • ADK Library Version (pip show google-adk): 1.32.0
  • Desktop OS: Windows
  • Python Version : 3.14.4

Model Information:

  • Are you using LiteLLM: Yes
  • Which model is being used: gemini-2.5-flash-lite

🟡 Optional Information

Providing this information greatly speeds up the resolution process.

How often has this issue occurred?:

  • Often (50%+)

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementationrequest clarification[Status] The maintainer need clarification or more information from the author

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions