Skip to content

Bug: StreamingMode.SSE causes agent to drop tool calls in subsequent turns #355

@iyedb

Description

@iyedb

Description

When StreamingMode.SSE is enabled (without PROGRESSIVE_SSE_STREAMING), an agent that produces
both a text response and one or more tool calls in the same turn works correctly on the first
user turn but silently drops tool calls on every subsequent turn.

Steps to reproduce

  1. Create an LlmAgent with two lightweight tools, for example:

    • showForecastChart — accepts a location string, returns "Chart displayed."
    • showQuickActions — accepts an array of action labels, returns "Actions displayed."
  2. Write a system prompt that instructs the agent to always reply with a short text summary
    and call both tools on every turn.

  3. Run the agent with streamingMode: StreamingMode.NONE (the default). Send two consecutive
    user messages. Verify that both tools are called on both turns.

  4. Run the exact same agent and conversation with streamingMode: StreamingMode.SSE
    (PROGRESSIVE_SSE_STREAMING disabled, which is the default). Send the same two messages.

  5. Observe that on the later turns one or more tool calls that appeared in step 3 are absent.
    Comparing candidatesTokenCount and thoughtsTokenCount in usageMetadata between the two
    modes confirms the model actually generates a shorter response: the missing tool
    calls are not produced by Gemini API.

Expected behavior

The agent should call the same tools in SSE mode as it does with SSE disabled.

Environment

  • @google/adk version: 1.1.0
  • Model: gemini-2.5-flash
  • Runtime: Node.js
  • PROGRESSIVE_SSE_STREAMING: disabled (default)

Note: possibly related to #289

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrequest 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