You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
url_context tool's retrieval status is discarded: LlmResponse drops candidate.url_context_metadata #8226
Describe the Bug:
When the built-in url_context tool is used, Gemini reports what happened to each URL in candidate.url_context_metadata: the retrieved URL and a url_retrieval_status (SUCCESS, ERROR, PAYWALL, UNSAFE). LlmResponse.create (models/llm_response.py) copies grounding_metadata, citation_metadata and the logprobs from the candidate, but LlmResponse has no field for url_context_metadata, so it's discarded. The field name appears nowhere in src/google/adk.
As a result, callbacks, plugins, events and evals can't tell whether the model actually read the page. A failed or paywalled fetch looks the same as a successful one, and the model may have answered from its own knowledge instead.
Expected Behavior: LlmResponse (and so the resulting Event) carries url_context_metadata, the same way it carries grounding_metadata for google_search. Then an after_model_callback can react to URL_RETRIEVAL_STATUS_ERROR, for example by telling the user the page couldn't be read.
Desktop OS: Windows 11 (the bug isn't OS-specific)
Python Version: 3.11
Model Information:
Are you using LiteLLM: No
Which model is being used: any Gemini model that supports the url_context tool
🟡 Optional Information
Regression:
No. The field has never been carried over.
Proposed fix:
Add url_context_metadata: types.UrlContextMetadata | None = None to LlmResponse and set it from the candidate in both branches of LlmResponse.create, as citation_metadata is. Events are stored as JSON in the v1 session schema, so the field is persisted without a migration. Add unit tests for the success branch and the error-finish branch. I'm happy to send a PR.
Thank you for raising this issue and for your contribution, your PR is currently under review. It will be merged once the reviewer approves the changes and all checks pass. If we have further questions we will reach out to you. In the meantime we appreciate your patience.
Activity
llalitkumarrr commentedon Nov 20, 2026
Hello @karthik-0306 ,
Thank you for raising this issue and for your contribution, your PR is currently under review. It will be merged once the reviewer approves the changes and all checks pass. If we have further questions we will reach out to you. In the meantime we appreciate your patience.
karthik-0306 commentedon Nov 20, 2026
Thanks @llalitkumarrr! Happy to make any changes if the reviewer needs.