chore: sync main -> v2#5630
Open
Jacksunwei wants to merge 327 commits intov2from
Open
Conversation
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout. - Update unit tests to fully assert integration migration. Co-authored-by: Haiyuan Cao <haiyuan@google.com> PiperOrigin-RevId: 889634966
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout. - Update unit tests to fully assert integration migration. PiperOrigin-RevId: 889796517
Co-authored-by: Sasha Sobran <asobran@google.com> PiperOrigin-RevId: 889890969
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout. - Update unit tests to fully assert integration migration. PiperOrigin-RevId: 889891348
Co-authored-by: Sasha Sobran <asobran@google.com> PiperOrigin-RevId: 889912141
PiperOrigin-RevId: 889912199
PiperOrigin-RevId: 889935432
- Migrate `tools/bigquery` to `integrations/bigquery` to match standard ADK layout. - Update unit tests to fully assert integration migration. Co-authored-by: Haiyuan Cao <haiyuan@google.com> PiperOrigin-RevId: 889963735
PiperOrigin-RevId: 889992570
… default Co-authored-by: Sasha Sobran <asobran@google.com> PiperOrigin-RevId: 890025323
…definitions The list_agents method in AgentLoader no longer attempts to determine the agent language for each directory Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 890078066
…r session management Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 890127075
The workflow now accepts a `release_branch` input, checks out the specified release branch, and updates the version in `src/google/adk/version.py` Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 890134954
…ponses Close: #4609 Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 890144644
When an MCP server (or any toolset) is unavailable or raises an exception during get_tools(), the error previously propagated uncaught through _convert_tool_union_to_tools() and canonical_tools(), crashing the entire agent silently with no log output. This change wraps the toolset.get_tools_with_prefix() call in a try-except that catches exceptions, logs a warning with the toolset class name and error details, and returns an empty tool list. This allows the agent to continue operating with tools from other working toolsets. The fix preserves the existing retry behavior — McpToolset's @retry_on_errors decorator still attempts reconnection before the error reaches this handler. On subsequent agent invocations, get_tools() is called again, naturally retrying the connection. Fixes: #3341 Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com> PiperOrigin-RevId: 890512146
The deep_merge_dicts function will now extend lists when merging dictionaries, instead of overwriting them. Co-authored-by: Vishwa Murugan <vishwamurugan@google.com> PiperOrigin-RevId: 890531331
… ExpressMode and GCP projects Otherwise we get errors of the form: `Project/location and API key are mutually exclusive in the client initializer` (https://github.com/googleapis/python-genai/blob/1ccad7b70ae1068cb5f3e866ad7ca4d42aa55e1e/google/genai/_api_client.py#L590-L591). Co-authored-by: Yeesian Ng <ysian@google.com> PiperOrigin-RevId: 890588927
PiperOrigin-RevId: 890595289
This PR updates the `toolbox-adk` package version in the `pyproject.toml` and also updates the MCP Toolbox server version to the latest in the docs. PiperOrigin-RevId: 890633573
…ecution This change introduces a new EnvironmentToolset within the ADK, providing tools to interact with a BaseEnvironment. The toolset includes Execute, ReadFile, EditFile, WriteFile. System instructions are injected to guide the LLM on workspace usage and file manipulation. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 890672569
…le I/O locally This change introduces the LocalEnvironment class, which allows agents to execute shell commands and perform file operations using asyncio subprocesses on the local machine. It includes support for a working directory and custom environment variables. A sample agent configuration is also added to demonstrate its usage. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 890685517
Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 890694124
Merge #4842 ### Link to Issue or Description of Change **1. Link to an existing issue** Closes #4841 **2. Changes** This change aligns SSE transport behavior with Streamable HTTP transport for MCP tools, enabling users to customize the httpx.AsyncClient for SSE-based MCP connections (e.g., proxy, auth, TLS config). - Update `SseConnectionParams` model to include httpx_client_factory parameter (matching StreamableHTTPConnectionParams pattern) - Pass `httpx_client_factory` from `SseConnectionParams` to underlying `sse_client()` call - Add `model_config` to `SseConnectionParams` to allow arbitrary types for the factory function - Update docstrings to document the new `httpx_client_factory attribute` - Add unit test for new senarios ### Testing Plan **Unit Tests:** - [x] I have added or updated unit tests for my change. - `tests/unittests/tools/mcp_tool/test_mcp_session_manager.py` - [x] All unit tests pass locally. - All test cases have passed the test. **Manual End-to-End (E2E) Tests:** 1. Set custom httpx_client_factory parameter for SseConnectionParams ```Python from typing import Any import httpx from google.adk.agents.llm_agent import Agent from google.adk.models import LiteLlm from google.adk.tools.mcp_tool import SseConnectionParams, McpToolset # Cutom httpx client factory for MCP SSE transport def custom_httpx_client_factory( headers: dict[str, str] | None = None, timeout: httpx.Timeout | None = None, auth: httpx.Auth | None = None, ) -> httpx.AsyncClient: # Print message for debugging print(' === Custom httpx_client_factory running! ===') kwargs: dict[str, Any] = { "follow_redirects": True, } if timeout is None: kwargs["timeout"] = httpx.Timeout(30, read=300) else: kwargs["timeout"] = timeout if headers is not None: kwargs["headers"] = headers if auth is not None: kwargs["auth"] = auth return httpx.AsyncClient(**kwargs) connection_params = SseConnectionParams( url='http://127.0.0.1:9000/sse', httpx_client_factory=custom_httpx_client_factory, # Custom httpx client factory ) tool = McpToolset(connection_params=connection_params) root_agent = Agent( model=LiteLlm(model="ollama_chat/qwen3.5:35b-a3b-q4_K_M"), name='root_agent', description='A helpful assistant for user questions.', instruction='Answer user questions to the best of your knowledge', tools=[tool], ) ``` 2. Run the Agent, and display the debug log in console ``` 2026-03-15 23:54:14,304 - INFO - agent_loader.py:130 - Found root_agent in my_agent.agent INFO: 127.0.0.1:55642 - "POST /run_sse HTTP/1.1" 200 OK === Custom httpx_client_factory running! === 2026-03-15 23:54:14,345 - INFO - _client.py:1740 - HTTP Request: GET http://127.0.0.1:9000/sse "HTTP/1.1 200 OK" 2026-03-15 23:54:14,349 - INFO - _client.py:1740 - HTTP Request: POST http://127.0.0.1:9000/messages/?session_id=b5750c6e214048c28110dff11c412ecb "HTTP/1.1 202 Accepted" ``` ### Checklist - [x] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [x] I have performed a self-review of my own code. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have added tests that prove my fix is effective or that my feature works. - [x] New and existing unit tests pass locally with my changes. - [x] I have manually tested my changes end-to-end. - [x] Any dependent changes have been merged and published in downstream modules. ### Additional context Co-authored-by: Kathy Wu <wukathy@google.com> COPYBARA_INTEGRATE_REVIEW=#4842 from ushelp:main e3125fb PiperOrigin-RevId: 890708694
- Add 1P BQ Skills `bigquery-ai-ml`, add mandatory reference routing and reference file for `AI.*` syntax. - Include dedicated reference documents for various BigQuery ML features. - Update unit tests to fully assert skill validations. Co-authored-by: Haiyuan Cao <haiyuan@google.com> PiperOrigin-RevId: 890749300
Revert global list extension in deep_merge_dicts and instead explicitly handle list extension only for render_ui_widgets in merge_parallel_function_response_events. Co-authored-by: Vishwa Murugan <vishwamurugan@google.com> PiperOrigin-RevId: 891147765
Close: #4671 Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 891827874
…n intermediate data PiperOrigin-RevId: 891846041
This reduces latency by avoiding redudant network calls Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 891931454
Moved `before_model_callback` inside the `call_llm` span. Wrapped both `after_model_callback` and error callbacks with `trace.use_span()` to bind callbacks to the correct overarching span. Added regression tests to verify span ID consistency. Co-authored-by: Haiyuan Cao <haiyuan@google.com> PiperOrigin-RevId: 891952170
Co-authored-by: Yifan Wang <wanyif@google.com> PiperOrigin-RevId: 908883116
…mResponse Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 908900779
This fixes an issue where AgentEngineSandboxCodeExecutor catches the wrong exception class when attempting to recover from externally-deleted sandboxes. Fixes #5480 Co-authored-by: Amaad Martin <amaadmartin@google.com> PiperOrigin-RevId: 908965545
PiperOrigin-RevId: 910258324
They were added prematurely, and currently output.type diverges from what's in semconv (https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/), so this change removes them from our metrics, at least for the time being. PiperOrigin-RevId: 910587563
…t tests PiperOrigin-RevId: 910601469
…ging in BigQuery plugin
This PR addresses three distinct issues in the BigQuery Agent Analytics Plugin:
1. Fix false-positive fork detection:
When the plugin is deployed via Vertex AI Agent Engine, it undergoes a pickle/unpickle lifecycle which resets `_init_pid` to 0. Previously, `_ensure_started()` would incorrectly detect this as a fork since `os.getpid()` is never 0, causing unnecessary cold-start latency and log noise. The PID check now distinguishes `_init_pid == 0` (unpickled) from a real fork.
2. Correct GCS offload unit mismatch:
Separates the evaluation limits for offloading text content to GCS. It evaluates the byte-based storage guard (`inline_text_limit`) and the character-based truncation limit (`max_length`) independently, preventing mismatched unit comparisons.
3. Add AGENT_RESPONSE logging:
Logs final response events emitted by agents to BigQuery. This explicitly filters out intermediate steps such as function calls/responses, streaming partials, and invisible internal reasoning ("thoughts") so that only the final visible response text is captured.
Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 910770002
Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 910796426
…ent engine Deploying using API key has been leading to "Deploy failed: 'NoneType' object has no attribute 'before_request'" errors because creating cloud resources requires ADC credentials (project id and region) Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 910821145
Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 910839657
… available This reduces the token usage of having skills appended to the instruction on every call Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 910904229
PiperOrigin-RevId: 910941961
…istered AuthProvider PiperOrigin-RevId: 911115744
Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 911411431
PiperOrigin-RevId: 911554133
Merge #5612 ## Summary - Added `.github/header-checker-lint.yml` with full configuration to ignore `src/google/adk/cli/browser/**`. - Ensured Python files are still checked by adding `py` to `sourceFileExtensions` ## Test Plan - Verify that the `License Header Lint GCF` / `header-check` status check passes on this PR Co-authored-by: Wei Sun (Jack) <weisun@google.com> COPYBARA_INTEGRATE_REVIEW=#5612 from google:ci/ignore-browser-assets d08d161 PiperOrigin-RevId: 911583387
Co-authored-by: Wei Sun (Jack) <weisun@google.com> PiperOrigin-RevId: 911737937
…s empty response PiperOrigin-RevId: 911999966
PiperOrigin-RevId: 912036870
PiperOrigin-RevId: 912057968
Express mode API was updated to require "get_default_api_key: True" for returning api key Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 912153767
…ssion Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 912249311
Generates a random code verifier and code challenge during the initial auth request. During token exchange, the client sends the original code verifier so the server can verify it matches the previously sent challenge. This prevents attacks by ensuring that only the client that initiated the request can obtain the final access token. Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 912703679
PiperOrigin-RevId: 912711824
The analyzer crashed on `sum([None, ...])` whenever any event had fingerprint-only cache metadata (cache_name=None, invocations_used=None), which happens on every session's first turn. Also fixes `cache_refreshes` over-counting None as a unique cache instance. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 912722966
Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 912743254
…ded on by extension developers PiperOrigin-RevId: 912771457
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated sync of v1 changes from main into v2. The oncall is responsible for reviewing and merging this PR. Resolve conflicts in favor of the v2 implementation.