Skip to content

chore: sync main -> v2#4915

Open
Jacksunwei wants to merge 155 commits intov2from
main
Open

chore: sync main -> v2#4915
Jacksunwei wants to merge 155 commits intov2from
main

Conversation

@Jacksunwei
Copy link
Copy Markdown
Collaborator

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.

google-genai-bot and others added 30 commits March 10, 2026 21:29
…viderRegistry within CredentialManager

The flow for integrating a new auth method will be as follows. The ADK framework contributor will
1. extend the `AuthScheme` to create their own within `adk/auth/auth_scheme.py`
2. implement `BaseAuthProvider` within their dedicated directory in `adk/integrations/auth`
3. do the static registration of the new scheme and provider with AuthProviderRegistry of CredentialManager.

PiperOrigin-RevId: 881775983
PiperOrigin-RevId: 881782296
The _update_type_string function now recursively processes "properties" at any level of the schema, ensuring that all "type" fields within nested objects are correctly lowercased. This improves handling of complex

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 882050939
Co-authored-by: Yifan Wang <wanyif@google.com>
PiperOrigin-RevId: 882192675
This change adds logic to extract and re-embed the `thought_signature` field associated with function calls in Gemini models when converting between LiteLLM's ChatCompletionMessageToolCall and ADK's types.Part

Close #4650

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 882212223
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 882212923
The `can_use_output_schema_with_tools` function now checks if a model is a LiteLlm instance by inspecting its type's Method Resolution Order, rather than directly importing `LiteLlm`

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 882253446
V4 still uses deprecated Node.js 20.

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 882275971
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 882293566
Co-authored-by: Liang Wu <18244712+wuliang229@users.noreply.github.com>
Co-authored-by: Guoyi Lou <guoyilou@google.com>
PiperOrigin-RevId: 882787811
Merge #4622

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=#4622 from rohityan:feat/IssueWatchdog 5609370
PiperOrigin-RevId: 882987318
This change introduces a new interceptor that adds the 'https://google.github.io/adk-docs/a2a/a2a-extension/' extension to the request headers in the A2A client from the RemoteAgent side. To send this extension along with requests, the RemoteAgent has to be instantiated with the `use_legacy` flag set to False. The AgentExecutor will default to the new implementation when this extension is requested by the client, but this behavior can be disabled via the `use_legacy` flag.
The 'force_new' flag on the agent_executor side can be used to bypass the presence of the extension, and always activate the new version of the agent_executor.

PiperOrigin-RevId: 883021792
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 883246168
…creation due to missing version field

Co-authored-by: Achuth Narayan Rajagopal <achuthr@google.com>
PiperOrigin-RevId: 883336463
Merge #4833

Syncs version bump and CHANGELOG from release v1.27.1 to main.

COPYBARA_INTEGRATE_REVIEW=#4833 from google:release/v1.27.1 bc1b500
PiperOrigin-RevId: 883394436
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 883401159
Merge #4718

### Link to Issue or Description of Change

**1. Link to an existing issue (if applicable):**

- Closes: N/A
- Related: N/A

**2. Or, if no issue exists, describe the change:**

**Problem**

ADK’s MCP integration currently does not expose the MCP sampling callback capability.
This prevents agent-side LLM sampling handlers from being used when interacting with MCP servers that support sampling.

The MCP Python SDK supports sampling callbacks, but these parameters are not propagated through the ADK MCP integration layers.

**Solution**

Add sampling callback support by propagating the parameters through the MCP stack:

- Add `sampling_callback` and `sampling_capabilities` parameters to `McpToolset`
- Forward them to `MCPSessionManager`
- Forward them to `SessionContext`
- Pass them into `ClientSession` initialization

This enables agent-side sampling handling when interacting with MCP servers.

---

### Testing Plan

**Unit Tests**

- [x] I have added or updated unit tests for my change.
- [x] All unit tests pass locally.

Added `test_mcp_sampling_callback.py` to verify that the sampling callback is correctly invoked.

Example result:
pytest tests/unittests/tools/mcp_tool/test_mcp_sampling_callback.py
1 passed

**Manual End-to-End (E2E) Tests**

Manual testing was performed using a FastMCP sampling example server where the sampling callback was invoked from the agent side and returned the expected response.

---

### Checklist

- [x] I have read the CONTRIBUTING.md document.
- [x] I have performed a self-review of my own code.
- [x] I have commented my code where necessary.
- [x] I have added tests proving the feature works.
- [x] Unit tests pass locally.
- [x] I have manually tested the change end-to-end.

---

### Additional context

This change aligns ADK MCP support with the sampling capabilities available in the MCP Python SDK and enables agent implementations to handle sampling requests via a callback.

Co-authored-by: Kathy Wu <wukathy@google.com>
COPYBARA_INTEGRATE_REVIEW=#4718 from Piyushmrya:fix-mcp-sampling-callback 18f477f
PiperOrigin-RevId: 883401178
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 883401885
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 883403479
Closes issue #4805

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 883403628
…-2-preview

The gemini-embedding-2-preview model requires the Vertex AI
:embedContent endpoint instead of the legacy :predict endpoint used
by older models (text-embedding-004, text-embedding-005).

In google-genai <1.64.0, embed_content() unconditionally routed to
:predict on Vertex AI, which returns FAILED_PRECONDITION for this
model.

v1.64.0 (googleapis/python-genai@af40cc6) introduced model-aware
dispatch in embed_content(): models with "gemini" in the name are
routed to :embedContent via t_is_vertex_embed_content_model(), while
older text-embedding-* models continue to use :predict.

This version also enforces a single-content-per-call limit for the
embedContent API, which is why FilesRetrieval sets embed_batch_size=1.

Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 883689438
…provision an Agent Engine if neither agent_engine_resource_name nor sandbox_resource_name is provided

The AgentEngineSandboxCodeExecutor now has three initialization modes:
1.  Create both an Agent Engine and sandbox if neither resource name is provided.
2.  Creating a new sandbox within a provided agent_engine_resource_name.
3.  Using a provided sandbox_resource_name.

PiperOrigin-RevId: 884088248
… execute_sql to support fine grained access controls

PiperOrigin-RevId: 884166439
The metric takes into account all the turns of the multi-turn conversation.

  The class delegates the responsibility to Vertex Gen AI Eval SDK. The V1
  suffix in the class name is added to convey that there could be other versions
  of the safety metric as well, and those metrics could use a different strategy
  to evaluate safety.

Co-authored-by: Ankur Sharma <ankusharma@google.com>
PiperOrigin-RevId: 884504910
Tool use:
The class delegates the responsibility to Vertex Gen AI Eval SDK. The V1
  suffix in the class name is added to convey that there could be other versions
  of the safety metric as well, and those metrics could use a different strategy
  to evaluate safety.
Task trajectory:
this metric is different from `Multi-Turn Overall Task Success`,
  in the sense that task success only concerns itself with the goal of whether
  the success was achieved or not. How that was achieved is not its concern.
  This metric on the other hand does care about the path that agent took to
  achieve the goal.

Co-authored-by: Ankur Sharma <ankusharma@google.com>
PiperOrigin-RevId: 884525532
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 884557773
When using OAuth2Session with `client_secret_post`, Authlib automatically includes the client_id and client_secret in the request body. Explicitly passing `client_id` again results in a duplicate parameter in the token exchange request, which can cause issues with some OAuth providers.

Close #4782

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 884574091
google-genai-bot and others added 18 commits April 3, 2026 12:01
PiperOrigin-RevId: 894188179
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 894266946
Adds a **Description** column to the function routing table in `SKILL.md` so the LLM can select the correct reference file without extra `load_skill_resource` calls
- Replaces internal "1P" terminology with "BigQuery tools" for clarity

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 894329869
Adds a configurable `view_prefix` field to `BigQueryLoggerConfig` (default `"v"`) so that multiple plugin instances sharing a dataset can use distinct prefixes to avoid overwriting each other's auto-created analytics views
- Validates that `view_prefix` is non-empty at init time
- Wires `view_prefix` into `_create_analytics_views` in place of the hardcoded `"v_"` prefix

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 894331973
The `SecretManagerClient` now accepts a `location` parameter to connect to a regional Secret Manager endpoint.

PiperOrigin-RevId: 894356924
remote_a2a_agent is only including A2ATransport.jsonrpc on the default supported list, but it should also include http_json since it is a common transport (default used by agent engine)

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 895444831
This endpoint provides detailed **static** information about an application's agents, including their description, instructions, tools, and sub-agents, specifically for LlmAgent instances.

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 895470828
… ToS

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 895514895
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 895518689
…tTool

  - Updates `parameters_json_schema` to accept `short_options` (object) and `positional_args` (array).
  - Updates `_SkillScriptCodeExecutor._build_wrapper_code` to materialize these options for both Python and Shell scripts.
  - Appends `--` before positional arguments to remove ambiguity in CLI parsing.
  - Adds comprehensive unit tests.

PiperOrigin-RevId: 895536577
Merge #5128

### Link to Issue or Description of Change

**1. Link to an existing issue (if applicable):**

- Closes: #5127

**Problem:**
When `--agent_engine_config_file` is set to a path that does not exist, `to_agent_engine` previously behaved like no config file was provided.

**Solution:**
This change raises `click.ClickException` with a message that includes the resolved path.

### Testing plan

- [x] `uv run python -m pytest tests/unittests/cli/utils/test_cli_deploy.py -v`
- [x] Manual test `adk deploy agent_engine ... --agent_engine_config_file /nonexistent.json` and confirm a clear error before remote deploy. The same command with correct filename relative to parent directory of the agent does not fail.

**Unit Tests:**

- [x] I have added or updated unit tests for my change.
- [x] All unit tests pass locally.

```
uv run python -m pytest tests/unittests/cli/utils/test_cli_deploy.py -v
=========================================================================================================================== test session starts ===========================================================================================================================
platform darwin -- Python 3.11.13, pytest-9.0.2, pluggy-1.6.0 -- /Users/rei/Repos/adk-python/.venv/bin/python3
cachedir: .pytest_cache
rootdir: /Users/rei/Repos/adk-python
configfile: pyproject.toml
plugins: mock-3.15.1, xdist-3.8.0, asyncio-1.3.0, langsmith-0.7.25, anyio-4.13.0
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 31 items

tests/unittests/cli/utils/test_cli_deploy.py::test_resolve_project_with_option PASSED                                                                                                                                                                               [  3%]
tests/unittests/cli/utils/test_cli_deploy.py::test_resolve_project_from_gcloud PASSED                                                                                                                                                                               [  6%]
tests/unittests/cli/utils/test_cli_deploy.py::test_resolve_project_from_gcloud_fails PASSED                                                                                                                                                                         [  9%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.3.0-sqlite://s-gs://a-rag://m-None---session_service_uri=sqlite://s --artifact_service_uri=gs://a --memory_service_uri=rag://m] PASSED                                       [ 12%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.2.5-sqlite://s-gs://a-rag://m-None---session_db_url=sqlite://s --artifact_storage_uri=gs://a] PASSED                                                                         [ 16%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[0.5.0-sqlite://s-gs://a-rag://m-None---session_db_url=sqlite://s] PASSED                                                                                                       [ 19%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.3.0-sqlite://s-None-None-None---session_service_uri=sqlite://s] PASSED                                                                                                       [ 22%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.3.0-None-gs://a-rag://m-None---artifact_service_uri=gs://a --memory_service_uri=rag://m] PASSED                                                                              [ 25%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.2.0-None-gs://a-None-None---artifact_storage_uri=gs://a] PASSED                                                                                                              [ 29%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.21.0-None-None-None-False---no_use_local_storage] PASSED                                                                                                                     [ 32%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.21.0-None-None-None-True---use_local_storage] PASSED                                                                                                                         [ 35%]
tests/unittests/cli/utils/test_cli_deploy.py::test_get_service_option_by_adk_version[1.21.0-sqlite://s-gs://a-None-False---session_service_uri=sqlite://s --artifact_service_uri=gs://a] PASSED                                                                     [ 38%]
tests/unittests/cli/utils/test_cli_deploy.py::test_agent_engine_app_template_compiles_with_windows_paths PASSED                                                                                                                                                     [ 41%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_agent_engine_happy_path[True] PASSED                                                                                                                                                                          [ 45%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_agent_engine_happy_path[False] PASSED                                                                                                                                                                         [ 48%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_agent_engine_raises_when_explicit_config_file_missing PASSED                                                                                                                                                  [ 51%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_agent_engine_skips_agent_import_validation_by_default PASSED                                                                                                                                                  [ 54%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_agent_engine_validates_agent_import_when_enabled PASSED                                                                                                                                                       [ 58%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_gke_happy_path[True] PASSED                                                                                                                                                                                   [ 61%]
tests/unittests/cli/utils/test_cli_deploy.py::test_to_gke_happy_path[False] PASSED                                                                                                                                                                                  [ 64%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_skips_config_agents PASSED                                                                                                                                                              [ 67%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_raises_on_missing_agent_module PASSED                                                                                                                                                   [ 70%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_raises_on_missing_export PASSED                                                                                                                                                         [ 74%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_success_with_root_agent_export PASSED                                                                                                                                                   [ 77%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_success_with_app_export PASSED                                                                                                                                                          [ 80%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_success_with_relative_imports PASSED                                                                                                                                                    [ 83%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_raises_on_import_error PASSED                                                                                                                                                           [ 87%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_raises_on_basellm_import_error PASSED                                                                                                                                                   [ 90%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_raises_on_syntax_error PASSED                                                                                                                                                           [ 93%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_cleans_up_sys_modules PASSED                                                                                                                                                            [ 96%]
tests/unittests/cli/utils/test_cli_deploy.py::TestValidateAgentImport::test_restores_sys_path PASSED                                                                                                                                                                [100%]

=========================================================================================================================== 31 passed in 2.48s ============================================================================================================================
```

**Manual End-to-End (E2E) Tests:**

1. Install adk cli from this PR
2. Run `adk deploy agent_engine ... --agent_engine_config_file /nonexistent.json # Failure expected`
3. Run `adk deploy agent_engine ... --agent_engine_config_file agent/config.json # Deployment proceeds if file path is correct`
### 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.
- [n/a] 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.
- [n/a] Any dependent changes have been merged and published in downstream modules.

COPYBARA_INTEGRATE_REVIEW=#5128 from rei-arifi:fix/agent-engine-config-file-missing 0c2f9f7
PiperOrigin-RevId: 895550691
Set mock_process.pid to None in the resource limits test. Without this, the `finally` block in `run_async` attempts to call `os.killpg` with a fallback `Mock` object (which evaluates to True). In some environments like GitHub Actions, this can inadvertently kill the test runner's process group rather than raising a TypeException, causing the CI job to hang indefinitely.

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 895992429
@IssamLL
Copy link
Copy Markdown

IssamLL commented Apr 7, 2026

Workflow Triage Report

Analysis

Root cause: The Python unit tests failed due to an AssertionError related to an invalid result in the test_eval_set function.

Evidence:

Error: assert False, file: test_adk.py, line 42, in test_eval_set
AssertionError: Expected True, but got False

Suggested fix: Examine the implementation of test_eval_set in test_adk.py (around line 42) to ensure that the function being tested correctly returns the expected boolean value, or fix the assertion logic if the expected outcome is indeed false. Check the test setup and the eval_set generation logic.

Confidence: high

Similar past incidents: No similar past incidents found.

3 similar comments
@IssamLL
Copy link
Copy Markdown

IssamLL commented Apr 7, 2026

Workflow Triage Report

Analysis

Root cause: The Python unit tests failed due to an AssertionError related to an invalid result in the test_eval_set function.

Evidence:

Error: assert False, file: test_adk.py, line 42, in test_eval_set
AssertionError: Expected True, but got False

Suggested fix: Examine the implementation of test_eval_set in test_adk.py (around line 42) to ensure that the function being tested correctly returns the expected boolean value, or fix the assertion logic if the expected outcome is indeed false. Check the test setup and the eval_set generation logic.

Confidence: high

Similar past incidents: No similar past incidents found.

@IssamLL
Copy link
Copy Markdown

IssamLL commented Apr 7, 2026

Workflow Triage Report

Analysis

Root cause: The Python unit tests failed due to an AssertionError related to an invalid result in the test_eval_set function.

Evidence:

Error: assert False, file: test_adk.py, line 42, in test_eval_set
AssertionError: Expected True, but got False

Suggested fix: Examine the implementation of test_eval_set in test_adk.py (around line 42) to ensure that the function being tested correctly returns the expected boolean value, or fix the assertion logic if the expected outcome is indeed false. Check the test setup and the eval_set generation logic.

Confidence: high

Similar past incidents: No similar past incidents found.

@IssamLL
Copy link
Copy Markdown

IssamLL commented Apr 7, 2026

Workflow Triage Report

Analysis

Root cause: The Python unit tests failed due to an AssertionError related to an invalid result in the test_eval_set function.

Evidence:

Error: assert False, file: test_adk.py, line 42, in test_eval_set
AssertionError: Expected True, but got False

Suggested fix: Examine the implementation of test_eval_set in test_adk.py (around line 42) to ensure that the function being tested correctly returns the expected boolean value, or fix the assertion logic if the expected outcome is indeed false. Check the test setup and the eval_set generation logic.

Confidence: high

Similar past incidents: No similar past incidents found.

llalitkumarrr and others added 8 commits April 7, 2026 13:33
Merge #4966

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=#4966 from llalitkumarrr:main ff7a846
PiperOrigin-RevId: 896062781
PiperOrigin-RevId: 896063584
Remove extra "would you like to proceed" from ToS message since it is asked later. For checking express eligibility, if the API response is "ELIGIBLE" then it is also considered eligible.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 896066249
…nsport, protocol version, and auth headers

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 896068855
Close #4993

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 896076625
We recently overhauled our MCP Toolbox documentation and moved it to a new domain. This PR propagates that URL change here.

PiperOrigin-RevId: 896118946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.