Commit Graph

2164 Commits

Author SHA1 Message Date
Wei Sun (Jack) 710d9de011 chore(release): Update release process to allow tag to use accurate commit sha in the branch
* use last-release-sha to locate the previous release commit in main for CHANGELOG generating.
* release tag can now use the commit sha in release branch

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
PiperOrigin-RevId: 871909085
2026-02-18 09:30:33 -08:00
Google Team Member 33f7d118b3 feat(auth): Add native support for id_token in OAuth2 credentials
## Problem
When performing authentication flows via `OAUTH2` or `OPEN_ID_CONNECT`, the native `OAuth2Token` response from identity providers, like Google OAuth, often includes an `id_token` alongside the `access_token` and `refresh_token`. [MCP Toolbox](https://googleapis.github.io/genai-toolbox/resources/authservices/google/) implements authentication through ID Tokens and [integrates with ADK](https://google.github.io/adk-docs/integrations/mcp-toolbox-for-databases/) to provide easy tools management for the end-users.

However, the ADK's `update_credential_with_tokens` utility explicitly drops the `id_token`, preventing agents and tools from verifying user identity or extracting OIDC claims securely. Furthermore, the `OAuth2Auth` model does not have a designated field for `id_token`.

## Solution
1. Added an `id_token: Optional[str] = None` field to the `OAuth2Auth` pydantic model in `auth_credential.py`.
2. Updated `update_credential_with_tokens` in `oauth2_credential_util.py` to correctly extract and map `tokens.get("id_token")` into the `OAuth2Auth` credential object.
3. Updated the relevant unit tests to ensure `id_token` is asserted and preserved during credential updates.

### Testing Plan

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

PiperOrigin-RevId: 871801313
2026-02-18 04:34:39 -08:00
Google Team Member 6a53f414d3 chore: set a maximum number of rows for BigQuery query results in the sample agent
The `BigQueryToolConfig` now sets `max_query_result_rows=50` explicitly to showcase this particular configuration.

PiperOrigin-RevId: 871709345
2026-02-18 00:24:26 -08:00
Wei Sun (Jack) dbd64207ae fix(deps): Increase pydantic lower version to 2.7.0
```
  ┌──────────────────────────────┬─────────────────┬───────────────────────────────────────────────┐
  │           Feature            │ First Available │                    Used In                    │
  ├──────────────────────────────┼─────────────────┼───────────────────────────────────────────────┤
  │ SkipJsonSchema               │ 2.1.0           │ evaluation/eval_metrics.py                    │
  ├──────────────────────────────┼─────────────────┼───────────────────────────────────────────────┤
  │ AliasChoices                 │ 2.1.0           │ models/gemma_llm.py                           │
  ├──────────────────────────────┼─────────────────┼───────────────────────────────────────────────┤
  │ SerializeAsAny               │ 2.1.0           │ agents/workflow/workflow_graph.py             │
  ├──────────────────────────────┼─────────────────┼───────────────────────────────────────────────┤
  │ Discriminator, Tag           │ 2.5.0           │ agents/agent_config.py                        │
  ├──────────────────────────────┼─────────────────┼───────────────────────────────────────────────┤
  │ ser_json_bytes in ConfigDict │ 2.5.0           │ events/event.py, agents/live_request_queue.py │
  ├──────────────────────────────┼─────────────────┼───────────────────────────────────────────────┤
  │ Field(deprecated=True)       │ 2.7.0           │ agents/run_config.py                          │
  └──────────────────────────────┴─────────────────┴───────────────────────────────────────────────┘
```

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
PiperOrigin-RevId: 871478269
2026-02-17 13:47:26 -08:00
Google Team Member 2703613572 fix: Replace the global DEFAULT_USER_PERSONA_REGISTRY with a function call to get_default_persona_registry
PiperOrigin-RevId: 871422993
2026-02-17 11:45:24 -08:00
Xiang (Sean) Zhou e1e0d63616 refactor: Extract reusable function for building agent transfer instructions
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 871410286
2026-02-17 11:19:11 -08:00
Kathy Wu 4285f852d5 fix: Include list of skills in every message and remove list_skills tool from system instruction
The list_skills method is not for model tool listing, but for giving the developer flexibility to load the skill name/description at runtime (from discussion in go/orcas-rfc-555)

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 871406905
2026-02-17 11:12:11 -08:00
Haiyuan Cao ea034877ec fix: Improve BigQuery Agent Analytics plugin reliability and code quality
This CL fixes several bugs in the BigQuery Agent Analytics plugin and refactors the internal data-passing pattern for better type safety and maintainability.

-   **Stale Loop State Validation:** Use `loop.is_closed()` — a public, reliable API — to detect and clean up stale asyncio loop states in `_batch_processor_prop`, `_get_loop_state`, and `flush`. The previous approach used `asyncio.Queue._loop` which is `None` on Python 3.10+, causing the check to always treat states as stale.
-   **Quota Project ID Fallback:** Remove the `or project_id` fallback when setting `quota_project_id` on `BigQueryWriteAsyncClient`. This fixes Workload Identity Federation flows where the federated identity lacks `serviceusage.services.use` on the quota project.
-   **Kwargs Passthrough:** Pass `**kwargs` through to `_log_event` in all callbacks. Previously only model callbacks forwarded them, causing custom attributes (e.g. `customer_id`) to silently drop for agent, tool, run, and error events.
-   **State Delta Logging:** Replace the dead `on_state_change_callback` (never invoked by the framework) with `on_event_callback`, which is already dispatched by the runner for every event. Remove duplicate `STATE_DELTA` logging from `after_tool_callback`.
-   **EventData Dataclass:** Replace the `**kwargs`-as-data-bus pattern in `_log_event` with an explicit `EventData` dataclass. This makes the interface self-documenting, catches typos at construction time, and eliminates shared dict mutation across `_resolve_span_ids`, `_extract_latency`, and `_enrich_attributes`. All 12 callback call sites now construct typed `EventData` instances.
-   **Multi-Subagent Tool Logging Tests:** Add `TestMultiSubagentToolLogging` (6 tests) verifying that tool events are correctly attributed to subagents in multi-turn, multi-agent scenarios. Total tests: 111 (up from 60).

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 871381533
2026-02-17 10:24:34 -08:00
Google Team Member 6a808c60b3 feat: Introduce User Personas to the ADK evaluation framework
PiperOrigin-RevId: 871366815
2026-02-17 09:54:23 -08:00
Xiang (Sean) Zhou 976a238544 refactor: Extract reusable private methods
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 871359399
2026-02-17 09:36:25 -08:00
Google Team Member 42eeaef2b3 refactor: Extract reusable private methods
PiperOrigin-RevId: 871151624
2026-02-17 00:05:25 -08:00
Xiang (Sean) Zhou 706f9fe74d refactor: Extract reusable private methods
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 871128393
2026-02-16 22:52:47 -08:00
Kathy Wu 4e2d6159ae fix: Fix pickling lock errors in McpSessionManager
When we added the session_lock_map, it resulted in pickling errors during Agent Engine deployment. To fix, we implemented custom getstate and setstate methods to exclude the lock map lock and session lock map from pickling. Closes https://github.com/google/adk-python/issues/4486.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 871056554
2026-02-16 18:50:30 -08:00
Ke Wang fc1f1db005 fix(skill)!: coloate default skill SI with skilltoolset
PiperOrigin-RevId: 870017182
2026-02-13 21:43:54 -08:00
Ke Wang 21be6adcb8 feat: Make skill instruction optimizable and can adapt to user tasks
PiperOrigin-RevId: 869971535
2026-02-13 18:44:46 -08:00
Google Team Member 3fbc27fa4d fix: handle UnicodeDecodeError when loading skills in ADK
PiperOrigin-RevId: 869956988
2026-02-13 17:47:45 -08:00
Xiang (Sean) Zhou d56cb4142c fix: Check both input_stream parameter name and its annotation to decide whether it's a streaming tool that accept input stream
meanwhile also centralize input-stream creation in registration

Move the LiveRequestQueue stream creation from _call_live
(function_tool.py) to the lazy registration block in
_process_function_live_helper (functions.py). This centralizes the
input_stream: LiveRequestQueue annotation check and stream creation
in one place, and ensures the stream is also recreated on
re-invocation after stop_streaming resets it to None.

_call_live now simply passes the existing .stream if set, without
needing to know about LiveRequestQueue at all.

Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 869935204
2026-02-13 16:33:26 -08:00
Xiang (Sean) Zhou 1d4b0f9ff5 chore: Replace isinstance call with hasattr call
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 869919864
2026-02-13 15:47:18 -08:00
George Weale 811e50a0cb feat: add generate/create modes for Vertex AI Memory Bank writes
add_events_to_memory now supports memory_write_mode to select generate (event-based extraction/consolidation) or create (direct raw fact writes via memory_facts). This now lets custom memory pipelines while keeping generate as the default path

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 869897256
2026-02-13 14:46:45 -08:00
Anmol Jaiswal d5332f4434 feat: Expand LiteLlm supported models and add registry tests
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 869873309
2026-02-13 13:47:13 -08:00
Liang Wu fbe9eccd05 fix: race condition in table creation for DatabaseSessionService
Using one lock and checking for tables creation instead of schema version.

Closes issue #4445

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 869808097
2026-02-13 11:07:15 -08:00
Xuan Yang 186371f01e chore: Export Context class
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 869796021
2026-02-13 10:38:29 -08:00
Kathy Wu 556d148256 chore: Add readme in skills folder to flag that it is experimental
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 869782185
2026-02-13 10:07:13 -08:00
Akshat8510 30b2ed3ef8 fix(web): allow session resume without new message
Merge https://github.com/google/adk-python/pull/4185

**Description**
 This PR resolves #4100 by making the `new_message` field optional in the `RunAgentRequest` model.

 **The Problem:**
 When attempting to resume an agent session via the FastAPI web server, the request would fail with a `422 Unprocessable Entity` if `new_message` was omitted. This prevented "resume-only" workflows where a user just wants to wake up an existing session.

 **The Solution:**
 Updated `RunAgentRequest.new_message` to be `Optional[types.Content] = None`. The underlying `runner.run_async` logic already supports `None` for resuming purposes, so no further logic changes were required.

 **Verification:**
 Verified that `RunAgentRequest` now validates successfully when `new_message` is missing, defaulting the field to `None`.

Co-authored-by: Liang Wu <wuliang@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4185 from Akshat8510:fix/fastapi-resume-4100 b6d252636aa5f96186507fccf47a278fe733a362
PiperOrigin-RevId: 869761179
2026-02-13 09:11:51 -08:00
Xiang (Sean) Zhou ede925b502 chore: Lazy register all streaming tools
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 869480442
2026-02-12 18:50:43 -08:00