Skip to content

Multi-turn sessions return empty response after first tool call #21

@vcorr

Description

@vcorr

Multi-turn conversations break immediately after the first tool execution in a session when using the TypeScript ADK. The agent returns an empty response for the second turn (no text content), and subsequent turns fail with API errors (400) because the conversation history contains a model message with empty parts.

I have verified that this issue does not exist in the Python ADK (v1.21.0), which handles the exact same agent logic and conversation flow correctly.

To Reproduce
Steps to reproduce the behavior:

  1. Initialize an LlmAgent with at least one tool (e.g., FunctionTool) and InMemorySessionService.
  2. Turn 1: Send a user message that triggers a tool call (e.g., "What is the shipping policy?" -> calls searchKnowledge).
    • Result: Agent correctly calls the tool and returns the answer. (✅ Works)
  3. Turn 2: Send a follow-up user message in the same session (e.g., "What is 2+2?").
    • Result: The runner.runAsync loop completes, but the final model response contains no text parts. (❌ Fails - Empty Response)
  4. Turn 3: Send another user message.
    • Result: The API request fails with error 400 because the history now includes the empty model response from Turn 2.

Expected behavior
The agent should continue the conversation normally after a tool call, maintaining context and providing a text response to subsequent user messages, just as the Python ADK does.

Screenshots
N/A (Console output confirms empty response)

Desktop (please complete the following information):

  • OS: macOS 14.6

  • TS version/environment: Node.js v18+, TypeScript 5.x

  • ADK version: @google/adk v0.2.0 (npm)

  • Model used: gemini-2.0-flash (Vertex AI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjavascriptPull requests that update javascript code

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions