132 Commits

Author SHA1 Message Date
Shangjie Chen 416dc6feed feat: add memory_service option to CLI
chore: consolidate ADK service CLI options

PiperOrigin-RevId: 769944881
2025-06-10 21:22:14 -07:00
Google Team Member 6c999caa41 feat: Introduce write protected mode to BigQuery tools
This allows to protect against any write operations (e.g. update or delete a table), useful for some agents that must only be used in a read-only mode, while the user may have write permissions.

PiperOrigin-RevId: 769803741
2025-06-10 14:37:24 -07:00
Wei Sun (Jack) 088200072f chore: Adds decorators to mark classes or fucntions as working_in_progress or experimental
User will see warning if they instantiate such class or call such functions.

PiperOrigin-RevId: 769413048
2025-06-09 20:23:36 -07:00
Yongsul Kim cf5d7016a0 fix: Remove display_name for non-Vertex file uploads
Merge https://github.com/google/adk-python/pull/1211

### Description

When using the Google.GenAI backend (GEMINI_API), file uploads fail if the `file_data` or `inline_data` parts of the request contain a `display_name`. The Gemini API (non-Vertex) does not support this attribute, causing a `ValueError`.

This commit updates the `_preprocess_request` method in the `Gemini` class to sanitize the request. It now iterates through all content parts and sets `display_name` to `None` if the determined backend is `GEMINI_API`. This ensures compatibility, similar to the existing handling of the `labels` attribute.

Fixes #1182

### Testing Plan

**1. Unit Tests**

- Added a new parameterized test `test_preprocess_request_handles_backend_specific_fields` to `tests/unittests/models/test_google_llm.py`.
- This test verifies:
  - When the backend is `GEMINI_API`, `display_name` in `file_data` and `inline_data` is correctly set to `None`.
  - When the backend is `VERTEX_AI`, `display_name` remains unchanged.
- All unit tests passed successfully.

```shell
pytest ./tests/unittests/models/test_google_llm.py                                    ░▒▓ ✔  adk-python   base   system   21:14:02 
============================================================================================ test session starts ============================================================================================
platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.6.0
rootdir: /Users/leo/PycharmProjects/adk-python
configfile: pyproject.toml
plugins: anyio-4.9.0, langsmith-0.3.42, asyncio-0.26.0, mock-3.14.0, xdist-3.6.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 20 items

tests/unittests/models/test_google_llm.py ....................                                                                                                                                        [100%]

============================================================================================ 20 passed in 3.19s =============================================================================================
```

**2. Manual End-to-End (E2E) Test**
I manually verified the fix using `adk web`. The test was configured to use a **Google AI Studio API key**, which is the scenario where the bug occurs.

- **Before the fix:**
  When uploading a file, the request failed with the error: `{"error": "display_name parameter is not supported in Gemini API."}`. This confirms the bug.

<img width="968" alt="Screenshot 2025-06-06 at 21 22 35" src="https://github.com/user-attachments/assets/f1ab2db2-d5ec-40fc-a182-9932562b21e1" />

- **After the fix:**
  With the patch applied, the same file upload was processed successfully. The agent correctly analyzed the file and responded without errors.

<img width="973" alt="Screenshot 2025-06-06 at 21 23 24" src="https://github.com/user-attachments/assets/e03228f6-0b7d-4bf9-955a-ac24efb4fb72" />

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1211 from ystory:fix/display-name d3efebe74aca635a7a255063e64f07cc44016f05
PiperOrigin-RevId: 769278445
2025-06-09 13:48:02 -07:00
Wei Sun (Jack) a09781142a chore: Removes LlmAgent.examples field, which was already abandoned before 0.1 version
For context: tools/example_tool.py was created to replace LlmAgent.example

Also removes relevant usage in tests.

PiperOrigin-RevId: 768193042
2025-06-06 13:17:10 -07:00
Xiang (Sean) Zhou 309a656f49 refactor: extract credentail key building logic to auth_config
PiperOrigin-RevId: 768124459
2025-06-06 10:19:20 -07:00
Xiang (Sean) Zhou c224626ae1 fix: handle the case when agent loading error doesn't have msg attribute in agent loader
PiperOrigin-RevId: 767447874
2025-06-04 23:13:12 -07:00
Google Team Member 86e15cab89 chore: Make ArtifactService transparent to AgentTools
PiperOrigin-RevId: 767225493
2025-06-04 11:35:49 -07:00
Ankur Sharma 984c1d6b8b test: Added unit test coverage for local_eval_set_results_manager.py
PiperOrigin-RevId: 767202237
2025-06-04 10:39:09 -07:00
Xiang (Sean) Zhou b1a74d099f fix: relax openapi spec to gemini schema conversion to tolerate more cases
PiperOrigin-RevId: 766985694
2025-06-03 22:59:34 -07:00
Selcuk Gun eaee49bc89 fix: Simplify content for ollama provider
Even though litellm type definitions and openai API specifies content as list of dictionaries (with type and relevant attributes potentially to allow multimodal inputs/outputs in addition to text), ollama has been demonstrating marshal errors. As a workaround this change simplifies the content as string when there is no more than one content part.

Fixes #642, #928, #376

