Skip to content

chore: sync main -> v2#5630

Open
Jacksunwei wants to merge 364 commits into
v2from
main
Open

chore: sync main -> v2#5630
Jacksunwei wants to merge 364 commits into
v2from
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.

wuliang229 and others added 30 commits April 1, 2026 17:45
The `receive` method now accumulates function calls from multiple `LiveServerMessage` instances. These accumulated tool calls are yielded as a single `LlmResponse` containing all function call parts only when a turn_complete message is received.

Without the change, the tool_1's response is sent to the model as soon as it's generated, triggering a second call for tool_2. Upon receiving two consecutive tool_2's responses, the model utters the same message twice.
Fixes issue #4902

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 893197482
…manager package

Reasons for moving `SecretManagerClient`:

1. **Logical Grouping**: `SecretManagerClient` represents an integration with Google Cloud Secret Manager. Placing it in the `integrations` package is more intuitive and organized than keeping it within a specific tool's client directory.

2. **Increased Reusability**: As a common utility in `google.adk.integrations`, it is now easily discoverable and accessible for any other agent or tool in the ADK that needs to interact with Google Cloud Secret Manager.

3. **Better Abstraction**: It provides a clean, simplified interface for secret retrieval from Google Cloud Secret Manager. Future enhancements will be consolidated in the same package.

4. **Cleaner Tooling**: The `apihub_tool` can now focus purely on the API Hub logic while delegating secret management to this dedicated package.

For what its worth, `SecretManagerClient` is not used by the `apihub_tool` at the moment.

PiperOrigin-RevId: 893221472
Propagate consent_nonce received from Agent Identity Credentials service during 3-legged OAuth flows into the AuthCredential OAuth2 object. This will be sent to the Agent Frontend via the adk_request_credential FunctionCall.

PiperOrigin-RevId: 893474363
…CLI help

Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 893521804
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 893585328
RemoteA2Agent's new _config attribute in v1.27.0 was not working with deepcopy() because it had Callable fields, causing agent engine deployment issues. This adds a custom deepcopy attribute that handles Callables by copying them by reference.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 893590078
We changed skills to use kebab case and created weather-skill, but forgot to get rid of weather_skill in the sample

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 893597141
Skill toolset's tools can change dynamically within a single invocation (when a skill is loaded)

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 893666326
Co-authored-by: Yifan Wang <wanyif@google.com>
PiperOrigin-RevId: 893730378
Co-authored-by: Jacksunwei <1281348+Jacksunwei@users.noreply.github.com>
Co-authored-by: Liang Wu <wuliang@google.com>
Co-authored-by: Sasha Sobran <asobran@google.com>
Co-authored-by: Ankur Sharma <ankusharma@google.com>
Refactors BashTool to use start_new_session=True and os.killpg for proper process isolation and cleanup on timeouts or errors.

PiperOrigin-RevId: 893740978
…istry

This is also so that we can add Agent Identity support when it's ready.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 894180206
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
wukath and others added 30 commits May 12, 2026 15:42
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 914515552
…sume

When resuming a session with Anthropic (Claude) models, tool_use IDs were
getting stripped during content replay, causing BadRequestError from the
Anthropic API. Two fixes: (1) preserve function call IDs in the contents
flow for AnthropicLlm models, (2) sanitize invalid/empty tool_use IDs
to match Anthropic's required pattern (^[a-zA-Z0-9_-]+$) instead of
passing empty strings.

Fixes #5074

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 914550905
Merge #5679

Same config as in adk-python-community

COPYBARA_INTEGRATE_REVIEW=#5679 from DeanChensj:main d33c368
PiperOrigin-RevId: 914634367
This CL introduces logic to handle scenarios where a non-ADK agent transitions to the `TaskState.input_required` or `TaskState.auth_required` states. It intercepts these events and converts them into a synthetic ADK `FunctionCall` event.

PiperOrigin-RevId: 914877123
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 914934690
…same invocation

Currently, BaseToolset caches its tools per invocation_id. Because SkillToolset dynamically resolves additional tools from the state when a skill is loaded, the cache prevents new tools from being picked up in the same invocation right after a load_skill call. This change sets `_use_invocation_cache = False` in SkillToolset so that it correctly re-evaluates the state-dependent tools at each step of the LLM generation loop within an invocation, preventing "Tool not found" errors.

PiperOrigin-RevId: 914997555
…ling

This change removes support for the deprecated `--session_db_url`, `--artifact_storage_uri`, and `--verbosity` flags from the ADK CLI. It also simplifies the service URI handling in `cli_deploy.py` by always using the new `--session_service_uri`, `--artifact_service_uri`, and `--memory_service_uri` flags, regardless of the ADK version.

The deprecated flags has been more than 1 year

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 915100881
This is related to #5327.
`BaseToolset.get_auth_config()` returns `None` by default and removing its overrides in toolsets that don't need OAuth flows to list tools does the job.

No regressions in unit tests (`pytest tests/unittests/auth`):
```
================================================================= 181 passed, 508 warnings in 4.23s =================================================================
```

PiperOrigin-RevId: 915128706
This change enables the Google Cloud Telemetry exporter to use mTLS endpoints. It checks for the availability of client certificates and respects the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variables to determine whether to use the mTLS-specific endpoint and configure the session accordingly.

PiperOrigin-RevId: 915541335
…confusion from BaseToolset's invocation_cache

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 915578052
This CL implements the  class in the integrations folder, used specifically for the Skill Registry API.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 915627057
…unity alignment

- Restrict invoke and review triggers purely to explicit user comments.
- Enforce strict author association verification (OWNER, MEMBER, COLLABORATOR).
- Enforce strict targeting assertion to ensure pull requests act on the main branch.
- Synchronize prompt constraints and GitHub action tools with the community catalog.
- Refine action API key options to uniformly target secrets.GOOGLE_API_KEY.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 915654346
… double-escaping

PiperOrigin-RevId: 916037238
This ensures that adding README.md files to subdirectories (as discussed
for new folders and integrations) won't result in them being included in
the published package.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916075206
When judge_model_config is None, LlmRequest raises a ValidationError
because it requires a config. We now construct a default GenerateContentConfig
if one isn't provided.

Close #5677

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916087055
…actions

This change introduces logic to identify events containing requests for tool confirmation or auth credentials. The compaction process will now stop before any such "Human-in-the-Loop" (HITL) events, ensuring that the full context of the interaction is preserved and not summarized away. This applies to both sliding window and token threshold compaction strategies.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916108771
`part_to_message_block` iterated `content` char-by-char when a tool
returned it as a plain string (e.g. `LoadSkillResourceTool`'s
`{"content": <file text>}`), producing `"H\ne\nl\nl\no"` instead of
`"Hello"`. Guard the list branch with `isinstance(..., list)` and add
a sibling branch that passes a scalar string through directly, matching
Anthropic's `content: str | list[ContentBlockParam]` shape.

Close #5358

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916109239
Co-authored-by: Amaad Martin <amaadmartin@google.com>
PiperOrigin-RevId: 916112779
…ack as successful

Previously, an empty `candidates` list without `prompt_feedback` resulted in an `UNKNOWN_ERROR`. This change updates the logic to handle such cases as a successful completion with no generated content, which is valid for certain model interactions like tool-driven turns.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916115022
…rt ~8%

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916195791
…ntTool

AgentTool.run_async only extracted text parts from the inner agent's
response, silently dropping code_execution_result.output and
executable_code.code. Outer agents using an inner agent with a code
executor saw nothing.

Close #5481

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916196604
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 916198410
Adds @functools.lru_cache to find_context_parameter so the inspect.signature
+ typing.get_type_hints lookup runs once per function, not on every MCP
confirmation callback or declaration build. No public surface change.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916204929
… MCP session creation failure

Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 916220631
* Implements live inference in evaluation_generator.py using Runner.run_live().
* Updates base_eval_service.py, local_eval_service.py to support live mode data structures and connection handling.

Testing: Added unit tests:
* test_generates_inferences_with_user_simulator_live
* test_live_session_manually_triggers_callbacks
* test_live_session_manually_triggers_callbacks_with_tools
* test_perform_inference_with_use_live
* test_perform_inference_single_eval_item_live
* test_perform_inference_single_eval_item_non_live
PiperOrigin-RevId: 916231029
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.