Skip to content

User Confirmation Tool returns nested response object causing TypeError in backend (json.loads) #3510

@PeterHiroshi

Description

@PeterHiroshi

Describe the bug
In google-adk v1.18.0, when invoking the User Confirmation Tool, the frontend sends a payload that incorrectly includes an additional nested response property.
As a result, the backend receives a structure like:

{
  "response": {
    "response": {
      "confirmed": true
    }
  }
}

Instead of the expected:

  "response": {
    "confirmed": true
  }
}

This leads to a TypeError during backend execution:

TypeError: the JSON object must be str, bytes or bytearray, not dict

To Reproduce
Steps to reproduce the behavior:

  1. Install google-adk 1.18.0
  2. Invoke the user_confirmation tool from the frontend
  3. Check the payload sent to the backend — it includes a double response nesting
  4. Observe backend logs showing the following error:
TypeError: the JSON object must be str, bytes or bytearray, not dict

Expected behavior
The backend should receive a correctly formatted JSON payload (single response layer) so that json.loads() can process it without error.

Screenshots
Invoke the user confirmation tool from the frontend
Image

Observe the request payload from the frontend
Image

Debug the code at google/adk/flows/llm_flows/request_confirmation.py:84 from the backend, the value of function_response.response['response'] like below
Image

Observe backend logs showing the following error
Image

Desktop (please complete the following information):

  • OS: macOS
  • Python version: 3.11.9
  • ADK version: 1.18.0

Model Information:
• Using LiteLLM: Yes
• Model used: claude-4.5

Additional context
The issue seems to originate from the frontend serialization step in the User Confirmation Tool handler, where the response object is wrapped twice before sending to the backend.

Metadata

Metadata

Labels

needs review[Status] The PR/issue is awaiting review from the maintainerservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etctools[Component] This issue is related to toolsweb[Component] This issue will be transferred to adk-web

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions