-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
🔴 Required Information
Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected/deprioritized.
If an item is not applicable to you, please mark it as N/A
Describe the Bug:
When using Claude via Vertex AI or OpenAI models with ADK, replaying session history that contains tool calls results in a BadRequestError because tool_call_id is missing.
Steps to Reproduce:
- Use ADK with session continuity (loading previous session events)
- The previous session contains tool calls (function_call and function_response)
- Use Claude via Vertex AI or the OpenAI model via LiteLLM
- Send a follow-up message that requires replaying the session history
Root Cause Analysis
- Gemini API returns id=None for function calls
- ADK's populate_client_function_call_id() generates adk-{uuid} IDs to fill this gap
- Before sending history to LLM, remove_client_function_call_id() strips all adk-* prefixed IDs, setting them to None
- Claude via Vertex AI and OpenAI requires tool_call_id on tool response messages to match them to function calls
- With IDs stripped, these models fail with BadRequestError
Expected Behavior:
Session history with tool calls should work correctly with Claude/OpenAI models. The adk-* function call IDs should be preserved since:
- Claude via Vertex AI requires tool_call_id
- OpenAI models require a matching tool_call_id
- Gemini ignores extra IDs (generates its own or uses None)
Observed Behavior:
What actually happened? Include error messages or crash stack traces here.
Environment Details:
- ADK version: 1.2.3+
- Python version: 3.11
- Model: Claude via Vertex AI (also affects OpenAI via LiteLLM)
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: Claude via Vertex AI (also affects OpenAI via LiteLLM)
🟡 Optional Information
Providing this information greatly speeds up the resolution process.
Regression:
Did this work in a previous version of ADK? If so, which one? No
Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.
litellm.BadRequestError: litellm.BadRequestError: VertexAIException BadRequestError -
{'error': {'message': "tool_call_id '...' not found in list of function calls in the chat history"}}
How often has this issue occurred?:
- Always (100%)