PiperOrigin-RevId: 766890141
2025-06-03 17:37:43 -07:00
Xiang (Sean) Zhou 7b51ae9724 fix: enhance agent loader exception handler and expose precise error information
PiperOrigin-RevId: 766876662
2025-06-03 16:56:29 -07:00
Google Team Member ec8bc7387c fix: ParallelAgent should only append to its immediate sub-agent, not transitive descendants
Restores automatic conversation history sharing for sequential/loop sub-agents.

PiperOrigin-RevId: 766742380
2025-06-03 16:55:51 -07:00
Google Team Member 16f7d98acf feat: Update for anthropic models
Enable parallel tools for anthropic models, and add agent examples, and also added functional test for anthropic models.

PiperOrigin-RevId: 766703018
2025-06-03 16:55:34 -07:00
Google Team Member af95dd2932 feat: Add sortByColumn functionality to List Operation
This change introduces the ability to sort results by a specific column in the List Operation.

PiperOrigin-RevId: 766468964
2025-06-03 16:55:17 -07:00
Ankur Sharma 174afb3975 Added unit test coverage for local_eval_sets_manager.py
PiperOrigin-RevId: 766392263
2025-06-03 16:54:58 -07:00
Xiang (Sean) Zhou 5a67a946d2 fix: fix parameter schema generation for gemini
this fixes https://github.com/google/adk-python/issues/1055
and https://github.com/google/adk-python/issues/881

PiperOrigin-RevId: 766288394
2025-06-02 12:03:02 -07:00
Xiang (Sean) Zhou 15a45a68fd chore: move fast api test case to cli package to match source codes package structure
PiperOrigin-RevId: 766268528
2025-06-02 11:16:14 -07:00
Xiang (Sean) Zhou f07abcc09c chore: fix ut for test_functions_request_euc.py
PiperOrigin-RevId: 766268126
2025-06-02 11:15:13 -07:00
Selcuk Gun b181cbc8bc fix: Handle non-indexed function call chunks with incremental fallback index
This is in response to the litellm v1.71.2 + ollama v0.9.0 sending function call chunks with 0 indices across multiple calls and lacking call ids.

Solutions introduced:
1. increment fallback index when accumulated arg becomes json parsable.
2. tolerate finish reason == stop when tool calls are present
3. fallback to index when tool call id is None

Fixes https://github.com/google/adk-python/issues/294

PiperOrigin-RevId: 766258344
2025-06-02 10:51:56 -07:00
Jaeyeon Kim(김재연) b0403b2d98 Copybara import of the project:
--
8772b3de0b2fd04f246cc90c4c8032f9dc8cfed9 by Jaeyeon Kim <anencore94@gmail.com>:

fix: update unit test code for test_connection

 - Fix for Unit Test Failures

--
8e0b45c2a64994bfda6401847e485fdd9edc8306 by Jaeyeon Kim <anencore94@gmail.com>:

fix useless changes

--
54efa004fa0fc9bcf78b49061221994650e162bc by Jaeyeon Kim <anencore94@gmail.com>:

fix conflict resolve issue

--
003ed4418c73b74bfba5ff055a364b62ddc18fa7 by Wei Sun (Jack) <weisun@google.com>:

Autoformat test_connections_client.py

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/578 from anencore94:bugfix/failed_unittests ba0e1d33ad905b0b046023b685c70f4ef05e4efa
PiperOrigin-RevId: 766221165
2025-06-02 09:20:41 -07:00
Shangjie Chen 8d36dbda52 feat: Add an option to use gcs artifact service in adk web.
Resolves https://github.com/google/adk-python/issues/309

PiperOrigin-RevId: 765772763
2025-06-01 00:28:49 -07:00
Calvin Giles 0e72efb439 fix: Call all tools in parallel calls during partial authentication
Copybara import of the project:

--
ffd6184d7e402b0787b0fa37fc09cd519adcc7f3 by Calvin Giles <calvin.giles@trademe.co.nz>:

fix: Call all tools in parallel calls during partial authentication

--
c71782a582ba825dbe2246cdb5be3f273ca90dca by seanzhou1023 <seanzhou1023@gmail.com>:

Update auth_preprocessor.py
--
843af6b1bc0bc6291cb9cb23acf11840098ba6dd by seanzhou1023 <seanzhou1023@gmail.com>:

Update test_functions_request_euc.py
--
955e3fa852420ecbf196583caa3cf86b7b80ab56 by seanzhou1023 <seanzhou1023@gmail.com>:

Update test_functions_request_euc.py

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/853 from calvingiles:fix-parallel-auth-tool-calls f44671e37b9fe44a25c9b1c0c25a26fc634b011c
PiperOrigin-RevId: 765639904
2025-05-31 13:14:06 -07:00
Xiang (Sean) Zhou 036f954a2a refactor: uniform Google LLM variant and parsing logic and make contant value consistent with Google GenAI SDK : https://github.com/googleapis/python-genai/blob/903e0729ce5198f48193ac7301727f0c3d72f2b8/google/genai/_automatic_function_calling_util.py#L96
PiperOrigin-RevId: 765639681
2025-05-31 13:12:25 -07:00
Ankur Sharma e06e6753ad chore: Add the name of the agent as a billing label. This will help consumers slice their billing reports by Agent.
Fixes https://github.com/google/adk-python/issues/452

PiperOrigin-RevId: 765402643
2025-05-30 17:54:28 -07:00