546 Commits

Author SHA1 Message Date
Shangjie Chen 0c6974cbc4 fix: Set role='model' for request_input event Content
Set role='model' in the Content object generated by create_request_input_event()
to ensure proper role attribution when returning function call events to the client.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 929538818
2026-06-09 19:19:51 -07:00
Wei (Jack) Sun 92d608f83e feat(integrations): Add E2BEnvironment for remote sandbox workspaces
Merge https://github.com/google/adk-python/pull/6031

> **Stacked on #6030** (`fix/experimental-typing`). This PR targets that branch; please review/merge #6030 first, after which this will be retargeted to `main`.

## Summary

Adds `E2BEnvironment`, a `BaseEnvironment` backed by an [E2B](https://e2b.dev) sandbox. It gives agents a persistent remote workspace for shell execution, file CRUD, and on-demand installs (`pip`/`apt`) without touching the host machine.

- The sandbox TTL is bounded to cap credit usage and is extended on each operation; an expired idle sandbox is transparently recreated.
- Lazy-imports the SDK behind a new `e2b` extra, so the base package stays lean.
- Includes a data-analysis sample that downloads a public (GCS-hosted) dataset and analyzes it inside the sandbox.

## Usage

```python
from google.adk.integrations.e2b import E2BEnvironment
from google.adk.tools.environment import EnvironmentToolset

toolset = EnvironmentToolset(environment=E2BEnvironment())
```

## Test plan

- [x] `pytest tests/unittests/integrations/e2b/` (14 passed)
- [x] `pyright src/google/adk/integrations/e2b/_e2b_environment.py` — 0 errors
- [x] Sample agent loads (`contributing/samples/environment_and_skills/e2b_environment`)
- [ ] Manual run against a live E2B sandbox (requires `E2B_API_KEY`)

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6031 from google:feat/e2b f2b5584e28c71e7110e9d98e1d0839f575183368
PiperOrigin-RevId: 929443164
2026-06-09 15:40:45 -07:00
Xuan Yang d72bb7d90d docs: Upgrade ADK release analyzer agent to use gemini-3.1-pro-preview model
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 929314765
2026-06-09 11:39:46 -07:00
Shangjie Chen 0337d19c47 chore: sync Google internal changes to GitHub (#6022) 2026-06-08 15:11:24 -07:00
George Weale aa51512587 chore: apply pre-commit formatting
Change-Id: Iec95a44368502706d814380881c8d10c4a7e8cd4
2026-05-28 16:05:50 -07:00
Bo Yang 6a533573db feat(api_server): Abort runs on client drops to avoid leaks
Standard REST, SSE, and WebSocket endpoints now actively monitor client disconnections. When a connection drop is intercepted, the executing worker task tree is aborted mid-run to prevent background task leaks, API token burn, and resource wastage.

Includes:
1. REST `/run` connection drop monitor blocking on raw ASGI receive events with 0% CPU consumption.
2. Graceful `499 Client Closed Request` status response on REST disconnections to suppress server-side exceptions.
3. Unit and integration tests validating REST task cancellations and generator finalizations.
4. Comprehensive architectural design documents and user guide under `/docs`.
5. An invocation-focused cooperative counting agent sandbox under `/contributing/samples/core/abort`.

Change-Id: I50fcba7a8bb56cf28b0a3bb8fa66b85732062a67
2026-05-28 14:11:39 -07:00
haranrk da1d8f1552 feat(interactions): update ADK to support Google GenAI SDK v2.0.0
Update ADK to support the new Interactions API. See: https://ai.google.dev/gemini-api/docs/interactions-breaking-changes-may-2026

Key changes include:
* Updated `interactions_utils.py` to parse new v2 interaction events such as
  `InteractionCreatedEvent`, `InteractionCompletedEvent`, and explicit step
  types (`ModelOutputStep`, `FunctionCallStep`, etc.).
* Transitioned from "turns" to "steps" terminology, including renaming
  `convert_contents_to_turns` to `convert_contents_to_steps`.
* Updated `contributing/samples/interactions_api`

Breaking Changes in interactions_utils.py:

- Renamed "turn" functions to "step" equivalents:
  - `convert_content_to_turn` -> `_convert_content_to_step`
  - `convert_contents_to_turns` -> `_convert_contents_to_steps`
  - `convert_interaction_output_to_part` -> `_convert_interaction_step_to_parts`
- Updated `build_interactions_request_log` to use required `input_steps` instead of `input_turns`.
- Deprecated `convert_part_to_interaction_content`

Change-Id: I962724321342ba0192251896ce51832b214d60d9
2026-05-27 16:30:02 -07:00
Shangjie Chen afb0a64f96 feat(tools): Standardize request_input tool for proactive LLM clarification
Add RequestInputTool to allow single LLM agents to pause, request user input, and resume seamlessly mid-loop without workflow graphs.

Also add comprehensive unit tests, integration tests, and a new official sample with automated session replay tests.

Change-Id: Ifb50cc2e644aeb5ffb2be797255608d0d5a37234
2026-05-27 13:07:54 -07:00
Xuan Yang af8bfe08ac fix: Format the files to fix pre-commit failures
Change-Id: Ie86c42e4fa3f0c2acd1d73d399fbe6f4e0c54f02
2026-05-27 11:22:36 -07:00
George Weale 104edc8317 fix: convert Union[Pydantic, Pydantic] tool args at runtime
FunctionTool._preprocess_args only converted dict args to a Pydantic
model for single-model and Optional[Model] annotations. A
Union[ModelA, ModelB] parameter was left as a raw dict, so
isinstance checks inside the tool failed with "Unexpected entity
type: <class 'dict'>"

Use pydantic.TypeAdapter to validate against the full Union so
pydantic picks the matching member. None and instances of any
declared union member pass through unchanged; instances of
unrelated BaseModels fall back to the existing graceful-failure
warning path.

Close #5799

Change-Id: Ie69f8efc8395162eac375a0eaad0c77ed2097cec
2026-05-22 16:21:58 -07:00
Emily Feng cbd14ebf99 feat: Add support for creating sandboxes from templates and snapshots
This change allows AgentEngineSandboxComputer to create new sandboxes
using either a specified sandbox template or a sandbox snapshot. The
environment variables VMAAS_SANDBOX_TEMPLATE_NAME and
VMAAS_SANDBOX_SNAPSHOT_NAME are introduced to configure this behavior.

Co-authored-by: Emily Feng <emilyfeng@google.com>
Change-Id: Iebdd980a16966ba765cacbce6d63d0d5b691650a
2026-05-22 15:47:41 -07:00
Han Cao db064160bf feat: Add chart generation and artifact loading to data agent
Introduces a generate_chart tool to the Data Agent sample, leveraging
Altair and vl-convert to render Vega-Lite specifications into charts.

Co-authored-by: Han Cao <huanc@google.com>
Change-Id: I5765487406d511e650091f5dc884102c43568fd4
2026-05-22 15:38:02 -07:00
George Weale a4f394e139 chore: edit files
Change-Id: I4e3e3e9f1846520f3fda86cc83453b30bdd336ef
2026-05-22 10:47:37 -07:00
Xuan Yang 55cbc8c9e8 fix(ci): Prevent workflow failures in relocated adk_team samples
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
2026-05-20 14:37:22 -07:00
Shangjie Chen 3329ced0b9 fix(tests): Append trailing newline to JSON test outputs
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
2026-05-19 16:27:47 -07:00
Xuan Yang 7fc5b0efc4 test(samples): Verify behavior of parallel functions and Pydantic arguments 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
2026-05-19 13:36:37 +00:00
Sasha Sobran 162279358c chore: switch main to v2.0.0 GA (transition to v2)
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>
2026-05-19 02:01:33 +00:00
Kathy Wu 88ebd426be feat: Implement GCPSkillRegistry in ADK
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
2026-05-14 14:47:42 -07:00
Xuan Yang 6d89d2194a fix: Update model to gemini-3-flash-preview in hello word agent sample
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 913891628
2026-05-11 14:47:54 -07:00
Xuan Yang 2d423e8355 fix: Update model to gemini-3-flash-preview in session state agent sample
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 913789974
2026-05-11 11:13:02 -07:00
Xuan Yang 192f19d824 fix: Update model name in hello_world agent
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 912743254
2026-05-08 16:11:29 -07:00
Kathy Wu 88421f80a0 fix: Filter out video events with inline data from being stored in session
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 912249311
2026-05-07 18:00:59 -07:00
Wei Sun (Jack) 3117e09136 chore: further fix header-check via 2025 --> 2026
Co-authored-by: Wei Sun (Jack) <weisun@google.com>
PiperOrigin-RevId: 911737937
2026-05-06 22:16:55 -07:00
Google Team Member ed8b31ce5f chore: migrate from gemini-1.* and gemini-2.0* to gemini-2.5-*
`gemini-1.*` and `gemini-2.0*` models are respectively deprecated and scheduled for shutdown on June 1, 2026. `gemini-2.5*` models are their successors.
No regressions in unit tests:
```
========================================================================================== 5583 passed, 2237 warnings in 84.91s (0:01:24) ===========================================================================================
```

PiperOrigin-RevId: 907663315
2026-04-29 10:34:22 -07:00
Shangjie Chen 599079b5a6 chore: Rename utils.py to gepa_utils.py to ensure consistent first-party module detection for sample scripts across different CI environments
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 905278958
2026-04-24 16:43:19 -07:00
Shangjie Chen 533776e005 chore: Switch to pre-commit and cleanup redundant tools
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 905187116
2026-04-24 13:13:42 -07:00
Shangjie Chen 9a0d2f70ba fix: Fix malformated skill.md
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 905152209
2026-04-24 12:00:28 -07:00
Sasha Sobran b848390904 fix(samples): Upgrade google-adk to 1.28.1 to fix vulnerability
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 905101547
2026-04-24 10:24:06 -07:00
Google Team Member 909a8c2ad4 feat: Add sample agent demonstrating 2LO, 3LO, and API Key auth via GcpAuthProvider
PiperOrigin-RevId: 904823303
2026-04-23 23:14:54 -07:00
Shangjie Chen c6d02c8198 chore: Format contributing folder using pre-commit
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 904672556
2026-04-23 15:44:03 -07:00
Kacper Jawoszek 2784217edc chore: Update telemetry owner
Co-authored-by: Kacper Jawoszek <jawoszek@google.com>
PiperOrigin-RevId: 901179890
2026-04-17 02:41:40 -07:00
Liang Wu 1af1b4aa26 chore: Remove adk_additional_tools and GetTimezone tool
These are not used in the example

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 900902777
2026-04-16 14:10:26 -07:00
Xiang (Sean) Zhou 5c6f6fe7b6 chore: Add sandbox computer use sample agent
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 900322196
2026-04-15 13:38:03 -07:00
Google Team Member 47fa7b743c docs: update MCP Toolbox branding, binary version, and asset references
## Overview

This PR updates internal tutorials and demonstration guidance following the renaming of the database connectivity tools (`genai-toolbox` -> `mcp-toolbox`) and aligns resource downloads with the newly scoped artifact destinations.

## Changes

* Removed references to legacy `googleapis.github.io/genai-toolbox` pages.
* Updated download commands to pull binaries directly from the rebranded bucket.
* Bumped the embedded curl instruction default payload target to the newly stable `v1.1.0` release tier.

PiperOrigin-RevId: 900207615
2026-04-15 09:34:06 -07:00
Liang Wu d337ddfc3e chore: Update Live sample agents' models
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 899943556
2026-04-14 22:24:19 -07:00
Wei (Jack) Sun 2cbb523069 feat(samples): add sample for skill activation via environment tools
Merge https://github.com/google/adk-python/pull/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=https://github.com/google/adk-python/pull/5218 from google:samples/local_env_skill 39404309e8b9237a279ecd6ed14bb87eb84098f0
PiperOrigin-RevId: 897229752
2026-04-09 11:58:35 -07:00
Google Team Member a60baca3dd docs: Update the MCP Toolbox docsite with the new URL
We recently overhauled our MCP Toolbox documentation and moved it to a new domain. This PR propagates that URL change here.

PiperOrigin-RevId: 896118946
2026-04-07 15:37:11 -07:00
llalitkumarrr 6a1c90bd9d docs: Auto-Assignment GitHub Action for Issues
Merge https://github.com/google/adk-python/pull/4966

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4966 from llalitkumarrr:main ff7a8465ae923b3990de2483c16f374f8193302b
PiperOrigin-RevId: 896062781
2026-04-07 13:33:19 -07:00
Liang Wu e51b649b76 chore: Improve event content handling and minor prompt adjustments
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 895518689
2026-04-06 15:05:49 -07:00
Google Team Member 1445ad5069 feat: refresh credentials if token is missing in the common code and samples
PiperOrigin-RevId: 894473156
2026-04-04 02:02:43 -07:00
Kathy Wu 4d7b9515b6 chore: Consolidate weather_skill and weather-skill in sample agent
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
2026-04-02 11:03:54 -07:00
Kathy Wu eb4674b49f feat: Add support for model endpoints in Agent Registry
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 893585328
2026-04-02 10:40:54 -07:00
Liang Wu 7fa13edacd fix(live): Buffer tool calls and emit them together upon turn completion
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
2026-04-01 17:45:51 -07:00
Xuan Yang d689a04f16 feat: Support propagating grounding metadata from AgentTool
Close: https://github.com/google/adk-python/issues/4671

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 891827874
2026-03-31 13:55:25 -07:00
Liang Wu f97367381e feat(environment): Add LocalEnvironment for executing commands and file 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
2026-03-27 16:18:33 -07:00
Google Team Member 14869253d0 fix: update toolbox-adk and toolbox server versions
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
2026-03-27 14:20:34 -07:00
Xuan Yang 5f69e19f82 fix: Enhance ADK release analyzer with resume functionality and better session management
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 890127075
2026-03-26 17:16:06 -07:00
Kathy Wu 6909a167c8 feat: Add slack integration to ADK
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 885814460
2026-03-18 15:21:01 -07:00
Xiang (Sean) Zhou 950a3b2d0a chore: update the component owner
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 885138365
2026-03-17 11:59:20 -07:00
Google Team Member 28618a8dcb feat: Add Spanner Admin Toolset
This change introduces a new `SpannerAdminToolset` with tools for managing Google Cloud Spanner resources. The toolset includes functions to list and get details of Spanner instances and instance configurations, and to create, list databases. The new toolset is marked as experimental. Unit tests for the new admin tools are also added

PiperOrigin-RevId: 885116111
2026-03-17 11:14:37 -07:00