Multi-turn sessions return empty response after first tool call
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:
- Initialize an
LlmAgentwith at least one tool (e.g.,FunctionTool) andInMemorySessionService. - 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)
- Turn 2: Send a follow-up user message in the same session (e.g., "What is 2+2?").
- Result: The
runner.runAsyncloop completes, but the final model response contains no text parts. (❌ Fails - Empty Response)
- Result: The
- 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/adkv0.2.0 (npm) -
Model used:
gemini-2.0-flash(Vertex AI)