Commit Graph

1052 Commits

Author SHA1 Message Date
rcsantana777 7fe60641e3 feat: Add custom User-Agent header to RestApiTool requests
Merge https://github.com/google/adk-python/pull/2641

This PR adds a custom `User-Agent` header to all requests made via `RestApiTool`. This allows backend services to identify traffic originating from the ADK. The header format is `google-adk/<version> (tool: <tool_name>)`, where `<version>` is the current version of the `google-adk` package, fetched dynamically from `google.adk.version`, and `<tool_name>` is the name of the specific `RestApiTool` instance.

**Associated Issue**

Fixes #2676

**Testing Plan**

**Unit Tests**

I ran the full suite of unit tests locally to ensure the changes did not introduce any regressions. All tests passed successfully.
```bash
$ pytest ./tests/unittests
================================= 4202 passed, 2459 warnings in 44.68s ====================
```
The warnings are related to existing experimental features and are not affected by this change.

**Manual End-to-End (E2E) Test**

I performed a manual test to ensure the integrated flow works as expected.

*   **Setup:** Created a clean virtual environment (`~/venvs/adk-e2e-test`) and installed the locally built `google-adk` package using `uv venv --seed` and `pip install dist/google_adk-*.whl`. Ran a custom `mock_server.py` script (using Flask) in one terminal to listen for requests and print headers. Ran a custom `run_test_tool.py` script in a second terminal to send a request using the modified `RestApiTool`.

*   **Execution:** The `run_test_tool.py` script successfully sent a POST request to the mock server's `/test` endpoint. The mock server received the request and printed the headers.

    **`run_test_tool.py` Output:**
    ```json
    {
      "message": "Request received successfully!"
    }
    ```

    **`mock_server.py` Output (Headers):**
    ```text
    --- Request Received ---
    Headers:
      Host: 127.0.0.1:8000
      User-Agent: google-adk/1.12.0 (tool: TestTool)
      Accept-Encoding: gzip, deflate
      Accept: */*
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 2
    ------------------------
    ```
    The `User-Agent: google-adk/1.12.0 (tool: TestTool)` header confirms the change is working as intended, dynamically fetching the package version and including the tool name.

**Checklist**

*   [x] Associated issue linked
*   [x] Unit tests passed
*   [x] End-to-end test performed and results documented
*   [x] Code formatted with `./autoformat.sh`

---

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2641 from rcsantana777:feat/add-user-agent a9a9375306c18bb7ba501276cbf76693e70a87ad
PiperOrigin-RevId: 798232385
2025-08-22 09:11:16 -07:00
Xiang (Sean) Zhou 395a50b5dc chore: add triaging instructions for mcp
PiperOrigin-RevId: 798017380
2025-08-21 20:06:51 -07:00
Hangfei Lin ddb070ff07 feat: Add support for store audio and transcription into events/sessions and artifacts
PiperOrigin-RevId: 798011660
2025-08-21 19:50:26 -07:00
Ankur Sharma f660180854 fix: Update create_eval_set API to return the created EvalSet and it route
PiperOrigin-RevId: 797974571
2025-08-21 17:13:46 -07:00
Xiang (Sean) Zhou 157f73181d feat: Allow user to specify protocol for A2A RPC URL in to_a2a utility
this fixes https://github.com/google/adk-python/issues/2405

PiperOrigin-RevId: 797958771
2025-08-21 16:26:57 -07:00
Joe Fernandez ccab076ace docs: Add What's new section to README.md
Merge https://github.com/google/adk-python/pull/2668

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2668 from joefernandez:patch-1 7bc04963755af76fe289d1855341553057348a55
PiperOrigin-RevId: 797958558
2025-08-21 16:25:30 -07:00
Wei Sun (Jack) 80d188199b chore: Fixes a few lint error for tools
PiperOrigin-RevId: 797945021
2025-08-21 15:49:21 -07:00
Google Team Member 29bb75f975 fix: updating BaseAgent.clone() and LlmAgent.clone() to properly clone fields that are lists
PiperOrigin-RevId: 797855214
2025-08-21 11:52:31 -07:00
Google Team Member 167182be01 fix: make tool description for bigquery execute_sql for various write modes self contained
So far we had a default docstring for the `execute-sql` tool and for non-default write modes we were concatenating more content to it. This was working fine in Python 3.9-3.12 but broke in Python 3.13 because of a nuanced difference in the string concatenation to the `__doc__` property of a function b/433914562#comment4. This change makes the docstring management more robust and readable.

PiperOrigin-RevId: 797843736
2025-08-21 11:26:19 -07:00
Xiang (Sean) Zhou 3f3aa7b32d fix: Set invocation_id and branch for event generated when both output_schema and tools are used
fixes https://github.com/google/adk-python/issues/2631

PiperOrigin-RevId: 797843460
2025-08-21 11:24:43 -07:00
Kacper Jawoszek 826f554789 fix: rework parallel_agent.py to always aclose async generators
See https://github.com/google/adk-python/issues/1670#issuecomment-3115891100

