Skip to content

chore: sync main -> v2#4915

Open
Jacksunwei wants to merge 99 commits intov2from
main
Open

chore: sync main -> v2#4915
Jacksunwei wants to merge 99 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
sasha-gitg and others added 30 commits March 24, 2026 14:16
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 888850792
Introduces a new index `idx_events_app_user_session_ts` on the `events` table in both V0 and V1 database schemas. This index covers `app_name`, `user_id`, `session_id`, and `timestamp` (descending) to improve query performance.

Modifies `DatabaseSessionService` to automatically create any missing indexes defined in the SQLAlchemy metadata when preparing the database tables.

Close #4827

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 888877174
…tionTool`

Merge #4778

Closes: #4777

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=#4778 from gautamvarmadatla:fix/pydantic-basemodel-required-fields 45db622
PiperOrigin-RevId: 888905953
Merge #4990

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

COPYBARA_INTEGRATE_REVIEW=#4990 from google:release/v1.27.4 71982f2
PiperOrigin-RevId: 888928449
Update the `model_config` for `Event` to set `extra='ignore'`. This allows the `Event` model to be initialized with fields not explicitly defined in the model, preventing errors when deserializing data that may contain additional, unneeded fields. This allows the session service to accept 2.0 events.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 889327445
…sionService

Introduces a new helper function, `_get_or_create_state`, which uses a nested transaction (SAVEPOINT) to safely attempt creating a state row. If a concurrent transaction has already inserted the row, the inner insert will fail with an IntegrityError, which is caught, and the already-existing row is then fetched

Close #4954

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 889441684
…d LiteLLM upperbound

Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 889449878
…or clearer agent feedback and correct typing

PiperOrigin-RevId: 889521009
- 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
- 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
Merge #5016

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

COPYBARA_INTEGRATE_REVIEW=#5016 from google:release/v1.28.0 4e05efb
PiperOrigin-RevId: 890122693
…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
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.