193 Commits

Author SHA1 Message Date
Max Ind 0684adf8e2 chore(deps): allow OpenTelemetry 1.43
Close #6421

Co-authored-by: Max Ind <maxind@google.com>
PiperOrigin-RevId: 966058940
2026-08-17 10:46:07 -07:00
Google Team Member 370027a770 feat: add spreadsheet mime types to load_artifact_tool
PiperOrigin-RevId: 964508802
2026-08-13 23:21:57 -07:00
arunpshankar 65234e761b fix: declare a2a-sdk[http-server] so the a2a extra can serve
Merge https://github.com/google/adk-python/pull/6671

PiperOrigin-RevId: 964381708
2026-08-13 17:25:22 -07:00
George Weale 957dc2bd9f fix: declare the redis extra that RedisSessionService asks for
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 964138210
2026-08-13 09:47:19 -07:00
George Weale ac717091f6 chore(deps)!: move pyarrow out of the gcp extra
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963655242
2026-08-12 14:17:19 -07:00
George Weale 1e051fc06f chore(deps): allow OpenTelemetry 1.43
Close #6421

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963558965
2026-08-12 11:22:18 -07:00
Max Ind f4fd7d5db9 test(telemetry): add property based tests for metrics export
Co-authored-by: Max Ind <maxind@google.com>
PiperOrigin-RevId: 962669975
2026-08-11 02:59:24 -07:00
George Weale f5c09dce11 fix: install every optional runtime dependency with the all extra
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 962408419
2026-08-10 15:42:39 -07:00
Xuan Yang 566fca3fa9 fix: Update CI workflow to use uv and adjust codespell configuration
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 960912014
2026-08-07 07:12:10 -07:00
Liang Wu 1a0c3bd49f fix(deps): exclude nltk 3.10.1, which breaks venvs living inside the working directory
nltk 3.10.1 added an import-time security hook (nltk/inisec.py) that breaks any
ADK code path reaching nltk, in two independent ways:

1. It installs a meta-path finder that raises ImportError for any module whose
   file resolves under the current working directory while an nltk frame is on
   the stack. The standard layout puts the virtualenv inside the project
   (.venv/), so every site-packages module nltk imports looks like a CWD hijack
   and a plain `import nltk` dies on `import regex`.

2. It calls os.environ.setdefault("PYTHONSAFEPATH", "1"), which leaks into every
   subprocess started afterwards. PYTHONSAFEPATH stops CPython from prepending
   the script/CWD entry to sys.path, and that prepend is what causes the eagerly
   created `google` namespace package (from google-cloud-aiplatform's legacy
   *-nspkg.pth) to recompute its __path__ and pick up src/google. Without it,
   `import google.adk` fails with ModuleNotFoundError in child interpreters.
   Note this happens even when the nltk import itself fails, because the hook
   installs before the failure, so catching the ImportError does not undo it.

Three extras reach nltk, and all three are constrained here:

  * eval       -> rouge-score -> nltk. Breaks final_response_match_v1,
                  response_evaluator, metric_evaluator_registry,
                  local_eval_service, the local eval sampler and the eval CLI.
  * extensions -> llama-index-{embeddings-google-genai,readers-file} ->
                  llama-index-core -> nltk. llama-index-core imports nltk
                  lazily, so `import llama_index.core` is fine, but the first
                  real sentence split (SentenceSplitter, reached through
                  FilesRetrieval -> VectorStoreIndex for any document larger
                  than one chunk) triggers it.
  * test       -> both of the above.

nltk reverted the hook upstream in nltk/nltk#3732, but that is not released yet
and 3.10.1 is not yanked, so resolvers keep selecting it. The `!=` form picks up
3.10.2 automatically once it ships.

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 959276418
2026-08-04 15:57:34 -07:00
George Weale 8806dc2bd8 perf: improve adk import loading
Importing google.adk eagerly pulled in Agent, Runner, Workflow, and the server
and CLI runtimes even for callers that used none of them, and google-genai
imported the MCP client and FastMCP server stack whenever MCP happened to be
installed. The package, agents, workflow, cli, and cli.utils namespaces now
resolve their exports lazily on first use (PEP 562) through a shared
google.adk.utils._lazy helper. Importing google.adk drops from roughly 2.1s to
a few ms.

