Skip to content

Adk Function Call Warning #4685

@vernondmonte

Description

@vernondmonte

🔴 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:
When an ADK Agent invokes a registered tool, the model returns a response containing a function_call part. The ADK framework internally accesses .text on this response (likely for logging or introspection). The google.genai SDK fires a UserWarning from types.py whenever .text is accessed on a response that contains non-text parts. The warning is emitted on every single tool call, flooding logs with noise. The tool itself executes correctly — the warning is a false positive caused by an internal .text access at the ADK call site.

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

  1. Install pip install google-adk google-genai google-cloud-aiplatform
  2. Create an ADK Agent with a registered async tool (see Minimal Reproduction Code below)
  3. Set GOOGLE_GENAI_USE_VERTEXAI=1 and valid GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_LOCATION env vars
  4. Run adk web and ask the agent a question that triggers the tool call
  5. Observe the following warning printed to the console on every tool invocation:
    Github Bug Report Adk Function Call Warning
    less than a minute ago

Review
🔴 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: When an ADK
Agent
invokes a registered tool, the model returns a response containing a function_call part. The ADK framework internally accesses .text on this response (likely for logging or introspection). The google.genai SDK fires a UserWarning from types.py whenever .text is accessed on a response that contains non-text parts. The warning is emitted on every single tool call, flooding logs with noise. The tool itself executes correctly — the warning is a false positive caused by an internal .text access at the ADK call site.

Steps to Reproduce:

Install pip install google-adk google-genai google-cloud-aiplatform
Create an ADK
Agent
with a registered async tool (see Minimal Reproduction Code below)
Set GOOGLE_GENAI_USE_VERTEXAI=1 and valid GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_LOCATION env vars
Run adk web and ask the agent a question that triggers the tool call
Observe the following warning printed to the console on every tool invocation:

WARNING - types.py:6814 - Warning: there are non-text parts in the response:
['function_call'], returning concatenated text result from text parts.
Check the full candidates.content.parts accessor to get the full model response.

Expected Behavior:
No warning should be emitted during tool invocation. The ADK framework should check response.candidates[0].content.parts directly when working with responses that may contain function_call parts, rather than accessing the .text property which is documented to warn on mixed-part responses.

Observed Behavior: A UserWarning is emitted on every tool call via the google.genai types.py:6814 .text property getter. The warning originates inside the ADK framework (google_llm.py), not in user code. The tool call completes successfully regardless — the warning is noise only.

Observed Behavior:
What actually happened? Include error messages or crash stack traces here.

Environment Details:

ADK Library Version (pip show google-adk): 1.26.0
Desktop OS: Windows 11
Python Version (python -V): 3.13.0

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-2.0-flash

🟡 Optional Information

Providing this information greatly speeds up the resolution process.

Regression:
have not tested against earlier ADK versions.

Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.
``2026-03-03 11:54:10,767 - INFO - google_llm.py:185 - Sending out request, model: gemini-2.0-flash, backend: GoogleLLMVariant.VERTEX_AI, stream: False
2026-03-03 11:54:14,921 - INFO - google_llm.py:250 - Response received from the model.
2026-03-03 11:54:14,922 - WARNING - types.py:6814 - Warning: there are non-text parts in the response: ['function_call'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response.


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

**Additional Context:**
The .text property in google.genai.types is a convenience accessor that concatenates text parts and explicitly warns when non-text parts (such as function_call) are present. The ADK framework should not be accessing this property on responses it knows may contain function calls. The internal call site should instead iterate over response.candidates[0].content.parts directly, or guard with a check before calling .text.

Suggested fix at the ADK call site in google_llm.py:

# Instead of (triggers warning when parts contain function_call):
text = response.text

# Use (safe, no warning):
parts = response.candidates[0].content.parts if response.candidates else []
text = "".join(p.text for p in parts if hasattr(p, "text") and p.text)


**Minimal Reproduction Code:**
Please provide a code snippet or a link to a Gist/repo that isolates the issue.
```import os
from google.adk.agents import Agent
from google.adk.tools import ToolContext
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types

async def my_tool(question: str, tool_context: ToolContext) -> str:
    """A simple tool that answers questions."""
    return f"Answer to: {question}"

root_agent = Agent(
    model=os.getenv("ROOT_AGENT_MODEL", "gemini-2.0-flash"),
    name="test_agent",
    instruction="Use my_tool to answer all questions.",
    tools=[my_tool],
)

session_service = InMemorySessionService()
session = session_service.create_session(app_name="test", user_id="user1")

runner = Runner(
    app_name="test",
    agent=root_agent,
    session_service=session_service,
)

content = types.Content(role="user", parts=[types.Part(text="What is 2+2?")])
for event in runner.run(user_id="user1", session_id=session.id, new_message=content):
    # WARNING fires here on every tool invocation:
    # "Warning: there are non-text parts in the response: ['function_call']"
    pass

How often has this issue occurred?:

  • Always (100%)

Metadata

Metadata

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

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions