* 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
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
We recently overhauled our MCP Toolbox documentation and moved it to a new domain. This PR propagates that URL change here.
PiperOrigin-RevId: 896118946
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
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
Merge https://github.com/google/adk-python/pull/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=https://github.com/google/adk-python/pull/5128 from rei-arifi:fix/agent-engine-config-file-missing 0c2f9f7b2f7f2e681f7d814637204a113047d95a
PiperOrigin-RevId: 895550691
- 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
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
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
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
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
Refactors BashTool to use start_new_session=True and os.killpg for proper process isolation and cleanup on timeouts or errors.
PiperOrigin-RevId: 893740978
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
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
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
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
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
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