Public APIs and object identities are unchanged, with two things to note when
upgrading:

* The google-genai floor moves from 2.9 to 2.12.1, the release that defers MCP
  itself. Environments pinned below 2.12.1 will fail to resolve.
* google.adk.cli.utils no longer re-exports BaseAgent and LlmAgent. They were
  unused eager imports, never part of that module's __all__; import them from
  google.adk.agents instead.

Lazy resolution moves failures from import time to first use, so a missing or
broken optional dependency now surfaces on the first request rather than at
process start. Long-running servers pay the one-time resolution cost on their
first request; a warmup hook is deliberately left to a follow-up so this change
adds no public API.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 956721154
2026-07-30 13:58:45 -07:00
George Weale 1b12ee39ab fix(deps): exclude LangGraph releases with unsafe checkpoint loading
Raise the `extensions` and `test` floors past the releases that reconstruct
arbitrary Python objects while deserializing checkpoint data: langgraph 1.0.10
(CVE-2026-28277) and langgraph-checkpoint 4.1.1 (CVE-2026-48775).
langgraph-checkpoint needs a pin of its own because even langgraph 1.2.9 only
requires `langgraph-checkpoint>=4.1.0,<5`.

Breaking change: LangGraph 0.x is no longer supported. The `extensions` extra
and `LangGraphAgent` now require 1.x.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 956648992
2026-07-30 11:45:15 -07:00
Fede Kamelhar 625ef1aa69 feat(integrations): add OCI Generative AI provider
Adds OCIGenAILlm under integrations/oci/, for Google Gemini and other models
hosted on Oracle Cloud Infrastructure Generative AI. Optional install:
pip install google-adk[oci]. LLMRegistry auto-routing and the
google.adk.models import surface are preserved.

The OpenAI-compatible transport from the source PR (OCIGenAIOpenAILlm) is
not taken. It reimplemented the message, tool and response conversion plus
the streaming loop that OpenAILlm already provides; the right form is a
small subclass overriding the OpenAI client, which cannot live in
integrations/ while OpenAILlm is still experimental. It can land separately
once that settles.

The OCI client is now built once per instance rather than per request, so a
call no longer re-reads the OCI config from disk.

Merge https://github.com/google/adk-python/pull/5285

Closes #5069

Co-authored-by: George Weale <gweale@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/5285 from fede-kamel:feat/oci-generative-ai 0230acc0a93b7e43014f2ef3a8b89de463a50bd8
PiperOrigin-RevId: 955453382
2026-07-28 13:56:27 -07:00
Stephen Allen 5091f0a65a feat(eval): Make live and audio evals reachable via public entrypoints
Merge https://github.com/google/adk-python/pull/6458

Live/audio agent eval was only exercisable through private internal service imports; the public surface (CLI, dev-server, AgentEvaluator) always ran non-live text inference, so users had no supported path to evaluate Live API agents with a simulated audio user.

This threads `use_live` through all three public entrypoints, fixes the live-send path so native-audio models accept simulated user audio, and lets the dev-server select an audio (`llm_audio`) user simulator over HTTP. Live transcriptions are consolidated to text, with the text response preferred as the gradable output for turns carrying both audio and a transcript.

Adds a runnable sample (`live_non_blocking_tool_agent` evalset + `test_config` with `use_live: true` and a Gemini TTS audio simulator) plus unit tests covering `use_live` propagation, request validation, resampling, and the realtime-audio send path.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6458 from allen-stephen:feat/live-eval-parity 3fc33a2616d1515c822387deb8d70c27d5bc6244
PiperOrigin-RevId: 954725627
2026-07-27 11:08:51 -07:00
Anas Khan 13e311b0e4 chore: add codespell pre-commit hook to catch typos
Merge https://github.com/google/adk-python/pull/6406

Add a codespell hook to catch typos automatically.
Fix existing typos flagged by codespell.

PiperOrigin-RevId: 952416492
2026-07-22 17:13:05 -07:00
Google Team Member 217a90a2e6 feat(eventarc): add Eventarc Advanced toolset for ADK
This adds a new integration for Google Cloud Eventarc Advanced.
Provides `eventarc_toolset` which allows LLM agents to publish structured
CloudEvents. It strictly validates and sanitizes attributes according to the
CloudEvents 1.0 specification and supports dynamically resolving fields like `time`
and `id` at runtime using lambdas.

Includes comprehensive testing and documentation.

PiperOrigin-RevId: 952384562
2026-07-22 16:04:53 -07:00
Shangjie Chen c4270203c6 fix: resolve tool confirmation resumption failure in production
Ensure requested tool confirmations are correctly serialized and
deserialized in the session service.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 951775012
2026-07-21 16:55:24 -07:00
George Weale 221bad92b8 fix: require starlette>=1.3.1 to clear known CVEs
The starlette lower bound allowed releases affected by CVE-2026-48710 and
related advisories. Raise the minimum to 1.3.1, which resolves them.

Close #6038

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 948661065
2026-07-15 18:34:40 -07:00
Google Team Member b46dd136aa feat: enable a2a-sdk 1.x by widening the dependency constraint
Widen the a2a-sdk dependency constraint to >=0.3.4,<2 (both the a2a and test
extras) and re-lock so the ADK A2A integration resolves to a2a-sdk 1.x by
default while still supporting 0.3.x. The dual-version CI added in the parent
change keeps the compatibility shim verified against both SDK majors.

PiperOrigin-RevId: 945017973
2026-07-09 03:36:17 -07:00
Xuan Yang 5301ffa2c7 fix: Address mypy failures in google_api_tool/
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 943533056
2026-07-06 15:42:41 -07:00
Xuan Yang df6baf4acf feat(integrations): Add DaytonaEnvironment for remote sandbox workspaces
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 941353505
2026-07-01 16:27:10 -07:00
George Weale 391101050e chore: re-enable and fix the mypy delta presubmit
Scope the delta check to the files the CL changed via the kokoro
presubmit_request, and decouple the workspace copy so mypy module
resolution is stable.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 941321034
2026-07-01 15:16:20 -07:00
Anwesha Das 14a24f2bee feat(bigtable): Support parameterized views with secure parameter inj…
Merge https://github.com/google/adk-python/pull/6128

…ection

Expose a parameterized query tool execute_sql_parameterized that automatically maps and injects secure parameters (like user_id) from the tool context to Bigtable's view_parameters.

**Please ensure you have read the [contribution guide](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) before creating a pull request.**

### Link to Issue or Description of Change

**1. Link to an existing issue (if applicable):**

- Closes: #_issue_number_
- Related: #_issue_number_

**2. Or, if no issue exists, describe the change:**

_If applicable, please follow the issue templates to provide as much detail as
possible._

**Problem:**
_A clear and concise description of what the problem is._

**Solution:**
_A clear and concise description of what you want to happen and why you choose
this solution._

### Testing Plan

_Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes._

**Unit Tests:**

- [ ] I have added or updated unit tests for my change.
- [ ] All unit tests pass locally.

_Please include a summary of passed `pytest` results._

**Manual End-to-End (E2E) Tests:**

_Please provide instructions on how to manually test your changes, including any
necessary setup or configuration. Please provide logs or screenshots to help
reviewers better understand the fix._

### Checklist

- [ ] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document.
- [ ] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] New and existing unit tests pass locally with my changes.
- [ ] I have manually tested my changes end-to-end.
- [ ] Any dependent changes have been merged and published in downstream modules.

### Additional context

_Add any other context or screenshots about the feature request here._

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6128 from ad548:feat/bigtable-parameterized-views f5902fd7ef834f326a43c7c01990d0648e7ec06c
PiperOrigin-RevId: 941207338
2026-07-01 11:33:38 -07:00
Google Team Member 400f512d81 perf: avoid deepcopy of session contents when building LLM requests
`_get_contents` deep-copied `event.content` for every event on every LLM
request, just to strip ADK-generated (`adk-` prefixed) function call/response
ids and to isolate the contents from downstream request processors that mutate
parts in place (e.g. nl_planning clearing `part.thought`, code_execution
rewriting parts). The deepcopy recursed into large
`function_call.args`/`inline_data` payloads, and cost grew with conversation
length (a dominant non-LLM CPU sink in profiling, ~4-7s of a ~30s run).

Replace it with a shallow copy: the `Content` and every `Part` are
`model_copy`-d (so downstream in-place mutations stay isolated from session
events), but the payloads (`args`/`response`/`inline_data`/...) are shared by
reference instead of deep-copied.

Adds regression tests (id stripping and downstream-mutation isolation) and a
google_benchmark perf script.

Benchmark (_get_contents over a 500-turn history, ~23x):

Before (copy.deepcopy):
  -------------------------------------------------------
  Benchmark             Time             CPU   Iterations
  -------------------------------------------------------
  get_contents  781559706 ns    781443557 ns            1

After (per-part shallow copy):
  -------------------------------------------------------
  Benchmark             Time             CPU   Iterations
  -------------------------------------------------------
  get_contents   33996069 ns     33987197 ns           20

PiperOrigin-RevId: 940664677
2026-06-30 14:36:32 -07:00
Liang Wu e470548f4f chore: Remove related configurations for google/adk/v1 directory
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 940534734
2026-06-30 10:41:50 -07:00
George Weale 6b831d5aa0 feat: add OpenAI Responses API support in labs
Add OpenAIResponsesLlm and AzureOpenAIResponsesLlm under labs.openai, a
BaseLlm targeting the OpenAI Responses API: request/response/streaming
conversion, reasoning summaries, structured output, tool mapping, and
usage metadata.

Merge https://github.com/google/adk-python/pull/6188
Closes #3209

Co-authored-by: Luca Frigato <37444661+FrigaZzz@users.noreply.github.com>

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 938272066
2026-06-25 17:11:21 -07:00
Adil Burak Şen 0a9ce0f691 fix: harden ContainerCodeExecutor sandbox by default
Merge https://github.com/google/adk-python/pull/6074

## Summary

`ContainerCodeExecutor` runs model-generated code, which can be influenced by untrusted input (e.g. via prompt injection). It starts the container with default Docker networking and no capability restrictions, so the executed code can reach the cloud metadata endpoint (`169.254.169.254`) — which yields the host service-account token — reach internal services, or escalate privileges.

This is inconsistent with the isolation posture of every other ADK code executor:

- `GkeCodeExecutor` runs under gVisor with `cap_drop: ["ALL"]`, non-root, read-only root filesystem, and a strict security context.
- `BuiltInCodeExecutor` / `VertexAiCodeExecutor` / `AgentEngineSandboxCodeExecutor` run in managed server-side sandboxes.
- `UnsafeLocalCodeExecutor` is explicitly documented as unsafe.

`ContainerCodeExecutor` was the only executor running code with full network access and no isolation flags or warning.

## Change

- Start the container with networking disabled by default. This is exposed as a configurable `network_enabled` field — set it to `True` to re-enable networking when the executed code is trusted.
- Drop all Linux capabilities (`cap_drop=["ALL"]`) and forbid privilege escalation (`security_opt=["no-new-privileges"]`), matching `GkeCodeExecutor`.
- Document the security posture in the class docstring and point users to the sandboxed executors for untrusted code.
- Add unit tests covering the hardened defaults and the opt-in network path.

## Compatibility

Code that legitimately needs network access can opt back in with `ContainerCodeExecutor(..., network_enabled=True)`. Dropping capabilities and `no-new-privileges` do not affect normal Python code execution.

Co-authored-by: George Weale <gweale@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6074 from adilburaksen:harden/container-code-executor-network f7eaec252d2369d710eb54ea6c51b2bc4e525e7a
PiperOrigin-RevId: 938260811
2026-06-25 16:41:40 -07:00
Google Team Member a912306ad7 fix: update litellm dependency constraint to >=1.84.0
This change relaxes the litellm dependency pin from >=1.83.7,<=1.83.14 to
>=1.84.0. This resolves a critical security vulnerability (CVE-2026-49468)
by allowing upgrades to safe releases.

PiperOrigin-RevId: 937679582
2026-06-24 18:42:49 -07:00
George Weale 9f3aeef55d fix: adapt interactions conversion to google-genai 2.9 SDK changes
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 936123710
2026-06-22 10:20:01 -07:00
brucearctor d9f189c7a3 fix: improve error message when beautifulsoup4/lxml not installed for load_web_page
Merge https://github.com/google/adk-python/pull/4853

## Description

The built-in `load_web_page` tool requires `beautifulsoup4` and `lxml`, which are available via the `[extensions]` optional dependency group. When a user installs `google-adk` without the `[extensions]` extra and calls `load_web_page`, they get a raw `ModuleNotFoundError: No module named 'bs4'` with no guidance on how to resolve it.

This change wraps the deferred imports in a `try/except` to provide a clear, actionable error message:

```
ImportError: load_web_page requires the "beautifulsoup4" and "lxml" packages.
Install them with: pip install google-adk[extensions]
```

Fixes #4852

Co-authored-by: Liang Wu <wuliang@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4853 from brucearctor:fix/load-web-page-import-error 27aa20eb54d9b408e02a502ffd9ca0825e498cf6
PiperOrigin-RevId: 933416379
2026-06-16 18:46:20 -07:00
Wei (Jack) Sun 2b8c80c1e3 fix(deps): Require otel google-genai instrumentor >=0.7b1 for genai 2.x
Merge https://github.com/google/adk-python/pull/6102

## Summary

Bump the floor on `opentelemetry-instrumentation-google-genai` from `>=0.6b0` / `>=0.3b0` to `>=0.7b1` in both the `otel-gcp` and `test` extras, so it is compatible with the pinned `google-genai>=2.8,<3`.

## Problem

`opentelemetry-instrumentation-google-genai` versions before `0.7b1` hardcode a runtime gate in `instrumentation_dependencies()`:

```python
return ["google-genai>=1.0.0,<2"]
```

This `<2` cap is **not** in the package metadata (which only declares `google-genai>=1.0.0`), so dependency resolvers happily install e.g. `0.7b0` alongside `google-genai 2.8.0`. The conflict only surfaces at runtime: `instrumentor.instrument()` detects the violation, logs a `DependencyConflict`, and **silently no-ops** — `Models.generate_content` is never wrapped, so genai telemetry is disabled entirely with no hard error.

This was caught by `tests/unittests/telemetry/test_functional.py::test_instrumented_with_opentelemetry_instrumentation_google_genai`, which fails with `assert False` when a pre-`0.7b1` instrumentor is resolved (the post-`instrument()` assertion that the SDK reports as instrumented).

## Fix

`0.7b1` widens the gate to `google-genai>=1.0.0,<3`, which `2.8.0` satisfies. The existing floors allowed resolvers to land on a broken version; raising both to `>=0.7b1` makes the requirement consistent with the genai 2.8 pin and fail-safe.

## Impact

- Restores google-genai OTel instrumentation for users on genai 2.x with the `otel-gcp` extra.
- Prevents the test suite from resolving a broken instrumentor.

## Test plan

- [x] `uv.lock` already resolved to `0.7b1`; no lockfile change needed (only the specifier floor moved).
- [x] `tests/unittests/telemetry/test_functional.py`: 6 passed (previously 1 failed: `test_instrumented_...`).
- [x] pre-commit (`pyproject-fmt`) passes.

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6102 from google:fix/otel-genai-instrumentor-floor 8e2154fb72939d1f2dbbc9db2fb9597d10e3b2c2
PiperOrigin-RevId: 931465846
2026-06-12 20:17:51 -07:00
Max Ind fe04513985 test(otel): Expand functional tests for telemetry to include logs
Tangential changes include:
- Including `parameters_json_schema` in experimental semconv tool
  definitions
- Narrowing dependency on OTel libraries to:
  - >= 1.39, because it removed the deprecated logging APIs
  - <= 1.42.1, because it's the latest OTel version

Co-authored-by: Max Ind <maxind@google.com>
PiperOrigin-RevId: 931355343
2026-06-12 15:11:49 -07:00
Wei (Jack) Sun 7cae06e001 chore: Adopt ruff for unused-import enforcement
Merge https://github.com/google/adk-python/pull/6097

## Summary

Adopts **ruff** to enforce unused-import (F401) hygiene going forward, so dead imports are caught automatically instead of relying on IDE highlights. (The bulk one-time cleanup already landed in #6095; this is just the tooling.)

- `[tool.ruff]` in `pyproject.toml`: select `F401`, exempt `__init__.py` (intentional public re-exports), and exclude four files that hardcode `googleapis.com` URLs so cleanup doesn't trip the `check-file-contents` mTLS policy.
- ruff pre-commit hook scoped to `src/`.
- `scripts/run_precommit_checks.py` (the no-git standalone runner) learns the ruff hook, passing `--force-exclude` so excludes are honored on explicit file args.
- Pin `ruff` in the dev extra to match the hook version.

## Test plan

- [x] `ruff check src/` passes (excludes honored)
- [x] pre-commit ruff hook runs green
- [x] standalone runner check/fix modes verified

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6097 from google:chore/adopt-ruff-f401 b0636523926d02f12af4b86cff2b1a1bb94af150
PiperOrigin-RevId: 931304052
2026-06-12 13:28:02 -07:00
Wei (Jack) Sun b170f7bdf5 chore(dev): add standalone pre-commit check script
Merge https://github.com/google/adk-python/pull/6084

## Summary

Adds `scripts/run_precommit_checks.py` to run the `.pre-commit-config.yaml` checks **without** the `pre-commit` framework, which requires a git repository and so cannot run in environments such as a piper checkout that has no `.git`.

- Parses `.pre-commit-config.yaml` so the file lists, global/per-hook `exclude` and `files` patterns, and `args` all come from the config — only the hook-id → CLI command mapping (and each hook's implicit file-type/text filter) is maintained in the script.
- Defaults to fixing in place; pass `--check` to verify only (CI behavior).
- Limits the walk to `src`/`tests`/`contributing`/`pyproject.toml` and never follows symlinks, so `.venv`, build artifacts, and out-of-repo code (e.g. a symlinked `a2a`) are never touched.
- Skips binary files for text fixers, and batches arguments to stay under the OS arg limit.
- `scripts/run_precommit.sh` is a thin wrapper that prefers an already-synced interpreter (`.venv` / active venv) before falling back to `uv run`.
- Adds the standalone lint tools to the `dev` extra (capped at the next major) so `uv sync --extra dev` provides everything the script needs.

## Test plan

- [ ] `scripts/run_precommit.sh --check` passes on a clean tree
- [ ] `scripts/run_precommit.sh` (default fix mode) does not modify binaries (images/PDFs) or `.venv`
- [ ] Runs from any directory; PATH args are repo-root-relative
- [ ] `addlicense` / `check-new-py-prefix` degrade gracefully when unavailable / git-only

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6084 from google:chore/dev-precommit-script fa3863332f9acf824df2a3ad3b923141d7838f5d
PiperOrigin-RevId: 930799785
2026-06-11 16:27:47 -07:00
Stephen Allen 463040fdca feat(live): support Live API translation config in RunConfig
Merge https://github.com/google/adk-python/pull/6083

### Link to Issue or Description of Change

Add support for live translation with the Live API -> https://ai.google.dev/gemini-api/docs/live-api/live-translate

### Testing Plan

**Unit Tests:**

- [X] I have added or updated unit tests for my change.
- [X] All unit tests pass locally.

### 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 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.
- [X] Any dependent changes have been merged and published in downstream modules.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6083 from allen-stephen:feat/enable-live-translate 6a0f5b7525bfc985f51b25e2d7f12a55ca14b75d
PiperOrigin-RevId: 930782786
2026-06-11 15:52:05 -07:00
Wei (Jack) Sun 4cb27fd42e feat(labs): add experimental Antigravity SDK agent wrapper
Merge https://github.com/google/adk-python/pull/6040

## Summary

Introduces `google.adk.labs.antigravity` with `AntigravityAgent`, a `BaseAgent` that runs a Google Antigravity SDK agent (described by an `AgentConfig`) as a native ADK root agent. Lives under `labs/` as an experimental feature.

- Delegates each turn to a fresh SDK `Agent` and maps trajectory steps to ADK events: model text, function calls/responses, and SSE-gated partial thinking/text deltas.
- Folder-based session resumption via `config.save_dir`: renames the harness trajectory to a deterministic per-session name and skips replayed steps using a persisted resume step index.
- Restricted to standalone root use (local mode only) with construction-time guards (cannot be a sub-agent or have sub-agents).
- `serialize_agent` now honors `Field(exclude=True)` so the non-serializable `config` does not break the `build_graph` endpoint.
- Adds the `[antigravity]` optional extra (in both the extra and `test` groups, with `uv.lock` updated), a game-developer sample, package README, and unit tests.

## Test plan

- [ ] `pytest tests/unittests/labs/antigravity/` (22 unit tests pass)
- [ ] `pytest tests/unittests/cli/utils/test_graph_serialization.py`
- [ ] Manual: run the sample via `adk web` with `GEMINI_API_KEY` and a `[antigravity]` install, confirm multi-turn resumption and no duplicate events.

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6040 from google:feat/antigravity-agent 304f6ad4d1e9edc414a28aa01eb77028519de11a
PiperOrigin-RevId: 930712984
2026-06-11 13:42:11 -07:00
Google Team Member ea474e6054 chore: Add new dependency for the Agent Identity feature
PiperOrigin-RevId: 930299067
2026-06-10 22:56:32 -07:00
Google Team Member 0856093a47 fix: Move google-cloud-parametermanager to optional dependencies
PiperOrigin-RevId: 929910495
2026-06-10 09:44:45 -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
George Weale ffa057c112 feat: Add --trigger_sources and ADK service options to cli_deploy_agent_engine
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/5960 from google:adk-api-server 28b12358b702154b35f9e88325c8240e1d947930

Change-Id: If1e5374682468dd1f4d9a11983bcf0f830418ffd
2026-06-04 17:46:19 +00:00
Luis Tomas Bolivar 81add3987a fix(deps): bump starlette and fastapi to address CVE-2026-48710
Starlette prior to 1.0.1 did not validate the HTTP Host header before
reconstructing request.url, allowing a malformed header to bypass
security restrictions based on request.url.path. Bump starlette to
>=1.0.1 and fastapi to >=0.133.0 (the minimum version compatible with
starlette >=1.0.1).

Fixes #5893

Merge https://github.com/google/adk-python/pull/5894

Change-Id: If7743e53d95740452c9e562e9bba98d132ae049e
2026-05-29 14:41:38 -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
Sasha Sobran 5f91a9db03 fix: lazy-import GCS evaluation managers in evals utility
Fixes https://github.com/google/adk-python/issues/5787

Change-Id: I0aadfb11fedc49c1d45d4fcd9f89087c27a0e6ea
2026-05-22 09:50:10 -07:00
Sasha Sobran 57d677c5cd fix(cli): Inform user to install optional dependency on missing google.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 https://github.com/google/adk-python/issues/5766

Change-Id: I9469e03c72342730cd0a1418551305a5e8058f60
2026-05-20 16:04:21 +00:00
Sasha Sobran e6537decc9 chore(release): configure release-please for v2.0.0 GA
Change-Id: If39d565130df657d08e4367394c33771e68ad364
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
Google Team Member 03b915b1bd fix(anthropic): map negative thinking_budget to adaptive thinking
- 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
2026-05-18 15:12:26 -07:00
George Weale f5b765d608 chore(build): exclude nested README.md files from sdist packaging
This ensures that adding README.md files to subdirectories (as discussed
for new folders and integrations) won't result in them being included in
the published package.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 916075206
2026-05-15 10:36:36 -07:00
Sasha Sobran 4a786abcf9 chore: bump OpenTelemetry to allow >=1.39 and fix load_web_page test
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 908322085
2026-04-30 12:40:52 -07:00
Casey West 6d2ada8bbc fix(deps): bump litellm cap to >=1.83.7 to admit CVE patches
Merge https://github.com/google/adk-python/pull/5489

Closes #5488

## Summary

Bumps the `litellm` constraint from `<=1.82.6` to `>=1.83.7,<=1.83.14`
in both the base project dependencies and the `[test]` extras.

The current cap was added in
[`77f1c41`](https://github.com/google/adk-python/commit/77f1c41) to
exclude the March 2026 supply-chain compromise of litellm 1.82.7
and 1.82.8. Since then, **five CVEs have been disclosed against
litellm `<=1.82.6`** (2 critical, 3 high), with patches in 1.83.0
and 1.83.7. The new lower bound (1.83.7) is strictly above the
originally compromised versions, so the original concern is still
respected.

The upper bound is pinned to the current latest release on PyPI
(1.83.14) per reviewer request, mirroring the project's prior
exact-version cap pattern. New litellm releases will require an
explicit ADK PR to admit, the same way `<=1.82.6` did.

Full CVE list and rationale in the linked issue (#5488).

## Diff

Two identical edits, one in project deps (line 126) and one in
`[test]` extras (line 145):

```diff
- "litellm>=1.75.5,<=1.82.6",                                        # ... supply chain attack ...
+ "litellm>=1.83.7,<=1.83.14",                                       # For LiteLlm class. Lower bound: 5 CVE patches (2026-04). Upper bound pinned to current latest; bump deliberately. See #5488.
```

## Testing plan

1. Re-installed `google-adk` (editable) against the updated
   constraint; pip resolved litellm to 1.83.13 (latest stable
   compatible with the rest of the lockfile, inside the new
   `[1.83.7, 1.83.14]` window).
2. Ran `tests/unittests/models/test_litellm.py` and
   `tests/unittests/models/test_litellm_import.py`; **all 259
   tests pass**. Output below.
3. Verified `pyproject.toml` is parseable as TOML.

### Upstream litellm test output

```
collected 259 items

tests/unittests/models/test_litellm.py ................................. [ 12%]
........................................................................ [ 40%]
........................................................................ [ 68%]
........................................................................ [ 96%]
.......                                                                  [ 98%]
tests/unittests/models/test_litellm_import.py ...                        [100%]

============================= 259 passed in 6.57s ==============================
```

## Heads up: litellm hard-pins python-dotenv

While verifying, we discovered that **litellm 1.83.7 (and every
subsequent version through 1.83.14) hard-pins
`python-dotenv==1.0.1`** as an unconditional core dependency. By
contrast, litellm 1.82.6 declared `python-dotenv>=0.2.0` (loose).

This does **not** affect adk-python itself -- ADK declares
`python-dotenv>=1,<2`, which admits `1.0.1` cleanly. But any
downstream project that has tightened `python-dotenv` (e.g.
`>=1.2.x`) will hit a resolver conflict after this bump and may
need to either relax its python-dotenv constraint or apply a
package-manager override. This is a litellm anti-pattern, not an
ADK problem; included here so reviewers know to expect downstream
issues of that shape.

## Out of scope

`langgraph` has a similar dep cap (`<0.4.8`) and one
medium-severity CVE
([GHSA-g48c-2wqr-h844](https://github.com/advisories/GHSA-g48c-2wqr-h844)),
but bumping past 0.4.x requires porting ADK's use of the removed
`graph.graph` API (per
[#1687](https://github.com/google/adk-python/pull/1687)). That is
real engineering work, not a dep cap bump, and is left as a
separate effort.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/5489 from cwest:topic/bump-litellm-cap 559f0c2ee9d1e911bcc83832d4dee9ccbafa5c12
PiperOrigin-RevId: 906979886
2026-04-28 08:00:31 -07:00