Repository navigation
Description
Describe the bug
I have a very simple agent that can get information about candidates and a role.
Getting info about the candidate works
Getting info about the role works
But getting both and compare the results, doesn't work.
I get this error
litellm.BadRequestError: OpenAlException - An assistant message with 'tool _calls' must be followed by tool messages responding to each 'tool _call_id'. The following tool_call_ids did not have response messages: call_kOvB3zQZ5K0dХQfrzPoQmOAj
To Reproduce
Steps to reproduce the behavior:
- Run the flow below and ask "tell me whether carlos or juan is better for the role"
from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm
def get_candidate_info(names: list[str]) -> str:
"""Provide information about one or more candidates"""
if len(names) == 0:
return "No candidate names provided"
if len(names) == 1:
return f"Juan is great Full-stack engineer with 10 years of experience, love to work with modern frameworks and languages like React, Next, Typescript, and Python. He is a great team player and always willing to help the team."
if len(names) > 1:
return f"Carlos is great Full-stack engineer with 10 years of experience, love to work with modern frameworks and languages like React, Next, Typescript, and Python. He is a great team player and always willing to help the team. Juan is a devops engineer with 5 years of experience, he is expert in kubernetes and docker. He is a great team player and always willing to help the team."
def get_role_info() -> str:
"""Provide information about a open role looking for engineers"""
return "Google is looking for a Full-stack engineer with 10 years of experience, love to work with modern frameworks and languages like React, Next, Typescript, and Python. He is a great team player and always willing to help the team."
root_agent = Agent(
name="root_agent",
model=LiteLlm(model="openai/gpt-4o"),
description=(
"Agent to answer questions about a candidate"
),
instruction=(
"You are a helpful assistant. Your primary goal is to provide information about a candidate or a role. "+
"When the user asks a question about a candidate, "+
"you MUST use the 'get_candidate_info' tool to find the information. "+
"When the user asks a question about a role, "+
"you MUST use the 'get_role_info' tool to find the information. "+
"When the user ask to compare candidates with a role you have to use get_candidate_info, and get_role_info tools to find the information and the compare the candidates with the role. "+
"Analyze the tool's response: if the status is 'error', inform the user politely about the error message. "+
"If the status is 'success', based on the results of the tools, clearly and concisely present the information to the user. "+
"Only use the tool when a candidate or a role is mentioned."
),
tools=[get_candidate_info, get_role_info],
)
Expected behavior
The agent gets the results of each tool and compare the results
Desktop (please complete the following information):
- OS: [e.g. iOS] Mac OS Sequioa 15.1
- Python version(python -V): 3.10
- ADK version(pip show google-adk): 0.1.0
Additional context
The error is obvious, the root agent call both tools (and they actually return the data) but when receives back breaks. It happens the same when using subagents either using sub_agents= or subagents as tool
Activity
wizard-spin commentedon Apr 14, 2025
I have also encountered this issue. It appears that the tools only work with agents that use Gemini models. They don't function properly with non-Gemini models are used via Litellm. As a temporary solution, I have been using sug-agent that uses gemini model specifically to utilize the tool until this is resolved. and use this sub agent as a tool in the root_agent.
Example:
`# Google search tool is not supported for model openai/gpt-4o-mini, therefore using sub-agent for it.
The sub-agent is a pre-built agent that can perform Google searches and return results.
basic_search_agent = Agent(
name="basic_search_agent",
model="gemini-2.0-flash-exp",
description="Agent to answer questions using Google Search.",
instruction="I can answer your questions by searching the internet. Just ask me anything!",
# google_search is a pre-built tool which allows the agent to perform Google searches.
tools=[google_search]
)
--- Example Agent using OpenAI's GPT-4o ---
(Requires OPENAI_API_KEY)
root_agent = LlmAgent(
model=LiteLlm(model="openai/gpt-4o-mini"), # LiteLLM model string format
name="openai_web_search_summarization_agent",
description= "This agent is an advanced AI orchestrator that accepts a user’s query, delegates it to a sub-agent for web searching, and returns a concise summary. It clarifies ambiguities by highlighting conflicting information and prompts the user for details. By leveraging automated search and synthesis, the agent provides contextually relevant answers while maintaining transparency about uncertainties.",
instruction=prompt.SUMMARIZATION_INSTR,
tools=[agent_tool.AgentTool(agent=basic_search_agent)],
)`
2manoj1 commentedon Apr 14, 2025
I'm running into an issue using LlmAgent with multiple sub_agents. When both sub-agents try to respond (i.e., tool calls are made by both agents), I get this error from OpenAI:
It seems like the orchestration isn't handling the tool_call_id resolution correctly when more than one agent is involved.
Please let me know if this is a known issue or if there's a workaround!
ar0it commentedon Apr 17, 2025
For me the issue seems to occur when several function_calls happen in a single part
A workaround could be to intercept the tool call and let only one function call through:
hangfei commentedon May 31, 2025
This should be fixed in latest wheel. Please retry. Feel free to re-open if you still experience this issue.
momo-tuannguyen12 commentedon Jun 27, 2025
which version fixes that issue?
jpmc216 commentedon Aug 6, 2025
I am using latest google-adk version (1.9.0) and I still get the issue
litellm.exceptions.BadRequestError: litellm.BadRequestError: AzureException BadRequestError - An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages:gsagrawal-binocs commentedon Aug 19, 2025
i am using 1.10.0 and still getting this issue.
Kk12suthar commentedon Aug 20, 2025
i am also experincing this issue with all models other than gemini
why other models reuqires id as string for making a tool call @hangfei please fix it asap, its a major obstacle for my app.
samalwa commentedon Sep 1, 2025
Facing same issue. is this resolved? please help
digi0pz commentedon Nov 12, 2025
We are still facing this issue especially after adding system_instruction. Is this still open?
OV-CPSO commentedon Dec 2, 2025
I am facing this issue. Can we reopen this issue?
aleianno90 commentedon Dec 15, 2025
Facing same issue.
simoneb commentedon Dec 22, 2025
Can you please reopen this issue?