Commit Graph

95 Commits

Author SHA1 Message Date
Xiang (Sean) Zhou
ae7d3a79c8 chore: autoformat the test_litellm.py
PiperOrigin-RevId: 764937761
2025-05-29 16:49:20 -07:00
Xiang (Sean) Zhou
2b41824e46 chore: fix fast api ut
PiperOrigin-RevId: 764935253
2025-05-29 16:40:40 -07:00
Liang Wu
41ba2d1c8a chore: reformat the code using autoformat.sh.
PiperOrigin-RevId: 764918729
2025-05-29 15:56:29 -07:00
LucasNobre
05f4834759 Copybara import of the project:
--
cef3ca1ed3493eebaeab3e03bdf5e56b35c0b8ef by Lucas Nobre <lucaas.sn@gmail.com>:

feat: Add index tracking to handle parallel tool call using litellm
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/759 from lucasnobre212:fix/issue_484 65e22934bf839f9ea03963b9ec6c23fdce03f59f
PiperOrigin-RevId: 764902433
2025-05-29 15:11:23 -07:00
Google Team Member
ac52eab88e ADK changes
PiperOrigin-RevId: 764776124
2025-05-29 11:47:55 -07:00
Selcuk Gun
999a7fe69d Make tool_call one span for telemetry
Also renamed tool_call as execute_tool and added attributes as recommended in https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#execute-tool-span.

PiperOrigin-RevId: 764594179
2025-05-29 11:47:40 -07:00
Xiang (Sean) Zhou
96b36b70dc chore: fix base_llm_flow ut
PiperOrigin-RevId: 764585592
2025-05-29 11:47:31 -07:00
Xiang (Sean) Zhou
0250d9e3ac chore: reformat codes using autoformat.sh
PiperOrigin-RevId: 764584699
2025-05-29 11:47:22 -07:00
Xiang (Sean) Zhou
b92e068155 chore: fix function tool UT
PiperOrigin-RevId: 764567867
2025-05-28 22:30:42 -07:00
Almas Akchabayev
795605a37e fix: separate thinking from text parts in streaming mode
Copybara import of the project:

--
79962881ca1c17eb6d7bd9dcf31a44df93c9badd by Almas Akchabayev <almas.akchabayev@gmail.com>:

fix: separate thinking from text parts in streaming mode
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/777 from almeynman:separate-thinking-and-text-parts-in-stream-mode b63dcc7fd0fc3973888dcbb9d4cc7e7e0a66e7f7
PiperOrigin-RevId: 764561932
2025-05-28 22:11:14 -07:00
Google Team Member
60ceea72bd fix: do not convert "false" value to dict
This causes information loss, and is unexpected from user.

PiperOrigin-RevId: 764558190
2025-05-28 21:56:52 -07:00
Xiang (Sean) Zhou
791ac9eb68 refactor: refactor cli to use agent loader
PiperOrigin-RevId: 764546019
2025-05-28 21:09:40 -07:00
Danny Park
9d4ca4ed44 fix: Fix filtering by user_id for vertex ai session service listing
When the user id contains special characters (i.e. an email), we have added in extra url parsing to address those characters. We have also added an if statement to use the correct url when there is no user_id supplied.

Copybara import of the project:

--
ef8499001afaea40bd037c4e9946b883e23a5854 by Danny Park <dpark@calicolabs.com>:
--
773cd2b50d15b9b056b47b6155df492b0ca8034c by Danny Park <dpark@calicolabs.com>:

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/996 from dpark27:fix/list_vertex_ai_sessions d351d7f6017c03165129adc7d0212f21d1340d88
PiperOrigin-RevId: 764522026
2025-05-28 19:46:39 -07:00
Shangjie Chen
bf27f22a95 fix: Make GroundingMetadata JSON serializable. Also use the same logic to simplify content serialization.
PiperOrigin-RevId: 764401248
2025-05-28 13:50:25 -07:00
avidelatm
7fc09b2c64 chore: Adding regex for claude-4 models to anthropic_llm and updating tests
Copybara import of the project:

--
824b4379d59a375191f8ce10997efd4021d5d0b3 by Andres Videla <andres.videla@trademe.co.nz>:

Adding regex for claude-4 models to anthropic_llm and updating tests

--
8fa2a2df1931026dc803eee0e9b60e82e90c9efa by Wei Sun (Jack) <Jacksunwei@gmail.com>:

Adds trailing comma.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/934 from avidelatm:feature/add-support-for-claude-4-models-to-anthropic_llm 8d10bacdbec952ec9832180ac6c1d220916641da
PiperOrigin-RevId: 764396694
2025-05-28 13:39:04 -07:00
Google Team Member
d6c6bb4b24 feat: add BigQuery first-party tools.
These tools support getting BigQuery dataset/table metadata and query results.

PiperOrigin-RevId: 764139132
2025-05-28 00:59:19 -07:00
Xiang (Sean) Zhou
d40df2edf2 chore: fix unit tests
PiperOrigin-RevId: 764107186
2025-05-27 23:07:29 -07:00
Xiang (Sean) Zhou
618c824994 feat: extract agent loading logic from fast_api.py to a separate AgentLoader class and support more agent definition folder/file structure.
Structures supported:
a) agents_dir/agent_name.py (with root_agent or agent.root_agent in it)
b) agents_dir/agent_name_folder/__init__.py (with root_agent or agent.root_agent in the package)
c) agents_dir/agent_name_folder/agent.py (where agent.py has root_agent)

PiperOrigin-RevId: 763943716
2025-05-27 14:14:51 -07:00
Stephen Smith
03fe909ada Copybara import of the project:
--
b781880d9bfb9786bd5e50314eaedc441fc2a93e by Stephen Smith <stephen.smith@newfront.com>:

Telemetry unit test for non-serializable data.

--
179da9db997bb3f992e126c9c64193ff7df67b3d by Stephen Smith <stephen.smith@newfront.com>:

When converting the llm_request to JSON, skip non-serializable data.

--
5dc68f4f5a6d12b753fdb81d1449716d13490afb by Stephen Smith <stephen.smith@newfront.com>:

Update _create_invocation_context() return type to InvocationContext.

--
23a33f754409fcd2a7641098d68cef7e4f1c72c6 by Stephen Smith <stephen.smith@newfront.com>:

Oops, remove unnecessary import.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/879 from stephensmithnewfront:main f71e195a9ed157e4c0b3abfa74ae078b0c1a920a
PiperOrigin-RevId: 763922003
2025-05-27 13:21:44 -07:00
Yongsul Kim
c024ac5762 Align event filtering and ordering logic
Copybara import of the project:

--
d01a8fd5f079bc4fca9e4b71796dbe65312ce9ff by Leo Yongsul Kim <ystory84@gmail.com>:

fix(DatabaseSessionService): Align event filtering and ordering logic

This commit addresses inconsistencies in how DatabaseSessionService
handles config.after_timestamp and config.num_recent_events
parameters, aligning its behavior with InMemorySessionService and
VertexAiSessionService.

Key changes:
- Made after_timestamp filtering inclusive
- Corrected num_recent_events behavior to fetch the N most recent events
- Refined timezone handling for after_timestamp
- Updated the unit test test_get_session_with_config to includeSessionServiceType.DATABASE, allowing verification of these fixes.

Fixes #911

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/915 from ystory:fix/database-session-timestamp-recency 5cc8cf5f5a5c0cb3e87f6ab178a5725d3f696c88
PiperOrigin-RevId: 763874840
2025-05-27 11:22:04 -07:00
Xiang (Sean) Zhou
be0786ea88 refactor: rename agent_dir to agents_dir and rename app_id to app_name in fast_api.py to make it consistent among every endpoints
PiperOrigin-RevId: 763483339
2025-05-26 11:51:19 -07:00
Xiang (Sean) Zhou
694eca08e5 fix: fix bigquery credentials and bigquery tool to make it compatible with python 3.9 and make the credential serializable in session
PiperOrigin-RevId: 763332829
2025-05-26 01:58:52 -07:00
Xiang (Sean) Zhou
74a331f1fb chore: reformat the code with autoformat.sh
PiperOrigin-RevId: 763256626
2025-05-25 20:33:45 -07:00
Calvin Giles
1a43cf0f60 Copybara import of the project:
--
73826d258b136f92a8da8171f7dc14d5f07de8dd by Calvin Giles <calvin.giles@trademe.co.nz>:

fix: Enable InMemoryRunner to be used in async tests
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/868 from calvingiles:enable-test-runner-in-async fb9033ed6f350a3114859715cae51798f864ecf6
PiperOrigin-RevId: 763233472
2025-05-25 18:49:35 -07:00
Xiang (Sean) Zhou
a380d70ac7 chore: fix cli UT
PiperOrigin-RevId: 762734348
2025-05-24 00:11:32 -07:00
Xiang (Sean) Zhou
756a326033 feat: add customized bigquer tool wrapper class to facilitate developer to handcraft bigquery api tool
PiperOrigin-RevId: 762626700
2025-05-23 17:23:41 -07:00
Google Team Member
8076b2294f ADK changes
PiperOrigin-RevId: 762573275
2025-05-23 14:41:27 -07:00
Shangjie Chen
d212e50c10 feat:Make VertexAiSessionService true async.
PiperOrigin-RevId: 762547133
2025-05-23 13:31:38 -07:00
Xiang (Sean) Zhou
ff8a3c9b43 chore: reformat the codes using autoformat.sh
PiperOrigin-RevId: 762004002
2025-05-22 09:43:54 -07:00
Liang Wu
09f30afe10 fix: failed unit test for Gemini model headers.
Root cause is that GenAI SDK updated their logic of adding headers in the latest version.

PiperOrigin-RevId: 761751413
2025-05-21 18:40:16 -07:00
Google Team Member
4542af5650 Fix ollama issues with ChatCompletionAssistantToolCall
PiperOrigin-RevId: 761732316
2025-05-21 17:27:01 -07:00
Selcuk Gun
41b33d4a0a Move public_utils to utils in tests
Renamed conflicting utils.py as testing_utils.py

PiperOrigin-RevId: 761715808
2025-05-21 16:35:11 -07:00
Xiang (Sean) Zhou
09cb128cf9 fix: fix function tool name parsing
to fix https://github.com/google/adk-python/issues/824

PiperOrigin-RevId: 761703269
2025-05-21 16:00:09 -07:00
Selcuk Gun
c5a0437745 Provide inject_session_state as public util method
This is useful for injecting artifacts and session state variable into instruction template typically in instruction providers.

PiperOrigin-RevId: 761595473
2025-05-21 11:15:20 -07:00
Xiang (Sean) Zhou
cbdb5fc507 chore: fix ut for fast api server
PiperOrigin-RevId: 761350248
2025-05-20 21:17:39 -07:00
Amulya Bhatia
98727b4698 test: unit tests for code_executor_context.py
Copybara import of the project:

--
9e51865a6dd4de4d20088e8a7ac9f3a75501aa6b by Amulya Bhatia <amulya.bhatia@t-online.de>:

test: unit tests for code_executor_context.py
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/780 from iamulya:test-code-executor-context 907b1712e43b8ce90cd8786780bef863adfcc167
PiperOrigin-RevId: 761294975
2025-05-20 17:40:33 -07:00
Shangjie Chen
53b14325ce fix: Use sync request method in VertexAiSessionService. The api_client has it own event loop management.
PiperOrigin-RevId: 761250268
2025-05-20 15:20:21 -07:00
Xiang (Sean) Zhou
f67ccf32c3 fix: support Callable that has __call__ as coroutine function in FunctionTool
PiperOrigin-RevId: 760913537
2025-05-19 22:09:44 -07:00
Wei Sun (Jack)
9324801b75 chore: Fixes test_fast_api.py (part I for circular deps).
It still fails due to signal used not in main thread. It will be fixed later.

PiperOrigin-RevId: 760050504
2025-05-17 12:22:04 -07:00
Wei Sun (Jack)
57de9634de chore: Fixes unittests/tools/application_integration_tool/test_application_integration_toolset.py
PiperOrigin-RevId: 760019822
2025-05-17 09:49:35 -07:00
Liang Wu
a1ddf0b6cc feat!: add --adk_version arg to adk deploy cloud_run.
The default version for Cloud Run deployment is changed to the version in the dev environment instead of the latest version.

PiperOrigin-RevId: 759767654
2025-05-16 15:01:23 -07:00
Jack Wotherspoon
66a6f94fbc Copybara import of the project:
--
aa863ca851d4c689fbdb431d91189d5ebbc59932 by Jack Wotherspoon <jackwoth@google.com>:

chore: fix variable name in test
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/769 from jackwotherspoon:test-fix aa863ca851d4c689fbdb431d91189d5ebbc59932
PiperOrigin-RevId: 759731577
2025-05-16 13:20:57 -07:00
Selcuk Gun
9e9dfa7472 Prevent session state injection for provider supplied instructions
When the user provides instruction provider, we assume that they will inject the session state parameters if needed. This assumption allows users to return code snippets in the instruction provider without any template replacement.

PiperOrigin-RevId: 759705471
2025-05-16 12:09:48 -07:00
Google Team Member
6e0ea01fcb Added support for dynamic auth in integration connector tool
PiperOrigin-RevId: 759676602
2025-05-16 10:53:53 -07:00
Selcuk Gun
509db3f9fb Add token usage to gemini (streaming), litellm and anthropic
Also included a token_usage sample that showcases the token usage of subagents with different models under a parent agent.

PiperOrigin-RevId: 759347015
2025-05-15 16:22:36 -07:00
Shangjie Chen
a71d9ea9a1 fix: fix broken tests.
PiperOrigin-RevId: 759312577
2025-05-15 14:57:04 -07:00
Google Team Member
05917cabbd ADK changes
PiperOrigin-RevId: 759259620
2025-05-15 12:46:44 -07:00
Google Team Member
1804ca39a6 feat! Update session service interface to be async.
Also keep the sync version in the InMemorySessionService as create_session_sync() as a temporary migration option.

PiperOrigin-RevId: 759252188
2025-05-15 12:24:13 -07:00
Shangjie Chen
5b3204c356 feat! Update session service interface to be async.
Also keep the sync version in the InMemorySessionService as create_session_sync() as a temporary migration option.

PiperOrigin-RevId: 759224250
2025-05-15 11:17:13 -07:00
Xiang (Sean) Zhou
4a0751941b fix: fix application integration toolset
PiperOrigin-RevId: 759018346
2025-05-15 00:30:19 -07:00