Commit Graph

552 Commits

Author SHA1 Message Date
Wei Sun (Jack) a7ea374dfb chore: Update isort config to prevent vscode flickering
PiperOrigin-RevId: 770406033
2025-06-11 18:25:35 -07:00
Wei Sun (Jack) f46b73b0cb chore: Bump version number and update changelog for 1.3.0 release
PiperOrigin-RevId: 770362588
v1.3.0
2025-06-11 16:12:40 -07:00
Liang Wu b2f319f440 chore: move README to parent folder contributing/
Based on the content, seems like it belongs to contributing/.

PiperOrigin-RevId: 770322600
2025-06-11 14:32:03 -07:00
Yeesian Ng 0c4054200f fix: Handle project and location in the .env properly when deploying to Agent Engine
PiperOrigin-RevId: 770161930
2025-06-11 08:29:01 -07:00
Liang Wu c9e265551a test: add assert statements in hello_world agent main.py
They will check the states of the agent after each die roll.

PiperOrigin-RevId: 769949096
2025-06-10 21:35:36 -07:00
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
Yifan Wang 9df3f725bd chore: update adk-web to use latest
PiperOrigin-RevId: 769879742
2025-06-10 17:52:32 -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
Xiang (Sean) Zhou 77f44a4e45 refactor: remove the examples filed of LlmAgent which are no longer needed after migrating to example tool
PiperOrigin-RevId: 769757803
2025-06-10 12:55:48 -07:00
Ariz Chang 484b33ef10 chore: add rag agent for testing
PiperOrigin-RevId: 769683091
2025-06-10 10:10:55 -07:00
Yeesian Ng aaf1f9b930 feat: Add support for display_name and description when deploying to agent engine
PiperOrigin-RevId: 769674731
2025-06-10 09:53:40 -07:00
Google Team Member 8e438f2752 refactor: Extract out platform specific code like threading
PiperOrigin-RevId: 769655650
2025-06-10 09:05:56 -07:00
Xiang (Sean) Zhou fa110c22f2 chore: refine doc string of global_instruction
PiperOrigin-RevId: 769650108
2025-06-10 08:48:43 -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
Ariz Chang bf47a8bf7d fix: hide new eval metric behind flag
PiperOrigin-RevId: 769339396
2025-06-09 16:27:35 -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
takashi kikuchi f38c08b305 feat: Add DeepWiki badge to README
Merge https://github.com/google/adk-python/pull/1143

## Summary
Added a DeepWiki badge to the README.md file to provide users with easy access to interactive documentation that stays automatically updated.

## Changes Made
- Added DeepWiki badge to the existing badge section in README.md
- Badge links to: https://deepwiki.com/google/adk-python

## What is DeepWiki?
DeepWiki provides up-to-date documentation you can talk to, for every repository in the world. By adding this badge to our repository, we help users find and interact with documentation more easily. Users can ask questions about the codebase and get contextual answers based on the latest repository content.

The documentation is automatically updated weekly, ensuring that users always have access to the most current information about the ADK codebase, including new features, API changes, and code examples that reflect the latest development progress.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1143 from takashikik:add-deepwiki-badge d9b8bc676c9fe2e94c7b3f0ae49814452e45b5f9
PiperOrigin-RevId: 769273276
2025-06-09 13:35:45 -07:00
Google Team Member 3ae6ce10bc docs: Update code example in tool declaration to reflect BigQuery artifact description
PiperOrigin-RevId: 769203265
2025-06-09 10:36:11 -07:00
Hangfei Lin 13f98c396a fix: Correct help text formatting for adk deploy agent_engine
Merge https://github.com/google/adk-python/pull/1250

The `Args:` section in the docstring of the `cli_deploy_agent_engine` function was causing formatting issues in the help output, with line breaks not being rendered correctly.

This commit removes the redundant `Args:` section from the docstring. The help text for options is already comprehensively covered by the `help` attributes in the `@click.option` decorators, and `click` automatically lists the command's arguments.

This change ensures that the help output for
`adk deploy agent_engine --help` is clean, readable, and correctly formatted, relying on `click`'s standard help generation mechanisms.

After the fix:

(adk_test234) (base) hangfeilin@Hangfeis-MBP adk-python % adk deploy agent_engine --help
Usage: adk deploy agent_engine [OPTIONS] AGENT

  Deploys an agent to Agent Engine.

  Args:   agent (str): Required. The path to the agent to be deloyed.

  Example:

    adk deploy agent_engine --project=[project] --region=[region]     --staging_bucket=[staging_bucket] path/to/my_agent

Options:
  --project TEXT            Required. Google Cloud project to deploy the agent.
  --region TEXT             Required. Google Cloud region to deploy the agent.
  --staging_bucket TEXT     Required. GCS bucket for staging the deployment artifacts.
  --trace_to_cloud          Optional. Whether to enable Cloud Trace for Agent Engine.
  --adk_app TEXT            Optional. Python file for defining the ADK application (default: a file named agent_engine_app.py)
  --temp_folder TEXT        Optional. Temp folder for the generated Agent Engine source files. If the folder already exists, its
                            contents will be removed. (default: a timestamped folder in the system temp directory).
  --env_file TEXT           Optional. The filepath to the `.env` file for environment variables. (default: the `.env` file in
                            the `agent` directory, if any.)
  --requirements_file TEXT  Optional. The filepath to the `requirements.txt` file to use. (default: the `requirements.txt` file
                            in the `agent` directory, if any.)
  --help                    Show this message and exit.
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1250 from google:fix-1191-agent-engine-help d2d0e89ed1af6ace11abe4e3bed89335dbcf9be5
PiperOrigin-RevId: 769182740
2025-06-09 09:47:24 -07:00
Wei Sun (Jack) be7120831a chore: Adds apache headers for samples
PiperOrigin-RevId: 768583464
2025-06-07 15:46:46 -07:00
Jason Dai 4942f19f3f chore: Remove duplicated model_config attribute in EvalMetric class
PiperOrigin-RevId: 768214087
2025-06-06 14:13:02 -07:00
Google Team Member 8488ff052f feat: save and last run threshold and use it in next run evaluation
PiperOrigin-RevId: 768198603
2025-06-06 13:32:53 -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
Wei Sun (Jack) 9abb8414da fix: Forwards __annotations__ to the fake func for FunctionTool inspection
PiperOrigin-RevId: 767926726
2025-06-05 23:07:24 -07:00