-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
When using google-adk with LiteLLM and tools, a run can end with a tool call/ tool response and no final agent message. In these cases, the LiteLLM wrapper raises ValueError: No message in response from _model_response_to_generate_content_response.
Technically, I can catch this error in my own code, but I'd like to understand if this behaviour is intended. Shouldn't a turn that ends only with a tool call/tool response be considered a valid outcome for ADK? If yes, then raising an error in this case feels wrong.
This error is not easy to prevent, since the LLM model can act like that sometimes, by writing the "final" message as an intermediate response and finalizing the turn by calling a tool, even if instructed not to. It is also annoying to integrate with other frameworks like Phoenix Otel, since this span comes as an error, even if the system is supposed to work like that.
To Reproduce
- Create an agent that uses a LiteLLM-backed model with tools enabled.
- Run the agent via
Runner.run_async(...)on a query that triggers a tool call and ends the turn without a final agent message. Note that in this case we could have intermediate responses. What matters is that the last events should be a tool call and tool response. - Observe that
_model_response_to_generate_content_responseinspects the LiteLLM response, and then raisesValueError: No message in response
Expected behavior
I'd expect a turn that ends with a tool response (with no final agent message) to be treated as a valid outcome, not as a fatal error.
If the response has no message, what ADK could do is to construct an LlmResponse with an empty text but valid tool/actions and metadata, and avoid raising ValueError in this case.
Desktop (please complete the following information):
- OS: Linux (WSL2)
- Python version: 3.10
- ADK version: 1.18.0
- openinference-instrumentation-google-adk: 0.1.6
- arize-phoenix-otel: 0.13.1
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: gemini-2.5-flash
Additional context
Usage pattern: multi-agent Runner.run_async(...) with tools and Otel tracing enabled.