Skip to content

Test PR 2#2

Open
BowedMars2 wants to merge 71 commits intomainfrom
Issue-#4796
Open

Test PR 2#2
BowedMars2 wants to merge 71 commits intomainfrom
Issue-#4796

Conversation

@BowedMars2
Copy link
Copy Markdown
Collaborator

Please ensure you have read the contribution guide 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 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.

BowedMars2 and others added 30 commits April 2, 2026 11:05
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 904636630
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 904672556
…e, empty lines

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 904736532
…rules for better environment consistency

- Revert non-standard src imports and fix formatting/import order across tests and samples to satisfy CI checks.
- Remove check-added-large-files as there are pre-existing large js / sample files
- Add allow-multiple-documents to support Kubernetes manifest that have multiple YAML in one file

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 905085090
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 905101547
…s Plugin

### Changes

**1. Pickle safety — try-preserve, fallback-drop**

`__getstate__` tests whether `_user_credentials` is picklable:
- **Picklable** (service-account, `AnonymousCredentials`): preserved — survives pickle and restored via `__setstate__` so the plugin uses the user's identity after unpickle.
- **Non-picklable** (`compute_engine.Credentials` with `requests.Session`): dropped gracefully — falls back to ADC after unpickle.

`_credentials` (the active/resolved credentials) is always cleared since it may hold resolved ADC state. On unpickle, `__setstate__` restores it from `_user_credentials` when available.

**2. Fork safety — documented user-provided credential limitation**

`_reset_runtime_state()` sets `_credentials = _user_credentials`. For ADC-resolved credentials (`_user_credentials is None`), this clears stale credentials for re-resolution. For user-provided credentials, the original object is kept — we cannot re-create it. The comment documents this: the user is responsible for providing fork-safe credentials.

**3. GCS client — credentials passed correctly**

`GCSOffloader.__init__` always creates a `storage.Client` eagerly (`storage_client or storage.Client(...)` at line 1329). This was also true before the credentials commit. The fix passes explicit credentials when available and lets ADC resolve when not, matching the `bigquery.Client` and `BigQueryWriteAsyncClient` patterns.

**4. Benign race on `_credentials` resolution documented**

When multiple event loops call `_create_loop_state()` concurrently, both can resolve ADC redundantly. This is idempotent and benign, now documented.

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 905111076
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 905152209
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 905187116
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905207529
…ource

The user_id for PubSub triggers is now derived from the subscription name with slashes replaced by double hyphens. Similarly, for Eventarc triggers, the source is sanitized by stripping leading/trailing slashes and replacing internal slashes with double hyphens. This ensures that the user_id is a valid identifier without path separators.

Close google#5324

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905219387
This change modifies the LLM event summarizer to extract the usage_metadata from the LLM's generate content response and include it in the newly created compacted Event

Close google#4014

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905222465
During session rewind, when restoring an artifact to a previous version, the runner now uses `artifact_service.load_artifact` to fetch the artifact's content. Previously, it would construct a `types.Part` with `file_data` using the artifact URI. This change is necessary because some artifact services, such as those backed by GCS or local files, do not support saving `types.Part` objects that contain `file_data`

Close google#4932

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905223401
This change introduces an `api_version` field in `GoogleLLMConfig`, allowing users to specify a custom API version for Gemini requests

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905226089
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905226545
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905227934
Parallel tool calls writing list values to the same state_delta key
were silently dropped because deep_merge_dicts only recursed into
dict values; lists hit the overwrite branch.

Closes google#5190

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905229706
Remove `location=self.location` from the `bigquery.Client()` constructor. When the client has no default location and `client.query(sql)` is called without an explicit `location` parameter, the BQ API infers the job location from the dataset referenced in the DDL statement.

Traced through the BQ Python client:
1. `client.query(sql)` — `location` param defaults to `None`, falls back to `self.location` which is also `None`
2. `_to_query_request()` — when `location is None`, the `"location"` key is **not included** in the API request
3. BQ API — infers location from the dataset referenced in `CREATE OR REPLACE VIEW`

**One line of production code changed.** Everything else is test updates.

| Operation | Before | After |
|---|---|---|
| Table CRUD | Works | Same |
| Storage Write API | Works | Same |
| View creation (non-US dataset) | **Silent failure** | **Works** — BQ infers location |

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 905242480
Function call IDs are now preserved during session replay for Anthropic
models, matching the behavior of Gemini models using the interactions API.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905250493
_call_tool_in_thread_pool used None as a sentinel to distinguish
"FunctionTool ran successfully" from "non-FunctionTool sync tool,
needs async fallback". When a sync FunctionTool's function legitimately
returned None, the sentinel check fell through to tool.run_async() and
re-invoked the underlying function.

Restructure the dispatch so the sync-FunctionTool path returns directly
and the non-FunctionTool sync path falls through explicitly, removing
the ambiguous sentinel.

Close google#5284

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905258186
Documents the existing subclass pattern (cached_property override of
api_client) so users with non-default genai.Client config — location,
project, credentials, http_options — find it without trial and error.
Several google#3628 commenters rediscovered this independently; making it
discoverable in the class docstring should reduce repeat issues.

Replaces an earlier draft of this CL that added a public client= field
on Gemini. The framework already supports the use case via subclassing,
so a docstring expansion is sufficient and avoids new public API.

Close google#3628

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905258437
Same fix applied to the matching helpers in google.adk.telemetry.

Close google#5412

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905265632
The rewind logic is updated to ensure that state keys set during session creation are not nullified when rewinding. Previously, any key not present in the state at the rewind point was removed. Now, only keys that have appeared in any event's state delta are considered for nullification during a rewind, preventing the removal of initial session state

Close google#4933

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 905271916
google-genai-bot and others added 30 commits April 25, 2026 09:09
… detection to schema resolution

PiperOrigin-RevId: 905576545
PiperOrigin-RevId: 906139925
Use sphinx-click to automatically generate documentation for the CLI commands in the google.adk.cli module. Closes google#4500

Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 906328549
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 906466855
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 906753501
Merge google#5489

Closes google#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`](google@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 (google#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 google#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](GHSA-g48c-2wqr-h844)),
but bumping past 0.4.x requires porting ADK's use of the removed
`graph.graph` API (per
[google#1687](google#1687)). That is
real engineering work, not a dep cap bump, and is left as a
separate effort.

COPYBARA_INTEGRATE_REVIEW=google#5489 from cwest:topic/bump-litellm-cap 559f0c2
PiperOrigin-RevId: 906979886
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 907023117
Co-authored-by: Wiktoria Walczak <wwalczak@google.com>
PiperOrigin-RevId: 907418898
`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
… and `output_schema` together

PiperOrigin-RevId: 907857917
Previously it was just in adk create, now add it to adk deploy in case users create an agent on their own and need to deploy with api key. Moved the shared logic into a utils/onboarding.py file

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 908191494
Close google#5103

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 908196458
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 908322085
… 3.1 tool calls

Fixes google#5407

END_PUBLIC

Merge google#5408

## Summary

- Tool call parts received via `LiveServerToolCall` in `GeminiLlmConnection.receive()` are now yielded immediately instead of being deferred until `turn_complete`
- This unblocks function/tool calling for Gemini 3.1 Flash Live models which do not emit `turn_complete` until they receive the tool response

## Problem

Gemini 3.1 Flash Live models send tool calls via `LiveServerToolCall` and wait for the tool response before sending `turn_complete`. The current code accumulates `tool_call_parts` and only yields them on `turn_complete` or loop exit, creating a deadlock where tools are never executed.

## Fix

Yield `tool_call_parts` immediately after receiving `message.tool_call`. This is backward-compatible — earlier models that send `turn_complete` after tool calls will still work because the existing yield paths become no-ops when `tool_call_parts` is already empty.

## Test plan

- [x] Tested with `gemini-3.1-flash-live-preview` in live mode — tool calls now execute on the first message and the model responds with audio after receiving tool results
- [x] Verified no regression with the existing `turn_complete`-based flow

Co-authored-by: Sasha Sobran <asobran@google.com>
COPYBARA_INTEGRATE_REVIEW=google#5408 from sandeshveerani4:fix/live-tool-call-yield ca0e760
PiperOrigin-RevId: 908326192
…onal` for conversation_scenario support

Close google#5214

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 908347275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.