chore: sync main -> v2#5778
Closed
Jacksunwei wants to merge 393 commits into
Closed
Conversation
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
…ential manager PiperOrigin-RevId: 895904372
PiperOrigin-RevId: 895946363
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
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
PiperOrigin-RevId: 896133436
PiperOrigin-RevId: 896153946
PiperOrigin-RevId: 896191354
Standardize Parameter Names: - Use `skill_name` instead of `name`. - Use `file_path` instead of `script_path`. - Updated `_DEFAULT_SKILL_SYSTEM_INSTRUCTION` system prompt to use `skill_name="<SKILL_NAME>"`. Flexible Arguments for RunSkillScriptTool: - Updated schema to allow args to be either a JSON object or a list of strings (`anyOf`). - Updated `RunSkillScriptTool.run_async` and `_SkillScriptCodeExecutor.execute_script_async` to accept both dict and list types for arguments. - Modified `_SkillScriptCodeExecutor._build_wrapper_code` to pass list arguments directly as command-line arguments for python and bash scripts. Improved Error Messages: - Updated error messages across skills tools to specify the parameter name (e.g., "Argument 'skill_name' is required."). - Collected all validation error messages. Type Safety: - Fixed a TypeError in run_skill_script(). PiperOrigin-RevId: 896602439
…d logging PiperOrigin-RevId: 896612027
PiperOrigin-RevId: 896665913
* Skip sending conversation history when a live session is being resumed using a handle. * Catch ConnectionClosed and APIError exceptions during live sessions and attempt to reconnect if a session resumption handle is available. * Handle the server's "go_away" signal by proactively closing the connection to trigger a reconnection with the latest session handle. * Propagate the "go_away" signal from the Gemini connection to the LlmResponse. * Add unit tests for reconnection on ConnectionClosed, APIError, skipping history on resumption, and handling the go_away signal. Closes #4996 Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 896687925
…e errlog Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 896761013
… mode project is being created Also adds link to express mode so the user knows that it is Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 896778982
Parameter Manager is a feature of Secret Manager that provides centralized storage and management for workload parameters. It supports various formats (plain text, YAML, JSON) and can reference Secret Manager secrets. The ADK integration will provide a simplified interface for agents to retrieve rendered parameter values, supporting both global and regional endpoints. PiperOrigin-RevId: 896823376
…rts but with event.actions PiperOrigin-RevId: 896929519
…vents using provided interceptor PiperOrigin-RevId: 897143688
PiperOrigin-RevId: 897179529
Merge #5218 ### Link to Issue or Description of Change **1. Link to an existing issue (if applicable):** (None, this is a new sample) **2. Or, if no issue exists, describe the change:** **Problem:** There was no sample demonstrating how to use `LocalEnvironment` with `EnvironmentToolset` for manual skill activation (discovering and loading skills by reading files) instead of using the pre-configured `SkillToolset`. **Solution:** Created a new sample `local_environment_skill` that demonstrates this pattern: - Agent is instructed to find skills in `skills/` folder using the `find` command. - Agent loads skills by reading `SKILL.md` using the `ReadFile` tool. - Added a weather skill sample and reference data to demonstrate usage. ### Testing Plan **Unit Tests:** *(This is a sample/demonstration, so no new unit tests were added for the framework itself.)* **Manual End-to-End (E2E) Tests:** 1. Ran `adk web contributing/samples`. 2. Interacted with the agent in the Web UI. 3. Prompt: "Can you check the weather in Sunnyvale?" 4. Verified that the agent successfully used `find` to locate the skill, read `SKILL.md`, read `weather_info.md`, and answered correctly. ### 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 manually tested my changes end-to-end. COPYBARA_INTEGRATE_REVIEW=#5218 from google:samples/local_env_skill 3940430 PiperOrigin-RevId: 897229752
Passing in ADC auth headers to non-google MCP toolsets is a vulnerability. To fix, only pass in the headers to Google MCP toolsets. Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 897230159
…Flow This enables cross-connection session resumption for Gemini Live API sessions, allowing applications to capture the resumption handle and reuse it upon reconnection. - Add `live_session_resumption_update` to the skip check condition to ensure it's not discarded when content is empty. - Yield the event after the skip check, similar to transcription events. - Add unit test in `test_base_llm_flow.py` to verify the behavior. Closes #4357 Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 897318123
Close #5169 Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 897334695
This change updates the Gemma LLM integration to support Gemma 4 models by broadening the model regex from `gemma-3.*` to `gemma-.*` Close #5156 Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 897385272
If the user created an express mode project but has a different gcloud project set, we should help them unset it so that they doesn't run into permissions errors / the express mode one gets used. Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 897783336
…e trace PiperOrigin-RevId: 917108173
… agent role PiperOrigin-RevId: 917275872
…_data_insights tool PiperOrigin-RevId: 917326615
…tion history passed to user simulator PiperOrigin-RevId: 917340645
Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 917411239
- Claude Opus 4.7 rejects `thinking.type: "enabled"` with a 400 error and requires `thinking.type: "adaptive"`; adaptive is also the recommended mode for Opus 4.6 / Sonnet 4.6 where `"enabled"` is deprecated. - The genai `ThinkingConfig.thinking_budget = -1` (AUTOMATIC) sentinel is the natural mapping for adaptive: the model picks the depth itself. Callers opt in with `-1`; positive values keep the existing `"enabled"` path so older models are unchanged. - Bump `anthropic>=0.78` in `pyproject.toml`; 0.78 introduced `ThinkingConfigAdaptiveParam`. The previous floor (`>=0.43`) let Kokoro install `anthropic==0.75.0`, which crashes the new tests with `AttributeError: module 'anthropic.types' has no attribute 'ThinkingConfigAdaptiveParam'`. PiperOrigin-RevId: 917449729
Fixes #5702 Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 917452441
Co-authored-by: Bo Yang <ybo@google.com> Co-authored-by: Wei Sun (Jack) <weisun@google.com> Co-authored-by: George Weale <gweale@google.com> Co-authored-by: Swapnil Agarwal <swapnilag@google.com> Co-authored-by: Xuan Yang <xygoogle@google.com> Co-authored-by: Shangjie Chen <deanchen@google.com> Co-authored-by: Yifan Wang <wanyif@google.com> Co-authored-by: Kathy Wu <wukathy@google.com>
…uments with new tests Generated test JSON files for parallel_functions and pydantic_argument samples to verify their behavior. Also fixed a test replay issue by ignoring timestamps in state (in agent_test_runner.py) to prevent false failures due to dynamic data. Note: Some sample agents could not have tests generated successfully due to: 1. agent_tool_with_grounding_metadata: Fails on replay because AgentTool hides sub-agent events, causing mock LLM to get out of sync. 2. hello_world_stream_fc_args: Fails on rebuild because streaming function calls are not supported in the Unary API used by the test recorder. 3. output_schema_with_tools: Has external dependencies (Wikipedia/Google Search), making it unsuitable for automated regression tests without proper mocking. Change-Id: I69df7daf49d175905dcbd85cf70914e460717915
Change-Id: If39d565130df657d08e4367394c33771e68ad364
Co-authored-by: Sasha Sobran <asobran@google.com> Co-authored-by: Jacksunwei <1281348+Jacksunwei@users.noreply.github.com>
Migrated the multi-agent dynamic transfer integration tests from `flows/llm_flows/test_agent_transfer.py` to the consolidated `workflow/` directory to align with ADK 2.0 patterns. During this migration and alignment: 1. Fixed a critical runner bug in `NodeRunner._track_event_in_context` where structured parent nodes (like SequentialAgent or LoopAgent) executing legacy recursive sub-agents internally would mistakenly intercept and bubble up the sub-agent's internal routing actions, causing crashing `unrelated transfer` errors in the parent scheduler. Fixed by restricting route/transfer tracking to native node events (`not event.author` or `event.author == self._node.name`). 2. Restored five previously deleted legacy structured transfer tests (`test_auto_to_single`, `test_auto_to_auto_to_single`, `test_auto_to_sequential`, `test_auto_to_sequential_to_auto`, and `test_auto_to_loop`) to maintain regression protection. 3. Hardened the suite with dedicated new tests for sibling peer transfers, child-to-parent climbing transfers, grandchild nested transfers, self-transfer blocking, and unrelated sandbox crossing defenses. Change-Id: I2f087c211a5a78508689f4dfeea2c533219df208
JSON test files generated by the agent test runner were missing trailing newlines, causing the pre-commit end-of-file-fixer hook to fail. Added an explicit newline write on serialization. Change-Id: Idaffc4f2c23fa213f595ddef2188b0050aeb431d
…e.cloud Importing `gcp_utils` during `adk create` caused a ModuleNotFoundError because `resourcemanager_v3` was imported at module level. Moved the import into `list_gcp_projects` function scope where ImportError is caught specifically to raise an informative RuntimeError indicating they need to install the 'gcp' optional dependency. Also added google-cloud-resource-manager to optional dependencies. Fixes #5766 Change-Id: I9469e03c72342730cd0a1418551305a5e8058f60
…mples The samples in `contributing/samples/adk_documentation` and other `adk_..._agent` directories were moved to `contributing/samples/adk_team/`. This caused workflows to fail with `ModuleNotFoundError` because `PYTHONPATH` was pointing to the old location. Updated `PYTHONPATH` and module names in 7 workflow files to resolve correctly. Change-Id: I5495a086b2ddc8f7bbd8c70b529271e06baced91
Workflows failed because the gemini-2.5-pro model is not available for our projects and the CONTRIBUTING.md relative path resolved incorrectly after relocation. Updated the model to gemini-3.5-flash and adjusted the path resolver depth. Change-Id: Iffc8a2b0044f3d73b0cb0b364db220d2bd055683
The stale-bot workflow failed with ModuleNotFoundError because adk_stale_agent imports python-dateutil but the runner environment did not have it installed. Added python-dateutil to the pip install step. Change-Id: I1002c8eb7bb8fe2f9e106e85c3b5a7f990fe1c62
Enable MCP graceful error handling by default and retrieve background session context task exceptions. This prevents unhandled AnyIO TaskGroup transport failures from bubbling through the event loop and abruptly terminating live streaming sessions with 1006 abnormal closure. Change-Id: Ib4669fb57cddfc6ce61f9a3991b80db3f2b3e9ab
…idelines Reformat tests/unittests/cli/utils/test_gcp_utils.py using pyink, and restore the trailing newline in runtime-config.json to align with pre-commit style rules. Change-Id: Id2593bf761845d15c45cbde18f6d3a8f0e5dd639
Change-Id: If31a5e5a30ab8c3ee5480494e6d42e7c21240429
ci: Repoint v2 release workflows and manifests to v1 branch END_PUBLIC This change repurposes all secondary v2 release workflows (cherry-pick, cut, finalize, please, publish) and Release Please manifest configs to manage legacy patch releases on the v1 branch, as v2 GA releases are now serviced directly from main. BUG=None TAG=agy CONV=8876d6f0-694d-4980-9005-979adc5a2ef4 Change-Id: I9c682f5ec2c21fde95e0f00930e2442e254b33b3
Change-Id: I21678f6cb23d757f4195fdba064ef6fae7e853ea
The upload-adk-docs-to-vertex-ai-search workflow failed with ModuleNotFoundError: No module named 'adk_answering_agent' because the relative PYTHONPATH path did not resolve correctly under some CI environment execution states. Resolved by using the absolute ${{ github.workspace }} path.
Change-Id: I18c72b671f33c134bd08601b4a97671a1b1b0fa9
Change-Id: I3c33e84569d5f63f46c99154afa9e9d68a2fdf3c
…lently discarded In Gemini 3.1 live, LlmResponse packets sometimes contain only grounding metadata - don't skip these responses Change-Id: I9e2c1080395588d61aefffd1b6570102930e1fe0
Prepend missing license and copyright headers to CrewAI, LangChain, ADK Labs, and BigQuery redirect tools. Correct the copyright year to 2026 in the environment simulation plugin. Change-Id: Id68109102972e02bcf39a3f44bd3a4c51a18146a
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.