Skip to content

MALFORMED_RESPONSE during Tool Use #4865

@GinkoJack911

Description

@GinkoJack911

Issue Description: MALFORMED_RESPONSE during Tool Use

Model Information

My Agent uses the following configuration:

  • Model: gemini-3.1-pro-preview
  • Planner: BuiltInPlanner()
  • Thinking Level: high

The Problem

The agent occasionally outputs a thinking process but fails to generate a final response or tool call. In my architecture, the expected behavior after the thinking phase is to invoke transfer_to_agent to return control to the root_agent.

The "thought" logs indicate the model clearly knows it should call the tool; it repeatedly confirms that it needs to initiate a transfer_to_agent call. However, the final output payload is empty and ends in an error:

  • toolCalls: []
  • toolDefinitions: {}
  • "text": ""
  • "thought": true
  • finish_reason: MALFORMED_RESPONSE

Is this caused by the model (thinking_level, planner, or the model version itself), or is there another underlying cause?

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions