482 Commits

Author SHA1 Message Date
Bo Yang c560c8474f feat(samples): Add GitHub OAuth sample to demonstrate token requests
Add a new sample 'auth_oauth' demonstrating how to request a GitHub OAuth token in a workflow and use it to list repositories. Also rename the 'auth_config' sample to 'auth_api_key' for consistency.

Change-Id: I014b2f46f74b3017be89efc092380087179cf533
2026-04-20 17:59:17 -07:00
Xuan Yang 0b3d7c49e1 fix(events): Support camelCase in RequestInput
Add alias_generator and populate_by_name to RequestInput model_config to match frontend naming conventions and other event models.

Change-Id: I5eb4a55185d0113d86407c119050bb9885a7962b
2026-04-20 14:33:19 -07:00
Kacper Jawoszek fe1055f472 chore: Update telemetry owner
Co-authored-by: Kacper Jawoszek <jawoszek@google.com>
PiperOrigin-RevId: 901179890
Change-Id: I45845cf452112b61a97a1ffac0cbddd0cb93c9ae
2026-04-17 14:23:49 -07:00
Liang Wu 68620abc2b 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
Change-Id: Iadaaf9b03499d969f18e03eafb9fc21d79d94d87
2026-04-17 14:21:29 -07:00
Shangjie Chen 556eedc958 fix(samples): update burgers test case in task sub agent
Change-Id: I91fa7b7199484eb75464158b4db502b322bcab50
2026-04-17 10:54:53 -07:00
Bo Yang 745d861395 fix(tools): Resolve string annotations in FunctionTool to fix type conversion
When from __future__ import annotations is used, type hints are stored as strings. This caused is_list_of_basemodel to fail in FunctionTool, preventing dictionaries from being automatically converted back to Pydantic models when passed to tools. Used get_type_hints to evaluate them.

Also updated 10_burgers.json test trace to reflect the successful execution after this fix.

Change-Id: I92a708dd17ef76fc222779cd28e4a2d551325ce8
2026-04-16 22:08:11 -07:00
Bo Yang 8414f1fcea fix(test): Prevent function ID mismatch in multi-agent test replay
Use a FIFO queue for function name lookups to handle multiple calls in a trace, and remove hardcoded agent names to support all task agents. Also extract duplicate post-processing logic into a shared function.

Change-Id: Ia1062c6a6ba87a0d49c3982936121ac02f2bb352
2026-04-16 19:48:55 -07:00
Bo Yang 81a226ee61 refactor: rename is_parallel to use_sub_branch throughout workflow execution logic
Change-Id: I34eb070973dec2752338c454e4c4bd110466c925
2026-04-16 15:52:31 -07:00
Bo Yang 887bb6c600 feat(agent_samples): Update intake agent instruction and add wrong_name test
Change-Id: Id1bf62307d30137151931befc4c2355eda671648
2026-04-16 14:51:20 -07:00
Bo Yang cc3ba8a4cb refactor(workflow): Make JoinNode stateless by moving join logic to orchestrator
Moved the stateful aggregation logic from JoinNode to the Workflow orchestrator to simplify node implementation and prevent state leaks in loops. Removed in_nodes from Context as it is no longer needed.

Change-Id: If0677f65c735ee3bce985478f7990b4a3335b7df
2026-04-16 14:10:25 -07:00
Xiang (Sean) Zhou 4af9c03deb chore: Add sandbox computer use sample agent
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 900322196
Change-Id: I6da6fd7482e6957654c32f082e19e64d34177b19
2026-04-16 14:06:54 -07:00
Shangjie Chen dd64293559 chore(workflow): Remove non-functional shared_sub_agent sample
The shared_sub_agent sample was broken and not working, so it has been removed.

Change-Id: I4b71a04a069ed16c3257a43b469179c19ab1249b
2026-04-16 13:04:46 -07:00
Google Team Member be2bf68b01 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
Change-Id: I1d490f139ff78a1020dce9b88e9497d576e60882
2026-04-15 13:53:22 -07:00
Liang Wu f075fc07b2 chore: Update Live sample agents' models
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 899943556
Change-Id: Ib92a38a951518026d738b7a3812db37377fab6e7
2026-04-15 13:53:08 -07:00
Shangjie Chen 4c0a74bcf6 refactor(workflow): remove empty _workflow.py and rename _workflow_class.py to _workflow.py
Change-Id: I513ceb15e19b92a904746b736dcd976085d1c5d6
2026-04-14 21:23:49 -07:00
Wei (Jack) Sun 67d87969c6 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

Change-Id: If077549a1285593108e3764aa4a3fe967f31b412
2026-04-13 10:09:03 -07:00
Bo Yang 5de4cc3f03 test(cli): Avoid AdkEvent construction during event comparison
Compare events using raw dicts instead of constructing AdkEvent objects to avoid validation overhead and potential issues. Also sort longRunningToolIds to ensure order-independent comparison.

Change-Id: Ia17ea5bd0caaa1dd1b38cbef66e10d38d5666893
2026-04-11 00:44:39 -07:00
Bo Yang 3ad14489cc fix(agents): Fix missing branch field for events in standalone agents
The is_parallel flag was ignored in Context.run_node when falling back to non-workflow mode. Now it propagates to NodeRunner so that events generated by the node correctly create a sub-branch.

Change-Id: I4f58a7fb58f998a831c48b3c0b39f18dbb828bae
2026-04-11 00:28:02 -07:00
Bo Yang c1bdd9bc3b refactor: format dyanmic fan out fan in sample better.
Change-Id: Ifbab67f85122a1400f67df189b0bad24a3eb848b
2026-04-10 11:33:08 -07:00
Bo Yang 7ff410b247 test(samples): Update agent_in_workflow tests to cover approval, decline, and error cases
Change-Id: I277ed131120edb2ec61f1134553b3eaa886d734b
2026-04-10 11:08:56 -07:00
Bo Yang ed8add2e9b test(cli): Make JSON test files deterministic and sequential
Sort keys when saving rebuilt JSON test files and re-assign sequential event IDs to avoid gaps from filtered events. Also applied these changes to all existing test files in the contributing folder.

Change-Id: Ib126228f016db1d28030eee4f7d9d8cbc604e038
2026-04-10 11:08:42 -07:00
Bo Yang c97d39982f feat(workflow): Refine branch propagation for parallelism
Only add branch segments when parallelism occurs. Handle joins by using the common prefix of incoming branches.

Change-Id: If75f57e2dd69f2ddf71ade818e9c19d2a6e32c53
2026-04-10 11:08:02 -07:00
Shangjie Chen 7041c412f3 feat(samples): add dynamic fan-out/fan-in workflow sample
Demonstrates dynamic node orchestration with ctx.run_node() and asyncio.gather. Uses sub_branch for event isolation to prevent context pollution.

Change-Id: I00b98fe135b5f2a4d671580054d3aa4ad2901d50
2026-04-09 23:15:49 -07:00
Shangjie Chen 4f726053f4 refactor(samples): Clean up and fix style issues in workflow and agent samples
- Removed obsolete TODOs and mode='single_turn' from dynamic nodes sample.
- Fixed line lengths exceeding 80 characters in several samples.
- Removed unused imports and arguments.

Change-Id: Ie03871a258d02eadae9f2ae73f6d2982b755eae5
2026-04-09 22:22:34 -07:00
Bo Yang 7c7a0d7a4b tests: restore replay file now the node path issue is fixed.
Change-Id: Ia2dbf7efebe34239e53c28ac452794602db5bf49
2026-04-09 10:07:03 -07:00
Bo Yang 4476854455 feat(events): make run_id calculated and remove from JSON dump
Change-Id: Ida7d49b36bf6f590796f5c22ca26e5dc121352a5
2026-04-09 09:44:59 -07:00
Xuan Yang 61a8b5b9b8 fix(tests): Align retry sample test with 1-based attempt count
Change-Id: If7442f8c79f36880efdd5084b5baba9585d9a776
2026-04-08 15:44:59 -07:00
Xuan Yang c7f3c625e2 test(cli): Prevent random pollution in replay tests via JSON config
Running all tests caused the global random state to diverge, failing samples that rely on specific random sequences (like retry and loop_self). Moving mock values to JSON files allows deterministic replay without hardcoding sample paths in the runner.

Change-Id: I8e8b14cc54baa47da96aecdbaacb391868d528bb
2026-04-08 15:32:51 -07:00
Shangjie Chen 6f5d47cc27 refactor(workflow): Standardize retry mechanics with attempt_count
This commit refactors the workflow engine's retry mechanics to use a 1-based `attempt_count` instead of the ambiguous `retry_count`. This eliminates off-by-one complexities and aligns the implementation with documented behavior.

Key Changes:
- Replaced `retry_count` with `attempt_count` across `_node_runner_class.py`, `_node_runner.py`, `_workflow.py`, and `_retry_utils.py`.
- Updated `Context` in `agents/context.py` to use `attempt_count` as primary, removing `retry_count` entirely.
- Updated `NodeState` in `_node_state.py` to store `attempt_count` (1-based) instead of `retry_count`.
- Fixed the off-by-one bug in `max_attempts` check: now simply `attempt_count >= max_attempts`.
- Updated the `retry` sample and its README to use `attempt_count` and `max_attempts`.
- Updated unit tests in `test_node_runner_class_failure.py` and `test_workflow_failures.py` to use `attempt_count` and `attempt_counts` in assertions.