PiperOrigin-RevId: 797838268
2025-08-21 11:12:35 -07:00
Kacper Jawoszek 9645cee3a6 chore: add test for parallel agent to verify correct handling of exceptions
PiperOrigin-RevId: 797825924
2025-08-21 10:43:16 -07:00
Kacper Jawoszek 70f50db653 chore: add test for parallel agent to verify correct ordering of agents
PiperOrigin-RevId: 797817063
2025-08-21 10:21:37 -07:00
Google Team Member 81a53b53d6 fix: add table metadata info into Spanner tool get_table_schema and fix the key usage info
This can help to provide more context and information about the table, like parent-child relationship, and row deletion policy etc.

PiperOrigin-RevId: 797562858
2025-08-20 19:30:52 -07:00
Xiang (Sean) Zhou 52a3d6cb8a chore: Bump version number to 1.12.0
PiperOrigin-RevId: 797542097
2025-08-20 18:07:13 -07:00
Wei Sun (Jack) 331978772a fix: Fixes deps in test extra dep
PiperOrigin-RevId: 797509357
2025-08-20 16:25:08 -07:00
Wei Sun (Jack) e93f861cde chore: Removes unused to_agent_config method in BaseAgentConfig
PiperOrigin-RevId: 797502656
2025-08-20 16:08:36 -07:00
Google Team Member 54ed079100 fix: Fix Spanner DatabaseSessionService support
Introduce `DynamicPickleType` to handle session actions, using sqlalchemy-spanner `SpannerPickleType` when the database dialect is Spanner.

Connects to a Spanner database to store session data persistently in tables.
# Example using Spanner database:
`session_service = DatabaseSessionService(db_url="spanner+spanner:///projects/project-id/instances/instance-id/databases/database-id")`

# Example adk web command:
`adk web --session_service_uri="spanner+spanner:///projects/project-id/instances/instance-id/databases/database-id"`

PiperOrigin-RevId: 797416610
2025-08-20 12:26:53 -07:00
Thiago Salvatore c144b5347c fix: Add support for required params
Merge https://github.com/google/adk-python/pull/2212

This PR closes issue #2202

ADK was not parsing the required attribute when using LiteLLM, letting the LLM decide what is required vs not, not respecting function definitions.

## Test Plan

There's a fork of adk-python that is being running live for over 2 weeks in our production environment with millions of requests per day.

Below you can find a screenshot of the unit tests passing. I've also added one change to the test cases to cover this scenario

<img width="1904" height="483" alt="image" src="https://github.com/user-attachments/assets/5a6eb069-63ae-45a3-baca-6b01543f56fb" />

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2212 from thiagosalvatore:main 7de4037d8016389313f3fb22df40c12bac578523
PiperOrigin-RevId: 797393698
2025-08-20 11:31:53 -07:00
Wei Sun (Jack) 5b999ed6fd chore: Uses pydantic Field for Agent configs, so that the generated AgentConfig.json json schema can carry field description
PiperOrigin-RevId: 797094012
v1.12.0
2025-08-19 18:03:47 -07:00
George Weale bb8ebd15f9 chore: Update openai dependency version, based on correct OPENAI release
Bump the minimum required version of the `openai` package to `>=1.100.2` for compatibility with LiteLLM.

PiperOrigin-RevId: 797027214
2025-08-19 14:43:58 -07:00
Google Team Member fef5318a22 docs: add contributing bigtable sample
PiperOrigin-RevId: 797014958
2025-08-19 14:08:55 -07:00
Xiang (Sean) Zhou 018db79d13 fix: Lazy load VertexAiCodeExecutor and ContainerCodeExecutor
VertexAiCodeExecutor and ContainerCodeExecutor request additional dependencies, lazy load them so that when users import other names, they won't get impacted if they don't had those additional dependencies installed.
 Original codes swallow the exception and log a debug log is wrong and awkward, should follow the same style as what we did in https://github.com/google/adk-python/blob/main/src/google/adk/tools/retrieval/__init__.py

PiperOrigin-RevId: 796969332
2025-08-19 12:06:59 -07:00
Google Team Member 77ed1f5f15 feat: Add setdefault method to the ADK State object
This makes the ADK state more pythonic, with the State API being more like a python dict.

PiperOrigin-RevId: 796767559
2025-08-19 01:45:33 -07:00
George Weale 4afc9b2f33 feat: Add env var to suppress experimental warnings
Checked with local wheel and worked as intended. The harness shows suppression works: 0 warnings for all true-like values.

This CL adds ADK_DISABLE_EXPERIMENTAL_WARNING to let the users to suppress warning messages from features decorated with @experimental.

Previously, using experimental features would always trigger a UserWarning. This change creates a way to disable these warnings, which can be good to stop flooding logs.

The warning is suppressed if ADK_DISABLE_EXPERIMENTAL_WARNING is set to a truthy value such as "true", "1", "yes", or "on" (case-insensitive).

Added unit tests to make sure:
Warning suppression for functions and classes when the env var is set.
Case-insensitivity and various truthy values for the env var.
Loading the env var from a .env file.

PiperOrigin-RevId: 796649404
2025-08-18 17:59:13 -07:00