3741 Commits

Author SHA1 Message Date
adk-bot 25e8ea6dea chore: update last-release-sha for next main release v2.7.0 2026-08-13 22:13:22 +00:00
adk-bot d84f8efcf3 chore(release/candidate): release 2.7.0 (#6700)
Co-authored-by: George Weale <51099682+GWeale@users.noreply.github.com>
2026-08-13 15:13:09 -07:00
George Weale 0a9db2bbad Sync release/candidate with main for the 2.7.0 release
Picks up the DNS rebinding guard on the local API server and media in tool
responses for non-Gemini models, both of which landed after the first sync.
2026-08-13 21:58:10 +00:00
George Weale 703cf43f6b fix: send media attached to a tool response to non-Gemini models
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 964308319
2026-08-13 14:52:48 -07:00
Kathy Wu 2cf4fd1ddc fix: guard reads in the local API server against DNS rebinding
_OriginCheckMiddleware returned early for GET/HEAD/OPTIONS, and again whenever a
request carried no Origin, so only writes were validated. Every read endpoint of
`adk web` / `adk api_server` was served to a page that reached the server by
rebinding a hostname to 127.0.0.1.

Origin cannot close that, because browsers omit it on requests they consider
same-origin, as they do a rebound page's. So check Host on every request: a
loopback bind is reachable only from this machine, so a request naming any other
host was pointed here by rebound DNS. Only the real Host header counts, since it
is a forbidden request header whereas a same-origin fetch() can set
X-Forwarded-Host or Forwarded freely. The safe-method exemption is gone, and the
/run_live handshake gets the same check.

Serving another hostname from a loopback bind now means naming it in
--allow_origins, which vouches for that origin's host rather than switching the
guard off; only "*" opts out entirely.

Both checks key off the bind address instead of scope["server"] - ASGI servers
fill that from the accepted socket, so a --host=0.0.0.0 server reports 127.0.0.1
for any loopback connection and looked local-only behind a same-machine proxy.
The bind arrives through a new get_fast_api_app(bind_host=...) that the CLI
passes. The existing host parameter keeps its 127.0.0.1 default and its meaning:
an embedder that binds elsewhere without passing it would otherwise have the
guard keyed to a loopback bind it does not have, and reject all of its own
traffic.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 964277197
2026-08-13 13:57:33 -07:00
George Weale 91c5a35493 Sync release/candidate with main for the 2.7.0 release
The candidate was cut yesterday and the release slipped a day, so it no
longer carried everything on main. This takes main's tree wholesale and
keeps the Release-As footer that pins the version to 2.7.0.
2026-08-13 18:35:08 +00:00
George Weale 0730d73cb1 fix: stop request assembly writing into the agent's own config
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 964167909
2026-08-13 10:38:23 -07:00
Haran Rajkumar 8f6d61b26b refactor: add an overridable seam for the SDK Agent class in AntigravityAgent
_run_async_impl hard-coded the module-global `Agent`, so the class a turn runs
on could only be changed by patching the module. A `_sdk_agent_cls` property
names it instead, resolved per access.

Behaviour is unchanged: the property returns the same global, and the eight
existing tests that patch `_antigravity_agent.Agent` pass untouched. A property
rather than a ClassVar precisely so that stays true -- a ClassVar default binds
at class-creation time and would have broken all eight.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 964166386
2026-08-13 10:35:11 -07:00
Bo Yang 19c9455b7e chore: Add content from 1.x back to 2.x README.md
Also updated the ADK web screenshot and added a video demo link.

Co-authored-by: Bo Yang <ybo@google.com>
PiperOrigin-RevId: 964158202
2026-08-13 10:20:23 -07:00
George Weale ae5118d5b2 fix: keep subpackages reachable as attributes of a lazy package
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 964141603
2026-08-13 09:53:45 -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 fd44a633d6 fix: redact credential values from auto-tracing span attributes
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 964126426
2026-08-13 09:25:27 -07:00
George Weale 1b8ed3d9c0 fix(sessions): store and filter event timestamps in UTC
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 964115445
2026-08-13 09:02:37 -07:00
Luyang Wang 84c7711052 fix: scope skip_summarization text-append to AgentTool
Merge https://github.com/google/adk-python/pull/6231

Scope the skip_summarization text-append to AgentTool. This prevents other tools that set skip_summarization (like UI tools) from having their internal acknowledgements surfaced as visible text.

Fixes #6230

PiperOrigin-RevId: 964110832
2026-08-13 08:52:34 -07:00
Milen Kovachev a3bd11152d feat(eventarc): Support Context callables and correct OMIT behavior
Merge https://github.com/google/adk-python/pull/6600

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

- Related: google/adk-docs\#2045 (Addresses technical verification feedback in [https://github.com/google/adk-docs/pull/2045\#issuecomment-5184438669](https://github.com/google/adk-docs/pull/2045#issuecomment-5184438669))

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

**Problem:**

1. Callable attribute bindings in `CloudEventAttributesBinding` were always evaluated against the event `payload`. This prevented developers from correlating CloudEvents with ADK runtime telemetry (such as session IDs or invocation IDs from `Context`).
2. Setting `time=OMIT` or `datacontenttype=OMIT` in `CloudEventAttributesBinding` skipped adding keyword arguments when calling `publish_message`. Because `publish_message` auto-generates default UTC timestamps and content types when arguments are `None` or omitted, `time=OMIT` generated a timestamp instead of omitting the header.
3. Sample READMEs omitted the required `pip install "google-adk[gcp]"` prerequisite step needed for Eventarc publishing.

**Solution:**

1. Added automatic signature inspection (`0-arg`, `1-arg`, and `2-arg` callables) to `CloudEventAttributesBinding` so callables can receive the event `payload`, the runtime `Context` (`tool_context`), or both, while preserving full backward compatibility with existing payload callbacks.
2. Setting `time=OMIT` or `datacontenttype=OMIT` now explicitly passes empty string (`""`) to `publish_message` so attributes are omitted from published CloudEvents. Explicitly setting required CloudEvent specification headers (`id=OMIT`, `specversion=OMIT`) now raises a `TypeError` at tool build time.
3. Updated sample agents and sample READMEs (`domain_specific_agent` and `generic_agent`) to demonstrate `Context` callables, `time=OMIT`, and GCP extra prerequisites.

### Testing Plan

**Unit Tests:**

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

Summary of passed `pytest` results:

```
uv run --all-extras pytest tests/unittests/integrations/eventarc -v

======================== 63 passed, 4 warnings, 13 subtests passed in 3.14s ========================
```

- Added `test_runtime_execution_with_context_and_payload_lambdas` to verify 1-parameter (`payload` or `Context`) and 2-parameter callables.
- Added `test_time_and_datacontenttype_omit_pass_empty_string` to verify omission of `time` and `datacontenttype`.
- Added `test_id_and_specversion_omit_raise_typeerror` to verify static validation against omitting mandatory CloudEvent specification headers.

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

- Verified that sample agent tools in `contributing/samples/integrations/eventarc/domain_specific_agent/agent.py` build and run correctly.
- Confirmed that `complete_outreach_lambda_tool` correctly injects `Context.session_id` into the event source and that `ping_system_tool` emits events without a timestamp header when configured with `time=OMIT`.

### 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.

Additional context

Addresses the technical verification report on google/adk-docs#2045 comment.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6600 from milenvk:main 647744f65452358842982b4d88cd1401d4143c42
PiperOrigin-RevId: 964084439
2026-08-13 07:55:56 -07:00
Google Team Member bddbb3dd8c feat(telemetry): Expand load_skill telemetry
Extend the `execute_tool load_skill` span by adding new skill-related attributes. Adds new experimental attributes, and new namespace for them.

PiperOrigin-RevId: 964033870
2026-08-13 05:55:48 -07:00
Anas Khan 2e878ed412 fix: read and write eval data files as utf-8
Merge https://github.com/google/adk-python/pull/6298

PiperOrigin-RevId: 963885296
2026-08-12 23:49:35 -07:00
Come Arvis 18903cadb5 fix: allow injecting credentials into VertexAiMemoryBankService
Merge https://github.com/google/adk-python/pull/6693

PiperOrigin-RevId: 963768584
2026-08-12 18:14:06 -07:00
George Weale f57a67d638 fix: bound Apigee completions HTTP client timeout and redirects
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963758853
2026-08-12 17:50:06 -07:00
Yifan Wang b795a9ba86 fix: disable dev endpoints for production deployment both AE and Cloud Run
Co-authored-by: Yifan Wang <wanyif@google.com>
PiperOrigin-RevId: 963741876
2026-08-12 17:10:27 -07:00
George Weale 29933ce422 chore: rewrite the open source agent skills to the skill authoring standard
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963738635
2026-08-12 17:03:29 -07:00
George Weale d42e222c4f perf: drop use_attribute_docstrings from LlmCapabilities
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963727860
2026-08-12 16:39:28 -07:00
George Weale c44c543e93 fix(deps): stop the published constraints from pinning google-adk itself
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963725078
2026-08-12 16:34:06 -07:00
George Weale efeec703da fix(eval): fail the eval when an agent crashes before any metric runs
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963724473
2026-08-12 16:33:05 -07:00
George Weale 308c818867 fix: make parallel worker failure propagation test deterministic
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963724202
2026-08-12 16:31:58 -07:00
George Weale d24ec83ccd docs: add App unit guide
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963717883
2026-08-12 16:19:40 -07:00
George Weale be103fbd2f fix: keep preloaded context turn-scoped
PreloadMemoryTool appended recalled memory to system_instruction, but explicit caches fingerprint and store that system prefix, so memory picked for one query could destabilize cache identity or stick to a reusable prefix on later turns. This inserts recalled memory into the trailing user-context batch for the current request instead, which the cache manager already excludes, through one typed internal LlmRequest seam that dynamic user instructions also reuse.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963713313
2026-08-12 16:11:36 -07:00
George Weale 3f3c8f527d fix(auth): set a request timeout on OAuth2 token exchange and refresh
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963712946
2026-08-12 16:10:26 -07:00
George Weale 5a2a59b74f docs: add session State unit guide
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963711846
2026-08-12 16:07:55 -07:00
George Weale 78a4ee2c69 docs: add tool authentication unit guide
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963703932
2026-08-12 15:52:46 -07:00
George Weale e22b75aac1 chore: release this candidate as 2.7.0
The only breaking marker in this range is a packaging change: pyarrow moved
out of the gcp extra into a new bigquery-analytics extra. Users keep their
>=2,<3 pins, and the artifact check keeps a baseline to compare against.

Release-As: 2.7.0
2026-08-12 22:46:32 +00:00
George Weale 2716ad55b8 fix(artifacts): reject rooted, drive-qualified and traversing artifact paths
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963696345
2026-08-12 15:35:50 -07:00
Adnan Vahora 0897bee6a0 fix(flows): inject transfer_to_agent tool for HITL confirmation resume
Merge https://github.com/google/adk-python/pull/5669

Closes #5633

Co-authored-by: George Weale <gweale@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/5669 from settler-av:fix/transfer-to-agent-confirmation 91a210dd7cd5b1dcbc5a98c7c5068c73701d6325
PiperOrigin-RevId: 963694454
2026-08-12 15:33:19 -07:00
chelsealong 374aab372a fix: add .adk/ to the .gitignore generated by adk create
Merge https://github.com/google/adk-python/pull/6649

Fixes #6647

PiperOrigin-RevId: 963678453
2026-08-12 15:00:36 -07:00
George Weale 4da8dd7f8b fix: lower oneOf to anyOf so a union schema reaches Gemini intact
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963674878
2026-08-12 14:53:18 -07:00
George Weale b8c099d37f docs: add artifact service unit guide
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963673192
2026-08-12 14:50:26 -07:00
George Weale cf42e866cd fix(samples): fail the maintenance run when issue discovery dies mid-page
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963672754
2026-08-12 14:49:15 -07:00
Shangjie Chen d64f1afb62 docs: add a test-file placement rule to the testing style guide
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 963670995
2026-08-12 14:46:05 -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 22f55462fd fix: lift file references and nested parts out of tool results
Close #2577

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963644081
2026-08-12 13:57:24 -07:00
George Weale a5f02820f0 chore: cover the pre-commit runner's handling of a missing hook tool
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963643310
2026-08-12 13:56:31 -07:00
Jason Zhang b0fff3f02d fix: validate urls before computer use navigate opens them
ComputerUseToolset passed the url the model supplied straight to the
browser driver, without checking it. Now navigate runs the same checks
load_web_page does. A url that fails returns an error to the model
instead of reaching the driver.

If the agent is meant to drive the browser against an internal host,
pass allow_private_network_access=True

Co-authored-by: Jason Zhang <jasoncz@google.com>
PiperOrigin-RevId: 963643277
2026-08-12 13:55:35 -07:00
George Weale 64dddf2bf3 fix(samples): repair integrations samples that no longer run against the current API
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963642287
2026-08-12 13:53:54 -07:00
George Weale fbeab00010 fix(memory): scope Vertex RAG retrieval to the requesting app and user
VertexAiRagMemoryService ran top-k retrieval across the whole configured
corpus and dropped the other tenants' contexts afterwards. The response filter
made the result correct, but ranking still competed against every app and user
in the corpus, so a busy corpus could crowd a caller's own memories out of the
top-k entirely, and foreign context was transferred only to be discarded. This
is a recall and data transfer problem, not a disclosure one: no memory
belonging to another app or user was ever returned to the caller.

search_memory now lists the corpus, keeps the files whose display name names
the requesting app and user, and passes those file ids to VertexRagStore so
ranking happens inside that set. When the caller owns no files, retrieval is
skipped and an empty response is returned. Callers can now see memories that
the previous ranking crowded out, so result counts can go up.

Scoping is best effort and adds no permission requirement, but it does add up
to 10 list calls to each search. Those calls run on the SDK async surface, so
they are awaited rather than blocking the event loop. Scoping is abandoned,
rather than applied to the files listed so far, whenever the listing cannot be
completed: either a listing failure, such as a deployment whose credentials
can retrieve but not list, or a corpus larger than the roughly 1000 files that
page budget covers. Retrieval then runs unscoped exactly as it did before,
which the response filter still makes correct, and the reason is logged.
Applying a partial listing would instead hide the caller's own memories.
Corpora past that size therefore keep the old ranking behavior permanently.

Server-side metadata filtering was considered and rejected: it matches on the
RagFile user_metadata field, which is output only on uploaded files and which
this service has never populated, so it would exclude every memory already
stored.

No public interface changes.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963641027
2026-08-12 13:51:53 -07:00
Shangjie Chen 1ad05439e0 fix(adk): share a single component-owner map between the triaging agents
The PR and issue triaging agents each kept their own copy of the component
-> owner map and they had drifted: the PR agent was missing several
components (skills, auth, bq, cli, integrations, workflow), and its
ALLOWED_LABELS gate -- which controls what the agent may apply -- was also
stale, so those labels could be neither applied nor assigned (a skills PR
was labeled "core" and assigned to the wrong owner).

Move the map into component_owners.py as the single source of truth and
import it verbatim as LABEL_TO_OWNER in both agents, so the two are always
identical and cannot drift. Derive the PR agent's ALLOWED_LABELS from
LABEL_TO_OWNER so a newly-owned component is allowed automatically.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 963611217
2026-08-12 12:57:22 -07:00
George Weale 40ccbeec6f fix: preserve turns when stale compaction loses
Concurrent session writers can append against a stale revision, and the different session backends surfaced that conflict inconsistently. A stale post-response compaction write could then fail a turn that had already completed. This raises a consistent StaleSessionError (still a ValueError subclass) across the database, SQLite, and Firestore services, and discards only the stale compaction summary while keeping the raw turns.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963599677
2026-08-12 12:34:52 -07:00
George Weale d8d8a6ef16 fix(samples): separate skipped from failed issues in the monitoring agent
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963583295
2026-08-12 12:02:55 -07:00
George Weale 30f32e3a95 fix: coerce non-string enum values to strings on string-typed Gemini schemas
Some MCP servers declare a string-typed field whose enum lists integer
values. Gemini requires enum members to match the declared string type, so
the tool declaration was rejected and the integration failed. Normalize enum
values to their string form when the effective (non-null) type is string,
leaving numeric enums on numeric types untouched.

Close #3401

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963579568
2026-08-12 11:55:43 -07:00
George Weale 899500510d fix: restrict builder YAML code references to the app being edited
Close #5292

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963578247
2026-08-12 11:53:35 -07:00
George Weale f324d1beed fix: select the mTLS endpoint only when a client certificate exists
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963560219
2026-08-12 11:24:18 -07:00