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
Refactor live inference to emit synthetic text events for output
transcriptions as they arrive (streaming), rather than accumulating all
transcriptions and appending a single synthetic event after the turn
completes. This preserves event ordering and enables downstream
consumers to process transcriptions incrementally.
Co-authored-by: Wenhua Zhang <wenhzhang@google.com>
Change-Id: Idca79968729f2145ebf1f1c993d79ab7f6a3bd78
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
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
Ensure both types of Copybara PR commits are correctly identified and parsed by checking author email, headers, and updated merge regex.
Change-Id: Ic0cc19f67a3db4637fa597702393a11802b3f9aa
Importing `ToolContext` at the top level in `base_tool.py` created a circular import cycle when `google.adk.tools.function_tool` was imported.
The cycle was: `base_tool` -> `tool_context` -> `CallbackContext` -> `agents` -> `BaseAgent` -> `Event` -> `LlmResponse` -> `LlmRequest` -> `BaseTool`.
Moving `ToolContext` to `TYPE_CHECKING` breaks this runtime cycle, using `from __future__ import annotations` to preserve type hints.
Change-Id: I34731f46cf5aa4665ad3c6604495ad5fd84f8aa5
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
In Gemini 3.1 live, LlmResponse packets sometimes contain only grounding metadata - don't skip these responses
Change-Id: I9e2c1080395588d61aefffd1b6570102930e1fe0
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
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
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
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
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
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 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
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 https://github.com/google/adk-python/issues/5766
Change-Id: I9469e03c72342730cd0a1418551305a5e8058f60
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
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
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
- 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