Change-Id: I0809c345cae2b62a00170e45e5c3cb6b648823f1
2026-04-08 15:09:21 -07:00
Google Team Member 57ae0b87cc 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
Change-Id: I77d474b8d120263f7d025b3cad900ae8b84cf0d8
2026-04-08 10:38:58 -07:00
llalitkumarrr 1cafbe4216 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

Change-Id: Ifcb6579557e283962a291e518721a85dabc786fb
2026-04-08 10:38:00 -07:00
Liang Wu bcd925fc4c chore: Improve event content handling and minor prompt adjustments
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 895518689
Change-Id: Ia1b7b3f052d8c04f2daaaa8b52924427005dd557
2026-04-07 23:06:14 -07:00
Google Team Member ffa62d6291 feat: refresh credentials if token is missing in the common code and samples
PiperOrigin-RevId: 894473156
Change-Id: I13a1558d31c799eaf0f1e7338d5cc26c9d6274bd
2026-04-07 23:05:35 -07:00
Kathy Wu 57aaa9df37 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
Change-Id: Ic4e85a67f01c678fe0d87759e8f7b758211dff44
2026-04-07 23:00:08 -07:00
Kathy Wu 0d62a204fe feat: Add support for model endpoints in Agent Registry
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 893585328
Change-Id: Iab38cfd17d719d3afcd76dbb7455acf45aaa8490
2026-04-07 22:59:46 -07:00
Liang Wu 89ef39998b 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
Change-Id: I7898cbbb385d2c1af52d030d20e6361594f488cf
2026-04-07 22:59:07 -07:00
Xuan Yang 98908cf061 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
Change-Id: I7823536b4ec1298f7ce8f06a0af6d2868860d5b0
2026-04-07 22:57:49 -07:00
Liang Wu 5c6376b7b0 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
Change-Id: Ibe948643077fc606cb2a5cf395b67c65af32d7f7
2026-04-07 22:57:17 -07:00
Google Team Member ad4ebb6594 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
Change-Id: I4ca2e0d1b1d9a76b62c46ec688e729f49bdf1d01
2026-04-07 19:30:24 -07:00
Xuan Yang 908179e1a2 fix: Enhance ADK release analyzer with resume functionality and better session management
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 890127075
Change-Id: Ie762aa6b3be5e188b034b88a7c41c4f8bd1938f0
2026-04-07 19:29:41 -07:00
Kathy Wu e37439421d feat: Add slack integration to ADK
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 885814460
Change-Id: I74ee50473baf33cfb568cfbc58b2e7a99b174c44
2026-04-07 19:26:21 -07:00
Xiang (Sean) Zhou 7146cb8604 chore: update the component owner
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 885138365
Change-Id: I874b12dbd99c416e3b5c5e07b6c5bed84896e54e
2026-04-07 19:25:33 -07:00
Google Team Member 4c9475dbe0 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
Change-Id: Id588cc26937c937886f7bccc6a019ceb52dfc263
2026-04-07 19:25:11 -07:00
Xiang (Sean) Zhou 51a08a3ee6 chore: Add a sample agent for files_retrieval tool
this sample can be used to test the latest gemini embedding model

Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 884574396
Change-Id: Id77891315da72f51a1aee0e4839be08781768a29
2026-04-07 19:24:40 -07:00
Google Team Member e6bb8367da feat: Enhance AgentEngineSandboxCodeExecutor sample to automatically 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
Change-Id: I85580a3028392347e11fe4993d0c854bb3be0201
2026-04-07 13:25:40 -07:00
Rohit Yanamadala 3eb360f46d docs: Feat/Issue Monitoring Agent
Merge https://github.com/google/adk-python/pull/4622

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4622 from rohityan:feat/IssueWatchdog 560937039d0a218b27d9cea767abd9a88a004822
PiperOrigin-RevId: 882987318

Change-Id: I95d41dc8d9fd5710c040d8af45825c2b5110d6e5
2026-04-07 13:24:17 -07:00
Bo Yang ee6f068e4f feat: replace random number agent sample with bank account management sub-agents
Change-Id: Ifd5b890214b7f9d558c96374b391c4f1ce4e169d
2026-04-06 15:39:40 -07:00
Bo Yang baf72ccd8c feat: add agent callback demonstration sample with tool and model interception logic
Change-Id: I82a59b9bd9871203f013c2c39de8489b30140840
2026-04-06 15:20:25 -07:00
Bo Yang 83ed3804cf docs: add parallel tool invocation examples and test cases for function tools and tool confirmation
Change-Id: Idd65a9e33e0c9b3588af78b3acc2644bb58200c3
2026-04-06 14:54:02 -07:00
Bo Yang 1f898f833d refactor: update agent workflow to use tool confirmation. Currently tests fail due to interruption not supported in llm agent as a node in a workflow.
Change-Id: I9d41ac107d61e38629d39899cb4893780eba003e
2026-04-06 14:42:49 -07:00