Compare commits

...

1381 Commits

Author SHA1 Message Date
Xuan Yang b8644ef32c Make additional_headers kwargs 2025-10-21 12:44:50 -07:00
Xuan Yang ace3e5a3a5 Merge branch 'main' into feature/google-api-toolset-additional-headers-3105 2025-10-20 09:58:15 -07:00
Xuan Yang 37179a6e1f Format conditional statement for setting headers 2025-10-20 09:36:25 -07:00
Parham Alizadeh d8ded07eb3 addressing comments - tidy ups 2025-10-20 10:18:27 +01:00
Shangjie Chen d327538724 chore: Throw 409 already exist error when trying to create a session with existing id
Resolves https://github.com/google/adk-python/issues/2950

PiperOrigin-RevId: 821362008
2025-10-19 11:21:36 -07:00
Google Team Member a5b742b360 feat: introduces a new AgentEngineSandboxCodeExecutor class that supports executes agent generated code
The AgentEngineSandboxCodeExecutor uses the Vertex AI Code Execution Sandbox API to execute code

PiperOrigin-RevId: 821197794
2025-10-18 20:24:04 -07:00
Parham MohammadAlizadeh a09dd4d31f Merge branch 'main' into feature/google-api-toolset-additional-headers-3105 2025-10-18 12:09:45 +01:00
Wei Sun (Jack) af74eba695 test: Skips test_langchain_tool.py temporarily after their new 1.0.0 release breaks existings deps of langchain
PiperOrigin-RevId: 820875043
2025-10-17 16:53:11 -07:00
Google Team Member dbd818be0b feat: introduces a new AgentEngineSandboxCodeExecutor class that supports executes agent generated code
The AgentEngineSandboxCodeExecutor uses the Vertex AI Code Execution Sandbox API to execute code

PiperOrigin-RevId: 820854185
2025-10-17 15:42:24 -07:00
Xiang (Sean) Zhou a2d9f13fa1 chore: Add span for context caching handling and new cache creation
PiperOrigin-RevId: 820852233
2025-10-17 15:37:35 -07:00
Wei Sun (Jack) 0df67599c0 chore: Checks gemini version for 2 and above for gemini-builtin tools
PiperOrigin-RevId: 820848897
2025-10-17 15:27:47 -07:00
Shangjie Chen 8b3ed059c2 chore: Refactor and fix state management in the session service
Also refactoring the test cases to focus on the expected behaviors

PiperOrigin-RevId: 820734484
2025-10-17 10:04:36 -07:00
Parham MohammadAlizadeh 71999b0ef7 Merge branch 'main' into feature/google-api-toolset-additional-headers-3105 2025-10-17 16:37:23 +01:00
Ankur Sharma cf3403231d chore: Fix evaluation test cases to only use pytest features
PiperOrigin-RevId: 820700378
2025-10-17 08:25:17 -07:00
Parham MohammadAlizadeh 3d6d6132cd Merge branch 'main' into feature/google-api-toolset-additional-headers-3105 2025-10-17 16:23:25 +01:00
Parham Alizadeh 78e4d81579 feat(tools): support additional headers for google api toolset #non-breaking 2025-10-17 16:22:55 +01:00
Shangjie Chen 9dce06f9b0 feat: Add rewind_async to support rewinding the session to before a previous invocation
PiperOrigin-RevId: 820552460
2025-10-16 23:24:40 -07:00
George Weale 307896aece fix: Exclude additionalProperties from Gemini schemas
PiperOrigin-RevId: 820542466
2025-10-16 22:40:43 -07:00
Kathy Wu 6dcbb5aca6 feat: Support dynamic per-request headers in MCPToolset
Add a header_provider param which is a callable[ReadonlyContext, Dict[str, Any]] for users to build headers in MCPToolset
fix: https://github.com/google/adk-python/issues/3156
PiperOrigin-RevId: 820412372
2025-10-16 15:12:43 -07:00
Xiang (Sean) Zhou 2a8fdd94e1 chore: Add computer use sample agent
PiperOrigin-RevId: 820407078
2025-10-16 14:59:27 -07:00
Xuan Yang 37a153ef94 ci: Fix the logs importing for PR triaging agent
PiperOrigin-RevId: 820395414
2025-10-16 14:27:18 -07:00
Giovanni Galloro ce4638651f docs: Bump models in llms and llms-full to Gemini 2.5
Merge https://github.com/google/adk-python/pull/3166

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3166 from ggalloro:model-updates e741c8b266ef8cd7def203f94e8d9f8608c06685
PiperOrigin-RevId: 820381464
2025-10-16 13:53:45 -07:00
Doug Gebert e6e2767c39 chore: Update gemini_llm_connection.py - typo spelling correction
Merge https://github.com/google/adk-python/pull/3168

Fixed misspelling on line 228 from:
- logger.info('Redeived session...

To:
- logger.info('Received session...
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3168 from DHHHG:patch-1 90b76d72ba474cd0092b2cc8d955b918c18d05bd
PiperOrigin-RevId: 820369618
2025-10-16 13:23:58 -07:00
Kacper Jawoszek e50f05a9fc feat(otel): env variable for disabling llm_request and llm_response in spans
The default without the variable set is to keep the content in spans to keep backward compatible behavior for existing users.

This allows to enable tracing without potential PII data from request and response. Google GenAI instrumentation lib requires an explicit opt-in to enable request and response content - see https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-google-genai#enabling-message-content.

PiperOrigin-RevId: 820351154
2025-10-16 13:07:27 -07:00
Xuan Yang 9dc00360e3 ci: Add state info for PR triaging agent
PiperOrigin-RevId: 820340584
2025-10-16 13:07:18 -07:00
Google Team Member 5a543c00df feat: implement new methods in in-memory artifact service
* save_artifact with custom_metadata
* list_artifact_versions
* get_artifact_version

PiperOrigin-RevId: 820321444
2025-10-16 13:07:09 -07:00
Alexey Guseynov 1e1d63f34c fix: Internal change
PiperOrigin-RevId: 820159440
2025-10-16 13:07:00 -07:00
Xuan Yang f51380f9ea feat: Extend ReflectAndRetryToolPlugin to support hallucinating function calls
PiperOrigin-RevId: 820051762
2025-10-16 13:06:51 -07:00
Xuan Yang 3734ceaa6c fix: Use the agent's model when creating Google search agent tool
PiperOrigin-RevId: 819980797
2025-10-16 13:06:41 -07:00
Google Team Member 86097afe49 feat: Update AgentEvaluator to handle async ADK agent definitions
AgentEvaluator should recognize root_agent and get_agent_async as valid structures for ADK agent definitions.

PiperOrigin-RevId: 819976635
2025-10-16 13:06:31 -07:00
Google Team Member a17f3b2e6d feat: Allow custom request and event converters in A2aAgentExecutor
This change introduces type aliases for request and event conversion functions:
- `A2ARequestToADKRunArgsConverter`: For converting A2A `RequestContext` to an `ADKRunArgs` Pydantic model.
- `AdkEventToA2AEventsConverter`: For converting ADK `Event` to a list of A2A `A2AEvent` objects.

The `convert_a2a_request_to_adk_run_args` function now returns a structured `ADKRunArgs` model instead of a generic dictionary, improving type safety.

These converter types can now be provided via the `A2aAgentExecutorConfig` to customize the conversion logic used by the `A2aAgentExecutor`. The executor defaults to the existing `convert_a2a_request_to_adk_run_args` and `convert_event_to_a2a_events` functions if no custom converters are specified.

This allows users to inject their own logic for handling request and event conversions, for example, to add custom metadata or transform data types, without modifying the core executor.

PiperOrigin-RevId: 819934960
2025-10-16 13:06:21 -07:00
Shangjie Chen 6ab1498aa0 fix: Add usage_metadata and citation_metadata to DatabaseSessionService
PiperOrigin-RevId: 819900773
2025-10-16 13:05:52 -07:00
Google Team Member 2424d6a3b1 feat: Reorder create_time and mime_type to ArtifactVersion
Before: http://sponge2/ba05f9ac-c13d-43b6-bb8a-3e1b029cc705(failed)
After: http://sponge2/a623ba76-62c1-4d17-b4b6-22044333a801
PiperOrigin-RevId: 819896989
2025-10-15 13:46:12 -07:00
Lin Nikaido 36c96ec5b3 fix: #2883 pickle data was truncated error in database session using MySql
Merge https://github.com/google/adk-python/pull/2884

closes: #2883
# Fix
When put leage data into event and load it. the _pickle.UnpicklingError was occurred.
The root caurse is `DynamicPickleType` mapping `BLOB` as default in case of MySql, not `LONGBLOB`. And learge data will be able to cut off tail of data. And raise pickle error.

# What todo
Defined `LONFBLOB` as default explicitly.

# Question
Where should we code the test code like this case? I cannot found the test code the DB and table was created expectedly.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2884 from Lin-Nikaido:fix/#2883-mysql-datatype-fix 2be9b38fc3f5d5083b0b6715a2bf7b4eff5d947b
PiperOrigin-RevId: 819891727
2025-10-15 13:33:22 -07:00
Shangjie Chen a985cc38ec feat: Support return all sessions when user id is none
PiperOrigin-RevId: 819884236
2025-10-15 13:14:24 -07:00
machache b650181384 feat: add support for ContetxtWindowCompressionConfig in RunConfig
Merge https://github.com/google/adk-python/pull/2206

### Summary

This PR adds support for `ContextWindowCompressionConfig` in `RunConfig`.
This enables context window compression using a `trigger_tokens` threshold and a sliding window with a `target_tokens` limit.

This feature is useful for managing long-running audio inputs.

### Related Issue

Closes #2188

### Testing Plan

- Added new unit test: `test_streaming_with_context_window_compression_config`

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2206 from ac-machache:support/add-context-compression-config c8a5b15cae2d2b72f331797d07ae0bbaf977ed3c
PiperOrigin-RevId: 819855786
2025-10-15 12:00:21 -07:00
Kathy Wu 78e74b5bf2 feat: Add require_confirmation param for MCP tool/toolset
This allows users to require human approval for using MCP tools.

PiperOrigin-RevId: 819800747
2025-10-15 09:58:31 -07:00
Ankur Sharma d82c492140 chore: Remove deprecated convert_session_to_eval_format function
This change removes the `convert_session_to_eval_format` function and its associated unit tests. New tests for `create_gcs_eval_managers_from_uri` are also added.

PiperOrigin-RevId: 819576620
2025-10-14 22:37:49 -07:00
Xuan Yang 05aa3fa38b fix: Remove the PR triaging agent's dependence on "bot triaged" label
PiperOrigin-RevId: 819427872
2025-10-14 15:35:59 -07:00
Google Team Member f9c09ef075 feat: Support returning all sessions when user_id is none in the request
resolves https://github.com/google/adk-python/issues/3154

PiperOrigin-RevId: 819417330
2025-10-14 15:10:41 -07:00
Shangjie Chen 141318f775 feat: Support returning all sessions when user_id is none in the request
resolves https://github.com/google/adk-python/issues/3154

PiperOrigin-RevId: 819401023
2025-10-14 14:30:47 -07:00
Google Team Member 85c95a8cbf feat: Add create_time and mime_type to ArtifactVersion
PiperOrigin-RevId: 819396924
2025-10-14 14:21:02 -07:00
Hangfei Lin cb6d583cad chore: Add RSVP link to ADK Community Call
This change adds a link to a Qualtrics form for RSVPing to the ADK Community Call in the README.

PiperOrigin-RevId: 819376219
2025-10-14 13:36:33 -07:00
Shangjie Chen 2c7a342593 feat: Add create_time and mime_type to ArtifactVersion
PiperOrigin-RevId: 819372593
2025-10-14 13:29:24 -07:00
Joseph Pagadora 9fbed0b15a fix: Overall eval status should be NOT_EVALUATED if no invocations were evaluated
PiperOrigin-RevId: 819322513
2025-10-14 11:36:33 -07:00
Xuan Yang bae21027d9 chore: Disable the scheduled execution for issue triage workflow
PiperOrigin-RevId: 819312327
2025-10-14 11:15:12 -07:00
George Weale 89344da813 chore: Update agent builder instructions and remove run command details
PiperOrigin-RevId: 819299339
2025-10-14 10:46:53 -07:00
Xiang (Sean) Zhou d22b8bf890 chore: Clarify how to use adk built-in tool in instruction
PiperOrigin-RevId: 818987709
2025-10-13 21:43:37 -07:00
George Weale dfb8638eae chore: fix the cleanup_unused_files tool in yaml agent to use the same directory as other tools
PiperOrigin-RevId: 818846060
2025-10-13 15:01:36 -07:00
George Weale 3c0b99a19e fix: rollback of add structured JSON logging with Cloud Trace correlation Close #1683
PiperOrigin-RevId: 818844025
2025-10-13 14:57:23 -07:00
George Weale d8548aabd2 feat: add structured JSON logging with Cloud Trace correlation Close #1683
- add a shared --structured_logs flag to adk web and adk api_server so users can opt into JSON-formatted output
- introduce CloudTraceJSONFormatter that emits structured entries and attaches current Cloud Trace/Span IDs when an OpenTelemetry context is active
- update CLI logging setup to clear duplicate stdout handlers when Cloud Logging is enabled and to reconfigure existing handlers (like from Uvicorn) so they also pick up the structured format and requested log level

With the flag disabled the CLIs keep their existing text logs; when enabled, the services now produce Cloud Logging–friendly JSON that can be correlated with distributed traces.

PiperOrigin-RevId: 818823818
2025-10-13 14:08:45 -07:00
Google Team Member df05ed6b3b feat: migrate invocation_context to callback_context
Update plugin manager and built-in plugins to prioritize CallbackContext. Keep InvocationContext access for legacy plugins with adapter. Change callback docs/tests to cover the new context.

PiperOrigin-RevId: 818822267
2025-10-13 14:05:44 -07:00
Google Team Member 2158b3c915 fix: correctly populate context_id in remote_a2a_agent library when constructing a2a request
PiperOrigin-RevId: 818813897
2025-10-13 13:45:54 -07:00
George Weale e2072af69f feat: migrate invocation_context to callback_context
Update plugin manager and built-in plugins to prioritize CallbackContext. Keep InvocationContext access for legacy plugins with adapter. Change callback docs/tests to cover the new context.

PiperOrigin-RevId: 818798087
2025-10-13 13:09:15 -07:00
Xiang (Sean) Zhou fa84bcb575 chore: Correct the callback signatures
PiperOrigin-RevId: 818781277
2025-10-13 12:30:37 -07:00
Shangjie Chen bb1ea74924 chore: Delegate the agent state reset logic to LoopAgent
This is so we don't need to worry about side effect of Loop in all agent type. Custom agent should do the same if there exists loop inside.

PiperOrigin-RevId: 818766305
2025-10-13 11:53:59 -07:00
Xiang (Sean) Zhou 214986ebeb chore: Adjust the instruction about default model
PiperOrigin-RevId: 818765464
2025-10-13 11:52:11 -07:00
Ankur Sharma 348e552ba6 chore: Remove deprecated run_evals from cli_eval.py
This change removes the `run_evals` function and its helper `_get_evaluator` from `cli_eval.py`, as they were marked as deprecated. Corresponding test mocks and patches in `test_fast_api.py` are also removed.

PiperOrigin-RevId: 818719422
2025-10-13 10:13:12 -07:00
Google Team Member e212ff558e feat: Add new methods in the artifact service interface
PiperOrigin-RevId: 818473733
2025-10-12 21:19:20 -07:00
Xuan Yang e63180cb62 feat: Add the support for returning struct_data.uri in DiscoveryEngineSearchTool
For https://github.com/google/adk-python/issues/3146

PiperOrigin-RevId: 818458080
2025-10-12 20:28:08 -07:00
Google Team Member 6da7274858 feat: Set default for bypass_multi_tools_limit to False for GoogleSearchTool and VertexAiSearchTool
PiperOrigin-RevId: 818053371
2025-10-11 09:57:36 -07:00
Xuan Yang b21d0a50d6 fix: Add more clear instruction to the doc updater agent about one PR for each recommended change
PiperOrigin-RevId: 817831087
2025-10-10 16:37:12 -07:00
Joe Fernandez 16b030b2b2 fix: Add a guideline to avoid content deletion
Directs agent to avoid deleting existing content

PiperOrigin-RevId: 817823999
2025-10-10 16:12:16 -07:00
Xinran (Sherry) Tang 59670d240e feat: Support resuming from a paused invocation starting from a sub-agent
PiperOrigin-RevId: 817766247
2025-10-10 13:24:02 -07:00
Google Team Member bddc70b5d0 fix: Better handling the A2A streaming tasks so calling Agent can tell whether it's in progress updates (thought) or the final response
PiperOrigin-RevId: 817682171
2025-10-10 09:46:54 -07:00
George Weale 85ed500871 fix: Add support for file URIs in LiteLLM content conversion to fix issue #3131
changed the LiteLLM content conversion so Part.file_data.file_uri (like the gs://…) becomes a file object with file_id, making sure GCS-backed files reach LiteLLM proxies instead of being dropped add unit tests covering both _get_content and _content_to_message_param paths for file URIs

PiperOrigin-RevId: 817658432
2025-10-10 08:39:17 -07:00
Ankur Sharma 998264a5b1 fix: Only exclude scores that are None
Scores with values 0 (or 0.0) were also getting excluded.

PiperOrigin-RevId: 817658059
2025-10-10 08:38:18 -07:00
Xuan Yang 9a6b8507f0 feat: Add bypass_multi_tools_limit option to GoogleSearchTool and VertexAiSearchTool
PiperOrigin-RevId: 817493869
2025-10-09 23:05:02 -07:00
Ankur Sharma 64646e0002 chore: Remove deprecated static methods from TrajectoryEvaluator
This change removes the `evaluate`, `_evaluate_row`, `are_tools_equal`, `_remove_tool_outputs`, `_report_failures`, and `_print_results` static methods from `TrajectoryEvaluator`, along with their corresponding unit tests. These methods were previously marked as deprecated.

PiperOrigin-RevId: 817477494
2025-10-09 22:02:24 -07:00
Hangfei Lin 81913c85f4 chore: Update README md with recent ADK features
This CL updates the "What's new" section to include Resumability, ReflectRetryToolPlugin, Context compaction, and Search tool support. It also moves "Agent Config" and "Tool Confirmation" from "What's new" to "Key Features".

PiperOrigin-RevId: 817469210
2025-10-09 21:23:37 -07:00
Xiang (Sean) Zhou 9e0b1fb62b fix: Create context cache only when prefix matches with previous request
PiperOrigin-RevId: 817468275
2025-10-09 21:19:28 -07:00
Hangfei Lin 731bb9078d chore: Announce the first ADK Community Call in the README
The added section provides details for the community call on Oct 15, 2025, including the agenda and links to join and add to calendars.

PiperOrigin-RevId: 817457276
2025-10-09 20:35:47 -07:00
Ankur Sharma ae139bb461 feat: ADK cli allows developers to create an eval set and add an eval case
Agent developers can now create an eval set and add eval cases through command line itself. Adding an eval case is limited only to specifying conversation scenarios.

Sample comamnds:
- Create an eval set:
adk eval_set create \
    contributing/samples/hello_world \
    set_01

- Add an eval case with scenario file
Content of scenarios.json file:
'{"scenarios": [{"starting_prompt": "hello", "conversation_plan": "world"}]}'

adk eval_set add_eval_case \
    contributing/samples/hello_world \
    set_01 \
    --scenarios scenarios.json

PiperOrigin-RevId: 817456117
2025-10-09 20:31:01 -07:00
Xinran (Sherry) Tang 9939e0b087 feat: Support resuming a parallel agent with multiple branches paused on tool confirmation requests
PiperOrigin-RevId: 817373403
2025-10-09 16:04:55 -07:00
Xiang (Sean) Zhou cc24d616f8 feat: Support ContentUnion as static instruction
PiperOrigin-RevId: 817278990
2025-10-09 11:52:24 -07:00
Wei Sun (Jack) 0aede9f1a1 docs: Update CHANGELOG with [847df16](https://github.com/google/adk-python/commit/847df1638cbf1686aa43e8e094121d4e23e40245)
PiperOrigin-RevId: 817267158
2025-10-09 11:24:48 -07:00
George Weale 847df1638c fix: handle App instances returned by agent_loader.load_agent
The `agent_loader.load_agent` method can now return an `App` object. This change unwraps the `App` to get its `root_agent` before passing it to the graph builder, makes sure a `BaseAgent` instance is always used

PiperOrigin-RevId: 817209601
2025-10-09 09:00:30 -07:00
Kacper Jawoszek 55aa6f669b feat(otel): set default_log_name for GCP logging exporter
Uses value of GCP_DEFAULT_LOG_NAME env var if it exists, defaults to literal adk-otel.

PiperOrigin-RevId: 817125337
2025-10-09 04:38:26 -07:00
Xuan Yang 9b8a4aad6f chore: Add an sample agent for the ReflectAndRetryToolPlugin
PiperOrigin-RevId: 817024977
2025-10-08 23:05:25 -07:00
Xiang (Sean) Zhou cac9fae829 chore: Don't label 'bot triaged' for PR
PiperOrigin-RevId: 816959715
2025-10-08 19:21:35 -07:00
Wei Sun (Jack) 24342e95f8 chore: Remove temp state deltas before appending an event
PiperOrigin-RevId: 816902208
2025-10-08 16:13:52 -07:00
Ankur Sharma cbe60c47aa feat: Adds data model to support UserSimulation
Details:
- Introduces a concept of `ConversationScenario` to represent a scenario that user simulator is supposed to follow.
- Introduces a `UserSimulator` interface, that one should implement. UserSimulator interface will be integrated with LocalEvalService in subsequent PRs.
PiperOrigin-RevId: 816883699
2025-10-08 15:23:57 -07:00
Xiang (Sean) Zhou 2efaa57575 chore: Don't label issue as bot triaged
PiperOrigin-RevId: 816873967
2025-10-08 14:58:49 -07:00
Xinran (Sherry) Tang 32f2ec3a78 feat: Set agent_state in invocation context right before yielding the checkpoint event
PiperOrigin-RevId: 816804179
2025-10-08 12:01:57 -07:00
Shangjie Chen 75179243b4 chore: Update human_tool_confirmation agent to use resumability feature
PiperOrigin-RevId: 816793131
2025-10-08 11:35:13 -07:00
Wei Sun (Jack) 03f051d3ed chore: Bumps version to v1.16.0 and updates CHANGELOG
PiperOrigin-RevId: 816788551
2025-10-08 11:26:58 -07:00
George Weale e858dc0799 chore: change how agent builder assistant instructions for model selection asking, to make it ask once for plan and one for model selection
PiperOrigin-RevId: 816788530
2025-10-08 11:22:54 -07:00
Google Team Member 0e3c0f78f5 feat: Make session_id optional in BaseArtifactService methods
PiperOrigin-RevId: 816782982
2025-10-08 11:08:41 -07:00
Xiang (Sean) Zhou f2bed14c4b chore: Adjust the LLM Request logging
1. function declarations is not necessary in the first tool
2. log the config

PiperOrigin-RevId: 816547534
2025-10-07 23:07:18 -07:00
Haoming Chen 30212669ff docs: Update BigQuery samples README
Add the new analyze_contribution tool and renumbering as the Github cannot display it correctly.

PiperOrigin-RevId: 816517893
2025-10-07 21:19:40 -07:00
Hangfei Lin 3f2b457efd fix: fix compaction logic
When there are multiple intervals and compactions, the original implementation only keep the last one. The right implementation is to keep as many compaction events/summary as the requested internals.

PiperOrigin-RevId: 816516662
2025-10-07 21:16:07 -07:00
Che Liu e55b8946d6 feat: Add ReflectRetryToolPlugin to reflect from errors and retry with different arguments when tool errors
This plugin intercepts tool failures, provides structured guidance to the LLM for reflection and correction, and retries the operation up to a configurable limit.

**Key Features:**

- **Concurrency Safe:** Uses locking to safely handle parallel tool
executions
- **Configurable Scope:** Tracks failures per-invocation (default) or globally
  using the `TrackingScope` enum.
- **Extensible Scoping:** The `_get_scope_key` method can be overridden to
  implement custom tracking logic (e.g., per-user or per-session).
- **Granular Tracking:** Failure counts are tracked per-tool within the
  defined scope. A success with one tool resets its counter without affecting
  others.
- **Custom Error Extraction:** Supports detecting errors in normal tool
responses
that
  don't throw exceptions, by overriding the `extract_error_from_result`
  method.

**Example:**
```python
from my_project.plugins import ReflectAndRetryToolPlugin, TrackingScope

# Example 1: (MOST COMMON USAGE):
# Track failures only within the current agent invocation (default).
error_handling_plugin = ReflectAndRetryToolPlugin(max_retries=3)

# Example 2:
# Track failures globally across all turns and users.
global_error_handling_plugin = ReflectAndRetryToolPlugin(max_retries=5,
scope=TrackingScope.GLOBAL)

# Example 3:
# Retry on failures but do not throw exceptions.
error_handling_plugin =
  ReflectAndRetryToolPlugin(max_retries=3,
  throw_exception_if_retry_exceeded=False)

# Example 4:
# Track failures in successful tool responses that contain errors.
class CustomRetryPlugin(ReflectAndRetryToolPlugin):
  async def extract_error_from_result(self, *, tool, tool_args,tool_context,
  result):
    # Detect error based on response content
    if result.get('status') == 'error':
        return result
    return None  # No error detected
error_handling_plugin = CustomRetryPlugin(max_retries=5)
```
PiperOrigin-RevId: 816456549
2025-10-07 17:56:54 -07:00
Douglas Reid 2b5acb98f5 feat(models): add support for gemma model via gemini api
Merge https://github.com/google/adk-python/pull/2857

Adds support for invoking Gemma models via the Gemini API endpoint. To support agentic function, callbacks are added which can extract and transform function calls and responses into user and model messages in the history.

This change is intended to allow developers to explore the use of Gemma models for agentic purposes without requiring local deployment of the models. This should ease the burden of experimentation and testing for developers.

A basic "hello world" style agent example is provided to demonstrate proper functioning of Gemma 3 models inside an Agent container, using the dice roll + prime check framework of similar examples for other models.

## Testing

### Testing Plan
- add and run integration and unit tests
- manual run of example `multi_tool_agent` from quickstart using new `Gemma` model
- manual run of `hello_world_gemma` agent

### Automated Test Results:
| Test Command | Results |
|----------------|---------|
| pytest ./tests/unittests | 4386 passed, 2849 warnings in 58.43s |
| pytest ./tests/unittests/models/test_google_llm.py | 100 passed, 4 warnings in 5.83s |
| pytest ./tests/integration/models/test_google_llm.py | 5 passed, 2 warnings in 3.73s |

### Manual Testing

Here is a log of `multi_tool_agent` run with locally-built wheel and using Gemma model.
```
❯ adk run multi_tool_agent
Log setup complete: /var/folders/bg/_133c0ds2kb7cn699cpmmh_h0061bp/T/agents_log/agent.20250904_152617.log
To access latest log: tail -F /var/folders/bg/_133c0ds2kb7cn699cpmmh_h0061bp/T/agents_log/agent.latest.log
/Users/<redacted>/venvs/adk-quickstart/lib/python3.11/site-packages/google/adk/cli/cli.py:143: UserWarning: [EXPERIMENTAL] InMemoryCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
  credential_service = InMemoryCredentialService()
/Users/<redacted>/venvs/adk-quickstart/lib/python3.11/site-packages/google/adk/auth/credential_service/in_memory_credential_service.py:33: UserWarning: [EXPERIMENTAL] BaseCredentialService: This feature is experimental and may change or be removed in future versions without notice. It may introduce breaking changes at any time.
  super().__init__()
Running agent weather_time_agent, type exit to exit.
[user]: what's the weather like today?
[weather_time_agent]: Which city are you asking about?

[user]: new york
[weather_time_agent]: OK. The weather in New York is sunny with a temperature of 25 degrees Celsius (77 degrees Fahrenheit).
```

And here is a snippet of a log generated with DEBUG level logging of the `hello_world_gemma` sample. It demonstrates how function calls are extracted and inserted based on Gemma model interactions:

```
...
2025-09-04 15:32:41,708 - DEBUG - google_llm.py:138 -
LLM Request:
-----------------------------------------------------------
System Instruction:
None
-----------------------------------------------------------
Contents:
{"parts":[{"text":"\n      You roll dice and answer questions about the outcome of the dice rolls.\n      You can roll dice of different sizes...\n"}],"role":"user"}
{"parts":[{"text":"Hi, introduce yourself."}],"role":"user"}
{"parts":[{"text":"Hello! I am data_processing_agent, a hello world agent that can roll many-sided dice and check if numbers are prime. I'm ready to assist you with those tasks. Let's begin!\n\n\n\n"}],"role":"model"}
{"parts":[{"text":"Roll a die with 100 sides and check if it is prime"}],"role":"user"}
{"parts":[{"text":"{\"args\":{\"sides\":100},\"name\":\"roll_die\"}"}],"role":"model"}
{"parts":[{"text":"Invoking tool `roll_die` produced: `{\"result\": 82}`."}],"role":"user"}
{"parts":[{"text":"{\"args\":{\"nums\":[82]},\"name\":\"check_prime\"}"}],"role":"model"}
{"parts":[{"text":"Invoking tool `check_prime` produced: `{\"result\": \"No prime numbers found.\"}`."}],"role":"user"}
{"parts":[{"text":"The die roll was 82, and it is not a prime number.\n\n\n\n"}],"role":"model"}
{"parts":[{"text":"Roll it again."}],"role":"user"}
-----------------------------------------------------------
Functions:

-----------------------------------------------------------

2025-09-04 15:32:41,708 - INFO - models.py:8165 - AFC is enabled with max remote calls: 10.
2025-09-04 15:32:42,693 - INFO - google_llm.py:180 - Response received from the model.
2025-09-04 15:32:42,693 - DEBUG - google_llm.py:181 -
LLM Response:
-----------------------------------------------------------
Text:
{"args":{"sides":100},"name":"roll_die"}
-----------------------------------------------------------
...
```
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2857 from douglas-reid:add-gemma-via-api e6d015f6a9ccbcf20ef7a7af8e4bbe1e9a5936b6
PiperOrigin-RevId: 816451001
2025-10-07 17:38:35 -07:00
Hangfei Lin 84f2f417f7 fix: Rollback compaction handling from _get_contents
The sorting may cause problems in complex cases so rolling it back. Will implement it with a non-sorting approach.

PiperOrigin-RevId: 816420710
2025-10-07 16:11:36 -07:00
Google Team Member 8110e41b36 fix: VertexSessionService with adding base_url override to base api override without removing initialized http_options
PiperOrigin-RevId: 816409410
2025-10-07 15:43:17 -07:00
Xuan Yang b0f0698ec2 chore: Add a sample agent to demonstrate that built-in google search tool and VertexAiSearchTool can be used together with other tools
PiperOrigin-RevId: 816396360
2025-10-07 15:08:53 -07:00
Xinran (Sherry) Tang db41f54e7b chore: When processing pending tool confirmation requests, only look at events in the same branch
PiperOrigin-RevId: 816387687
2025-10-07 14:48:19 -07:00
Shangjie Chen 636def3687 fix: Add AuthConfig json serialization in vertex ai session service
Resolves https://github.com/google/adk-python/issues/2035

PiperOrigin-RevId: 816387628
2025-10-07 14:47:28 -07:00
Xiang (Sean) Zhou 3f86760e0b chore: Remove unnecessary check tool type and tool attribute
tool in config.tools cann't be ToolDict and must have computer_use attr

PiperOrigin-RevId: 816368064
2025-10-07 14:01:53 -07:00
Yifan Wang 5ac446d947 chore: add invocation_id to AgentRunRequest for resuming long running functions
PiperOrigin-RevId: 816362937
2025-10-07 13:49:50 -07:00
Xuan Yang 2699ad7aff chore: fix the test_llm_agent_fields.py by adding a mock for google.auth.default
PiperOrigin-RevId: 816319357
2025-10-07 12:05:48 -07:00
Xuan Yang 4485379a04 ADK changes
PiperOrigin-RevId: 816288113
2025-10-07 10:59:19 -07:00
Xiang (Sean) Zhou 0989d64688 chore: Remove unnecessary check tool type and tool attribute
tool in config.tools cann't be ToolDict and must have computer_use attr

PiperOrigin-RevId: 816283438
2025-10-07 10:48:48 -07:00
Shangjie Chen 90d4c19c51 feat: Migrate vertex ai session service to use agent engine sdk
PiperOrigin-RevId: 816259798
2025-10-07 09:58:27 -07:00
Xiang (Sean) Zhou 3be9cd844c chore: Let tools to handle root directory resolvement and model only knows the project name and always use relative path
PiperOrigin-RevId: 816213558
2025-10-07 08:11:06 -07:00
Hangfei Lin 3f4bd67b49 fix: Make compactor optional in EventsCompactionConfig and add a default
If `EventsCompactionConfig` is provided without a `compactor`, a `SlidingWindowCompactor` is now automatically instantiated using the `root_agent`'s LLM. This simplifies configuration by providing a sensible default.

PiperOrigin-RevId: 816038579
2025-10-06 22:20:49 -07:00
Bo Yang 238472d083 fix: Updates the load_artifacts tool so that the model can reliability call it for follow up questions about the same artifact
PiperOrigin-RevId: 816025399
2025-10-06 21:34:51 -07:00
Hangfei Lin f1abdb1938 fix: Rename SlidingWindowCompactor to LlmEventSummarizer and refine its docstring
The class is now named `LlmEventSummarizer` to better reflect that its primary function is to use an LLM to summarize events. The docstring has been updated to clarify that this class is responsible *only* for the LLM-based summarization of a given set of events, while the logic for determining *when* and *which* events form the sliding window is handled by an external component, such as an ADK Runner.

PiperOrigin-RevId: 815976264
2025-10-06 18:54:20 -07:00
Hangfei Lin 68402bda49 fix: Set default response modality to AUDIO in run_session
Some native audio models require the modality to be set, so we default to AUDIO if not specified in `RunConfig`.

PiperOrigin-RevId: 815952039
2025-10-06 17:37:10 -07:00
Xiang (Sean) Zhou 90e1e3e10c chore: Add sample agent for testing oatuh2 client credentials grant type
PiperOrigin-RevId: 815863131
2025-10-06 13:34:09 -07:00
Haoming Chen 4bb089d386 feat: Add BigQuery analyze_contribution tool
This change introduces a new `analyze_contribution` function in `query_tool.py` which uses BigQuery ML's `CREATE MODEL` with `CONTRIBUTION_ANALYSIS` type and `ML.GET_INSIGHTS` to analyze the contribution of different dimensions to a given metric. The new function is also added to the `bigquery_toolset`.

PiperOrigin-RevId: 815849281
2025-10-06 12:59:09 -07:00
Xiang (Sean) Zhou 5c6cdcd197 feat: Support Oauth2 client credentials grant type
PiperOrigin-RevId: 815813477
2025-10-06 11:28:17 -07:00
George Weale 46d73be41a chore: Add more info to "Session not found" error message in ADK runners for differently named app and folder
PiperOrigin-RevId: 815795412
2025-10-06 10:48:28 -07:00
Hangfei Lin e0dd06ff04 feat: implementation of LLM context compaction
Provide a more efficient way to compact LLM context for better agentic performance.

PiperOrigin-RevId: 815785898
2025-10-06 10:28:46 -07:00
Xiang (Sean) Zhou ca6a4340f4 chore: Move adk knowledge agent out of adk agent builder folder
PiperOrigin-RevId: 815771308
2025-10-06 09:57:21 -07:00
George Weale 86de3ef7e3 chore: google.genai instead of `google.generativeai'
PiperOrigin-RevId: 815759570
2025-10-06 09:27:13 -07:00
Max Ind bd76b46ce2 feat(otel): Switch CloudTraceSpanExporter to telemetry.googleapis.com
PiperOrigin-RevId: 815675872
2025-10-06 05:14:32 -07:00
Xiang (Sean) Zhou 4b47a0a552 chore: Add instructions for callback signatures
PiperOrigin-RevId: 815549924
2025-10-05 21:47:53 -07:00
Xuan Yang 84c1faeeef chore: Introduce the remote A2A ADK Knowledge Agent to Agent Builder Assistant
PiperOrigin-RevId: 815543707
2025-10-05 21:21:19 -07:00
Xiang (Sean) Zhou c6dd444fc9 fix: Adapt to new computer use tool name in genai sdk 1.41.0
1.40.0 has some bug that caused some UT tests failures

PiperOrigin-RevId: 815098429
2025-10-04 08:53:13 -07:00
Google Team Member d1efc8461e feat: Migrate vertex_ai_session_service to use Agent Engine SDK
PiperOrigin-RevId: 814967790
2025-10-03 22:14:23 -07:00
Shangjie Chen 97b950b36b feat: Migrate vertex_ai_session_service to use Agent Engine SDK
PiperOrigin-RevId: 814948921
2025-10-03 21:00:15 -07:00
Google Team Member 960eda3d1f feat: Add dry_run functionality to BigQuery execute_sql tool
PiperOrigin-RevId: 814854520
2025-10-03 15:36:58 -07:00
Xiang (Sean) Zhou 0b84d3eea7 chore: Show relative path in response if root directory already set in session state
PiperOrigin-RevId: 814768273
2025-10-03 11:33:24 -07:00
Xiang (Sean) Zhou 611b604bdc chore: Emphasize not to ask for root_directory if it's set in the context
PiperOrigin-RevId: 814738676
2025-10-03 10:14:44 -07:00
Xiang (Sean) Zhou 33b2d495be chore: Emphasize "model" property can inherit from parent LlmAgent
PiperOrigin-RevId: 814715394
2025-10-03 09:06:33 -07:00
Max Ind 0162898707 ADK changes
PiperOrigin-RevId: 814614027
2025-10-03 02:56:51 -07:00
Xuan Yang 42db35111b chore: fix typo for GenerateContentConfig in Agent Builder Assistant
PiperOrigin-RevId: 814495803
2025-10-02 19:56:55 -07:00
George Weale dd0571ad09 chore: Clarify write_config_files usage for sub-agent YAML files
PiperOrigin-RevId: 814489632
2025-10-02 19:36:15 -07:00
George Weale a4ef7edcbb chore: add __init__.py prompt for tool imports
PiperOrigin-RevId: 814488943
2025-10-02 19:33:58 -07:00
Xiang (Sean) Zhou c5b976b306 chore: Create the context cache based on the token count of previous request
before this change, we estimate the token count of the contents to cache and use it to compare with the threshold user set. but that's not precise , so we use the actual prompt token count of previous llm request.

We won't create cache for the very initial request

PiperOrigin-RevId: 814484840
2025-10-02 19:22:00 -07:00
Xuan Yang 420df25f58 chore: add a remote A2A knowledge agent for Agent Builder Assistant
PiperOrigin-RevId: 814484204
2025-10-02 19:20:36 -07:00
Google Team Member a9b76b9061 ADK changes
PiperOrigin-RevId: 814417092
2025-10-02 15:49:48 -07:00
Google Team Member 65d6da081c ADK changes
PiperOrigin-RevId: 814413627
2025-10-02 15:49:35 -07:00
Shangjie Chen b170a84279 chore: Handle exception in preload_memory_tool to not fail the llm request
Resolves https://github.com/google/adk-python/issues/3069

PiperOrigin-RevId: 814391260
2025-10-02 14:41:27 -07:00
Wei Sun (Jack) 5b8d523a4b ADK changes
PiperOrigin-RevId: 814367778
2025-10-02 13:44:16 -07:00
Xuan Yang d3148dacc9 ADK changes
PiperOrigin-RevId: 814319961
2025-10-02 13:44:05 -07:00
George Weale 2e2d61b6fe fix: Set max_output_tokens for the agent builder
PiperOrigin-RevId: 814317909
2025-10-02 13:43:55 -07:00
Ankur Sharma 65554d6621 chore: Update AgentEvaluator to use EvalConfig
We updated the one of the public methods on AgentEvaluator to take in eval metric configurations using a more formal EvalConfig data model.

We also mark "criteria" field on the method as deprecated.

Updated some integration test cases.

PiperOrigin-RevId: 814314134
2025-10-02 13:43:44 -07:00
George Weale e68006386f fix: Fixes a bug that causes intermittent pydantic validation errors when uploading files
The root cause is an unsafe in-memory mutation. The `SaveFilesAsArtifactsPlugin` was saving a direct reference to the message part and then modifying the message list in-place. This created a race condition where downstream code could alter the original part *after* it had been saved as an artifact, leading to a corrupted state.
This CL saves a `copy.copy()` of the artifact, which create a snapshot of the data.
Also Changes the plugin to return a new `types.Content` object instead of modifying the original message in-place

PiperOrigin-RevId: 814308070
2025-10-02 13:43:34 -07:00
George Weale f667c7445e chore: deprecate global_instructions and make it a plugin instead
PiperOrigin-RevId: 814307563
2025-10-02 13:43:22 -07:00
Xiang (Sean) Zhou 29f18f4eea chore: Add a sample agent to test pydantic models as function tool argument
PiperOrigin-RevId: 814293450
2025-10-02 13:43:10 -07:00
Xiang (Sean) Zhou 571c802fba fix: Convert argument to pydantic model when tool declare to accept pydantic model as argument
PiperOrigin-RevId: 814273005
2025-10-02 13:43:00 -07:00
Xiang (Sean) Zhou c46308b7cf chore: Add session patch endpoint to api server for state update
This is allow user to update session state without running the agent. e.g. if I want to test some case when session has certain state on adk web.

PiperOrigin-RevId: 814252851
2025-10-02 13:42:49 -07:00
Hoonji Baek 822efe0065 feat: Adds adk web options for custom logo
Allows users to configure a custom text and logo for their ADK Web app using `--logo-text` and `--logo-image-url` flags.

PiperOrigin-RevId: 814016542
2025-10-02 13:42:38 -07:00
Shangjie Chen 55bc985821 chore: Fix vertexai import rule of memory service for google internal dependencies
PiperOrigin-RevId: 813941520
2025-10-02 13:42:23 -07:00
Google Team Member da62700d73 feat: Spanner ADK toolset supports customizable template SQL and parameterized SQL
PiperOrigin-RevId: 813909122
2025-10-01 14:15:01 -07:00
Google Team Member a5cf80b952 fix: Handling of A2ATaskStatusUpdateEvent when streaming in remote_a2a_agent
The proto has the Message object in the TaskStatus.

PiperOrigin-RevId: 813844289
2025-10-01 11:43:03 -07:00
Xuan Yang 29968d44ae chore: Remove get_working_directory_info from instruction template for agent builder assistant
PiperOrigin-RevId: 813495752
2025-09-30 17:29:33 -07:00
Yifan Wang ce2167861c chore: Adding builder endpoints, WIP
PiperOrigin-RevId: 813489379
2025-09-30 17:10:38 -07:00
Joseph Pagadora 8c73d29c75 feat: Add HallucinationsV1 evaluation metric
PiperOrigin-RevId: 813456369
2025-09-30 15:39:10 -07:00
Xuan Yang a239716930 ADK changes
PiperOrigin-RevId: 813321782
2025-09-30 10:18:30 -07:00
Google Team Member c51ea0b52e fix: VertexSessionService with adding base_url override to base api override without removing initialized http_options
PiperOrigin-RevId: 813319796
2025-09-30 10:14:58 -07:00
Liang Wu 8f3ca0359e fix: fix the instruction in workflow_triage example agent
PiperOrigin-RevId: 813305068
2025-09-30 09:37:54 -07:00
Joe Fernandez 745996212d fix: Added more agent instructions for doc content changes
Add directives for content updates and writing style

PiperOrigin-RevId: 813284600
2025-09-30 08:44:59 -07:00
Shangjie Chen 83fd045718 feat: Migrate VertexAiMemoryBankService to use Agent Engine SDK
PiperOrigin-RevId: 813104746
2025-09-29 23:14:50 -07:00
Shangjie Chen ce9c39f5a8 feat: Implement checkpoint and resume logic for LoopAgent
PiperOrigin-RevId: 813096880
2025-09-29 22:45:57 -07:00
Wei Sun (Jack) d5c46e4960 fix: Do not re-create App object when loader returns an App
PiperOrigin-RevId: 813083541
2025-09-29 22:02:19 -07:00
Xinran (Sherry) Tang fbf75761bb feat: Modify runner to support resuming an invocation (optionally with a function response)
PiperOrigin-RevId: 813008406
2025-09-29 17:35:18 -07:00
Xinran (Sherry) Tang f005414895 feat: Make resumable llm agents yield checkpoint events
PiperOrigin-RevId: 813001108
2025-09-29 17:08:58 -07:00
Ankur Sharma 609a2358eb chore: PrettyPrint the output of detailed results generated from adk eval cli command
PiperOrigin-RevId: 812912413
2025-09-29 13:09:31 -07:00
Xinran (Sherry) Tang 772658fd81 chore: Refactor runner run_async flow to extract out execution context setup logic
PiperOrigin-RevId: 812894540
2025-09-29 12:21:45 -07:00
Google Team Member 8e5f361264 fix: Update remote_a2a_agent to better handle streaming events and avoid duplicate responses
Currently, the A2A Task -> ADK event conversion is producing the same events on the last two update events (the last is a status update marking the task complete)

The change here based on A2AClientEvent(task, update):
 - if the update == None: handle the non-streaming task case and also streaming case for the initial task creation event
 - if the update = TaskStatusUpdateEvent AND a message is set: emit an event with that message
 - if a task status update AND no message is set: don't emit event (for example, the final status update)
 - if the update is ArtifactUpdateEvent and it's final artifact: emit the event

PiperOrigin-RevId: 812878869
2025-09-29 11:42:49 -07:00
Google Team Member b1ee013347 chore: Remove debug print from get_agent_graph
PiperOrigin-RevId: 812767234
2025-09-29 06:48:06 -07:00
Shangjie Chen 2f1040f296 feat: Implement checkpoint and resume logic for ParallelAgent
PiperOrigin-RevId: 812658378
2025-09-29 00:26:32 -07:00
Xiang (Sean) Zhou 943abec7c0 chore: Clarify the rule for getting tool name prefix in instruction
PiperOrigin-RevId: 812097390
2025-09-26 23:10:24 -07:00
Google Team Member 3f28e30c6d feat: add citation_metadata to LlmResponse
PiperOrigin-RevId: 811997009
2025-09-26 16:31:01 -07:00
Shangjie Chen 7b707cebea chore: Simplfiy the parallel agent py version handling logic
PiperOrigin-RevId: 811992425
2025-09-26 16:15:51 -07:00
Ankur Sharma c984b9e552 feat: Add Rubric based tool use metric
The PR does two main things:
1) Introduces a new rubric based tool use metric
2) Given that we now have two rubric based metric, we refactor and create a new RubricBasedEvaluator interface.

PiperOrigin-RevId: 811983514
2025-09-26 15:47:42 -07:00
Xuan Yang a959653cf3 chore: bump version to 1.15.1 with a patch for Agent Engine
PiperOrigin-RevId: 811981894
2025-09-26 15:42:12 -07:00
Shangjie Chen 1ee01cc05a feat: Implement checkpoint and resume logic for SequentialAgent
PiperOrigin-RevId: 811977004
2025-09-26 15:26:42 -07:00
Xinran (Sherry) Tang 28d44a365a test: Make testing_utils.InMemoryRunner support ADK App and add utils for extracting event contents for testing resumability
PiperOrigin-RevId: 811933527
2025-09-26 13:22:11 -07:00
Sasha Sobran e172811bc7 fix: unbreak client closed errors when using vertexai session service
PiperOrigin-RevId: 811911528
2025-09-26 12:16:37 -07:00
Xuan Yang da6f1d3653 chore: Release ADK 1.15.0
PiperOrigin-RevId: 811655912
2025-09-25 22:17:23 -07:00
Shangjie Chen 2c752934a8 feat: Skip running a workflow agent if it has no sub-agents
PiperOrigin-RevId: 811528166
2025-09-25 15:39:38 -07:00
Xinran (Sherry) Tang b2b80e7fa0 feat: Pause invocations on long running function calls for resumable apps
PiperOrigin-RevId: 811518771
2025-09-25 15:11:11 -07:00
Xuan Yang dd1ffad394 chore: Update google-genai version constraint
Fixes https://github.com/google/adk-python/issues/2968

PiperOrigin-RevId: 811475972
2025-09-25 13:21:45 -07:00
Shangjie Chen 8b081751ed feat: Add core checkpointing primitive for base agent
PiperOrigin-RevId: 811458903
2025-09-25 12:35:36 -07:00
Xinran (Sherry) Tang b5a65fb4f4 chore: Remove the too-detailed edge case descriptions for resumability
PiperOrigin-RevId: 811432962
2025-09-25 11:32:38 -07:00
Shangjie Chen 839d2e43bb feat: Define an AgentState to be used for resuming agent invocation
PiperOrigin-RevId: 811414736
2025-09-25 10:49:49 -07:00
Xiang (Sean) Zhou 1589fcdd86 chore: Replace github HTTP URIs with GCS HTTP URIs in static non-text content sample agent
mainly because http://github.com/robots.txt disallows `/*/raw/` path. using GCS HTTP URIs is more reliable with Gemini model.

PiperOrigin-RevId: 811409688
2025-09-25 10:38:04 -07:00
Max Ind e7528aebd4 feat(otel): adjust telemetry to follow OTLP 1.37 GenAI semconv
Changes include:
- Implementing missing attributes. e.g. 'gen_ai.agent.name'
- Specifying reasons for not filling out some conditionally required attributes. e.g. 'gen_ai.data_source.id'
- Specifying reasons for not including certain attributes which are specified in current semconv. e.g. inference attributes on agent spans

PiperOrigin-RevId: 811379706
2025-09-25 09:25:15 -07:00
Xinran (Sherry) Tang cbb6e4945a feat: Add a app level config for resumable applications
PiperOrigin-RevId: 811272046
2025-09-25 03:14:34 -07:00
Xiang (Sean) Zhou c6b6b6f3c6 chore: Add log-level parameter to cache analysis experiments
this is to allow turning on debug log for debugging if some unexpected behavior observed during running cache analysis experiments.

PiperOrigin-RevId: 811189954
2025-09-24 22:44:41 -07:00
Google Team Member c8c6cd70a4 feat: Introduce ExtendedOAuth2 scheme that auto-populates auth/token URLs
Use auto-discovered auth_endpoint and token_endpoint in CredentialManager.

PiperOrigin-RevId: 811183929
2025-09-24 22:21:07 -07:00
Xiang (Sean) Zhou f159bd9c87 fix: Use str() to calculate fingerprint instead of json.dumps
This is to avoid serialization issue for some fields that are not json serializable.
meanwhile restructure the debug logs in context cache manager for better debugging potential issues.

PiperOrigin-RevId: 811182492
2025-09-24 22:14:40 -07:00
Ankur Sharma d48679582d feat: Populate AppDetails to each Invocation
AppDetails require two pieces of information:
1) Instructions
2) Tools

Both these pieces of information are gathered using the llm_request that was passed to the model. This approach, slightly invasive, ensures that we capture the "exact" instructions and tools that were given to the model.

PiperOrigin-RevId: 811180648
2025-09-24 22:06:56 -07:00
Google Team Member 2a2da0fe03 feat: Introduce OAuth2DiscoveryManager to fetch metadata needed for OAuth
This is the first step to bring ADK to compliance with MCP Authorization Spec.

PiperOrigin-RevId: 811177152
2025-09-24 21:53:48 -07:00
Ankur Sharma 5a485b01cd feat: Adds Rubric based final response evaluator
The evaluator uses a set of rubrics to assess the quality of the agent's final response.

PiperOrigin-RevId: 811154498
2025-09-24 20:30:51 -07:00
Ankur Sharma 01923a9227 feat: Data model for storing App Details and data model for steps
Details:
1. Data model for storing App Details (the agentic system)
As we move towards LLM as Judge metrics, we see that some of these metrics need information about the Agentic system that was used for inferencing. We add a data model to capture that.

2. Data model for Steps
We refine the concept of intermediate data. Previously it stored data in the form of a multiple lists, thereby losing out on the chronological information. This information is needed for some of the metrics. So we refine the concept of intermediate data as series of logical steps that an Agent Take.

PiperOrigin-RevId: 811122784
2025-09-24 18:41:38 -07:00
Xiang (Sean) Zhou 08f3b48305 chore: Add sample agent to test non-text content in static instruction
PiperOrigin-RevId: 810999310
2025-09-24 13:03:11 -07:00
Xuan Yang 6db096a3f4 chore: remove unsupported 'type': 'unknown' in test_common.py for fastapi 0.117.1
PiperOrigin-RevId: 810673476
2025-09-23 19:44:49 -07:00
Xiang (Sean) Zhou 47bd34ac28 chore: Fix the type annotation
PiperOrigin-RevId: 810611299
2025-09-23 15:50:19 -07:00
Xiang (Sean) Zhou ae5592e242 chore: Add tests for instruction provider and merge test_static_instructions.py to test_intructions.py
PiperOrigin-RevId: 810610507
2025-09-23 15:47:46 -07:00
Xiang (Sean) Zhou 61213ce4d4 feat: Support non-text content in static instruction
move them to user contents and reference them from instruction

PiperOrigin-RevId: 810587466
2025-09-23 15:36:15 -07:00
Xuan Yang e86ca5762a chore: remove internal TODO comment
PiperOrigin-RevId: 810583734
2025-09-23 15:36:06 -07:00
Google Team Member cbb609233b chore: Sample Spanner RAG agent that wraps search_tool
Also modified README to add instructions on when to use which tool.

PiperOrigin-RevId: 810563458
2025-09-23 15:35:57 -07:00
George Weale 657369cffe fix: Adds plugin to save artifacts for issue #2176
PiperOrigin-RevId: 810522939
2025-09-23 15:35:48 -07:00
Xiang (Sean) Zhou c944a12e31 chore: Remove query schema mode, as it doesn't perform well as embedded schema mode
PiperOrigin-RevId: 810517055
2025-09-23 15:35:40 -07:00
Xiang (Sean) Zhou 26990c2622 chore: Add sample agent to test static instruction
PiperOrigin-RevId: 810516925
2025-09-23 15:35:31 -07:00
Xiang (Sean) Zhou f2ce990867 chore: Add experimental annotation to GeminiContextCacheManager
PiperOrigin-RevId: 810503537
2025-09-23 15:35:22 -07:00
shsha4 86dea5b53a fix(mcp): Initialize tool_name_prefix in MCPToolse
Merge https://github.com/google/adk-python/pull/2823

Description
  This change introduces a tool_name_prefix attribute to McpToolset and McpToolsetConfig. This allows for adding a prefix to the
  names of all tools within the toolset, which can help avoid naming collisions and provide better organization.

  The implementation involves updating the McpToolset's __init__ and from_config methods to handle the new tool_name_prefix and
  adding the corresponding field to McpToolsetConfig.

  Testing Plan
  A new unit test file has been added to ensure the functionality works as expected.

   - `tests/unittests/tools/test_mcp_toolset.py`:
     - The test_mcp_toolset_with_prefix test case verifies that the tool_name_prefix is correctly applied to the tool names
       retrieved from the toolset.
     - All tests were run via pytest and passed.

  Related Issue
   - Closes #2814

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2823 from shsha4:fix/issue-2814 e8e5b0d6d5f406d3875faf2229a96701725b7a5e
PiperOrigin-RevId: 810500616
2025-09-23 15:35:12 -07:00
Xiang (Sean) Zhou 6ca2aee829 ADK changes
PiperOrigin-RevId: 810492858
2025-09-23 15:35:02 -07:00
Xuan Yang 374522197f ADK changes
PiperOrigin-RevId: 810223422
2025-09-23 15:34:53 -07:00
Google Team Member aef1ee97a5 fix: make a copy of the columns instead of modifying it in place
This avoid unintentional modifications, especially in the case of a wrapped tool.

PiperOrigin-RevId: 810175539
2025-09-23 15:34:43 -07:00
Xiang (Sean) Zhou 38bbde6d56 chore: Annotate CachePerformanceAnalyzer as experimental
PiperOrigin-RevId: 809434619
2025-09-23 15:34:34 -07:00
TanejaAnkisetty 78fd4803d5 chore: Set role to user if new_message doesn't have role in Runner.run_async()
Merge https://github.com/google/adk-python/pull/2458

**Summary**
Verifies that user-provided messages are always passed to the LLM as 'user' role, regardless of whether the role is explicitly set in types.Content. Before the current fix, if the LlmRequest from the user doesn't have the 'user' role, but has the user content, then the text is being replaced with the standard text - "Handle the requests as specified in the System Instruction." and the content from the user is completely ignored and not passed into the LLM.

**Code to replicate the problem**

```
from google.adk.agents import LlmAgent
from google.adk.sessions import InMemorySessionService
from google.adk.runners import Runner
from google.genai.types import Content, Part
from google.adk.models.lite_llm import LiteLlm
from google.adk.models import LlmRequest
from google.genai import types
from pydantic import Field

import litellm
litellm._turn_on_debug()

import warnings
warnings.filterwarnings("ignore", category=UserWarning, message=".*InMemoryCredentialService.*")

import os
from dotenv import load_dotenv

# Load environment variables from the agent directory's .env file
load_dotenv()

OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")

# Define agent with output_key
root_agent = LlmAgent(
    name="name_of_agent",
    model=LiteLlm(model="azure/gpt-4o-mini"),
    instruction="You are a customer agent to help the users with their concerns."
)

# --- Setup Runner and Session ---
app_name, user_id, session_id = "state_app", "user1", "session1"

session_service = InMemorySessionService()

runner = Runner(
    agent=root_agent,
    app_name=app_name,
    session_service=session_service
)

print(f"Runner created for agent '{runner.agent.name}'.")

session = await session_service.create_session(
    app_name=app_name,
    user_id=user_id,
    session_id=session_id
)

# --- Run the Agent ---

async def call_agent_async(query: str, runner, user_id, session_id):

    user_message = Content(parts=[Part(text=query)])

    async for event in runner.run_async(
        user_id=user_id,
        session_id=session_id,
        new_message=user_message
    ):
        print("event")
        print(f"  [Event]\n  Author: {event.author}\n  Type: {type(event).__name__}",
        f"\n  Final: {event.is_final_response()}\n  Content: {event.content}")

    return event

event = await call_agent_async("What is the capital of India.",runner=runner,user_id=user_id,session_id=session_id)
```
**Before the fix (current adk-python code output)**
```
00:29:24 - LiteLLM:DEBUG: utils.py:348 -

00:29:24 - LiteLLM:DEBUG: utils.py:348 - Request to litellm:
00:29:24 - LiteLLM:DEBUG: utils.py:348 - litellm.acompletion(model='azure/gpt-4o-mini', messages=[{'role': 'developer', 'content': 'You are a customer agent to help the users with their concerns.\n\nYou are an agent. Your internal name is "name_of_agent".'}, {'role': 'user', 'content': 'Handle the requests as specified in the System Instruction.'}], tools=None, response_format=None)
```

**After the fix (after resolving the fix)**
```
00:28:46 - LiteLLM:DEBUG: utils.py:349 -

00:28:46 - LiteLLM:DEBUG: utils.py:349 - Request to litellm:
00:28:46 - LiteLLM:DEBUG: utils.py:349 - litellm.acompletion(model='azure/gpt-4o-mini', messages=[{'role': 'developer', 'content': 'You are a customer agent to help the users with their concerns.\n\nYou are an agent. Your internal name is "name_of_agent".'}, {'role': 'user', 'content': 'What is the capital of India.'}], tools=None, response_format=None)
```

**Testing**
Following unit test is created to test the applied changes and added in the location as suggested in the guidelines.
adk-python\tests\unittests\models\test_base_llm.py

```
import pytest
from google.genai import types
from google.adk.models.llm_request import LlmRequest
from google.adk.models.lite_llm import _get_completion_inputs

@pytest.mark.parametrize("content_kwargs", [
    # Case 1: Explicit role provided
    {"role": "user", "parts": [types.Part(text="This is an input text from user.")]},
    # Case 2: Role omitted, should still be treated as 'user'
    {"parts": [types.Part(text="This is an input text from user.")]}
])
def test_user_content_role_defaults_to_user(content_kwargs):
    """
    Verifies that user-provided messages are always passed to the LLM as 'user' role,
    regardless of whether the role is explicitly set in types.Content.

    The helper `_get_completion_inputs` should give normalize messages so that
    explicit 'user' and implicit (missing role) are equivalent.
    """
    llm_request = LlmRequest(
        contents=[types.Content(**content_kwargs)],
        config=types.GenerateContentConfig()
    )

    messages, _, _, _ = _get_completion_inputs(llm_request)

    assert all(
        msg.get("role") == "user" for msg in messages
    ), f"Expected role 'user' but got {messages}"
    assert any(
        "This is an input text from user." == (msg.get("content") or "")
        for msg in messages
    ), f"Expected the user text to be preserved, but got {messages}"
```

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2458 from TanejaAnkisetty:bug/agent-user-content 381b01418d249b9e6bd91ebb518ff25339a8e47b
PiperOrigin-RevId: 809281620
2025-09-23 15:34:21 -07:00
Google Team Member 632bf8b0bc fix: Filter out thought parts when saving agent output to state
PiperOrigin-RevId: 809270320
2025-09-19 18:58:59 -07:00
Wei Sun (Jack) 6e834d3fac feat(conformance): Skips recording for inner runner of AgentTool in conformance tests
PiperOrigin-RevId: 809252704
2025-09-19 17:36:18 -07:00
Xiang (Sean) Zhou 9be9cc2fee feat: Support static instructions
Static instructions:
Always added to system instructions for context caching

Dynamic instructions:
Added to system instructions when no static instruction exists (for backward compatibility), OR inserted before last batch of continuous user content when static instructions exist

PiperOrigin-RevId: 809170679
2025-09-19 13:46:36 -07:00
Xiang (Sean) Zhou f4e1fd962e chore: Add sample agent for content cache and basic profiling
PiperOrigin-RevId: 809166922
2025-09-19 13:37:57 -07:00
Xiang (Sean) Zhou c66245a3b8 feat: support context caching
1. add a context cache config in app level which will apply to all agents in the app
2. pass on cache config through invocation context to llm_reqeust
3. store cache metadata in llm_response
4. lookup old cache metadata from latest event for reusing old cache
5. create new cache if old cache cannot be reused

PiperOrigin-RevId: 809158578
2025-09-19 13:17:02 -07:00
Xinran (Sherry) Tang 13a95c463d feat: Add get_events util function in invocation_context
PiperOrigin-RevId: 809111315
2025-09-19 11:21:35 -07:00
Kacper Jawoszek f157b2ee4c feat(otel): support standard OTel env variables for exporter endpoints
ADK web server will automatically setup OTel providers with exporters if any of the .*_ENDPOINT variables from https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/ is set.

PiperOrigin-RevId: 809079453
2025-09-19 09:59:58 -07:00
Bastien Jacot-Guillarmod ccd0e12b42 chore: Internal change
PiperOrigin-RevId: 809077633
2025-09-19 09:55:17 -07:00
Kacper Jawoszek 3b80337faf feat(otel): temporarily disable Cloud Monitoring integration in --otel_to_cloud
Currently there is chance for Cloud Monitoring-related errors in logs during shutdown. Let's disable metrics part until it is fixed.

PiperOrigin-RevId: 808930635
2025-09-19 01:28:15 -07:00
Xuan Yang d4eaa06041 chore: update ADK release analyzer agent to use the compare link instead of commit link
PiperOrigin-RevId: 808900352
2025-09-18 23:44:12 -07:00
Xuan Yang 4d39563ea4 chore: add yaml files to the ADK Vertex AI Search datastore
PiperOrigin-RevId: 808895175
2025-09-18 23:27:34 -07:00
Wei Sun (Jack) 006a406f5b chore: Allow outputting non-acsii without escape and excludes fields in the dumped yaml files in the yaml_utils.py
Also excludes `_adk_recordings_config` for `adk conformance create` command.

PiperOrigin-RevId: 808865049
2025-09-18 21:24:14 -07:00
Wei Sun (Jack) f39df4155e feat(conformance): Supports content and state_delta in TestCase.user_messages and initial_state for session creation
PiperOrigin-RevId: 808827170
2025-09-18 18:55:38 -07:00
Hangfei Lin 1a91bb2a59 chore: Update comments in Compaction to clarify timestamp-based ranges
The docstrings for `compaction_range` and `compacted_content` are updated to reflect that compaction is based on timestamp ranges rather than sequence IDs, and to use consistent terminology ("compacted" instead of "summarized").

PiperOrigin-RevId: 808770610
2025-09-18 15:51:40 -07:00
Wei Sun (Jack) 9c2b7091ee refactor(comformance): Improves field comparison logic in replay plugin with nested exclude dict from pydantic v2
Also use `ReplayConfigError` to replace `ValueError`s

PiperOrigin-RevId: 808750606
2025-09-18 15:01:19 -07:00
Nikhil Purwant 21c26f92d4 chore: Added ADK Authentication End2End Samples
Merge https://github.com/google/adk-python/pull/2960

1. All in one authentication sample (has an IDP, Agent and the application) under `contributing/samples/authn-adk-all-in-one/`
2. Documented for all the steps.
3. OAuth 2.0 Authorization Code Grant type used by the agent.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2960 from nikhilpurwant:main dfcc821602d265c4ae7cc42eb1f5739beaad6f87
PiperOrigin-RevId: 808672120
2025-09-18 11:44:21 -07:00
guillaume blaquiere 25958242db feat: add endpoint to generate memory from session
Merge https://github.com/google/adk-python/pull/2900

In relation with #2416

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2900 from guillaumeblaquiere:add-session-to-memory 0507de43021c62f9223167dca8f53b536227ad04
PiperOrigin-RevId: 808658162
2025-09-18 11:13:21 -07:00
Kel Markert 6b49391546 feat: Add Google Maps Grounding Tool to ADK
This add `GoogleMapsGroundingTool`, a built-in tool for Gemini 2 models to ground query results with Google Maps. This tool operates internally within the model and is only available when using the VertexAI Gemini API.

PiperOrigin-RevId: 808650501
2025-09-18 10:54:27 -07:00
Xuan Yang 8a92fd18b6 fix: ignore empty function chunk in LiteLlm streaming response
Fixes https://github.com/google/adk-python/issues/1532

PiperOrigin-RevId: 808636127
2025-09-18 10:18:53 -07:00
Hangfei Lin c37bd2742c feat: Introduce LLM context compaction interface
Provide a more efficient way to compact LLM context for better agentic performance.

* `app`: the top level abstraction for an ADK application. It contains an root agent, and plugins.
* `content_strategy`: the abstraction for selecting the contents for LLM request.
* `compaction_strategy`: the abstraction for compacting the events.
* Added `sequence_id` and `summary_range` in event class.

PiperOrigin-RevId: 808634224
2025-09-18 10:14:12 -07:00
Wei Sun (Jack) e86647d446 feat(conformance): Implements adk conformance test cli with replay mode
PiperOrigin-RevId: 808633566
2025-09-18 10:12:43 -07:00
Afonso Menegola c9ea80af28 fix: Prevent escaping of Latin characters in LLM response
Merge https://github.com/google/adk-python/pull/2937

**Closes #2936**

This Pull Request addresses the issue where `LlmAgent` outputs, when configured with `output_schema` and `tools`, were presenting escaped Latin characters (e.g., `\xf3` for `ó`) in the final response. This behavior occurred because `json.dumps` was being called with `ensure_ascii=True` (its default), which is not ideal for human-readable output, especially when dealing with non-ASCII characters common in many languages like Portuguese.

**Changes Proposed:**

* Modified the `_OutputSchemaRequestProcessor` in `src/google/adk/flows/llm_flows/_output_schema_processor.py` to explicitly set `ensure_ascii=False` when calling `json.dumps` for the `set_model_response` tool's output.

**Impact:**

This change ensures that all non-ASCII characters in the structured model response are preserved in their natural form, improving the readability and user experience of agent outputs, particularly for users interacting in languages with accented characters or other special symbols.

**Testing:**

The fix was verified locally by running an `LlmAgent` with an `output_schema` and confirming that responses containing Latin characters (e.g., "ação", "caminhão", "ícone") are now correctly displayed without escaping.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2937 from amenegola:fix/issue-2936-escape-chars 6cac00f97aa4cd8d8ccaa97ec5fffc74f57995dc
PiperOrigin-RevId: 808622892
2025-09-18 09:48:03 -07:00
Xiang (Sean) Zhou 86ee6e3fa3 fix: Close runners after running eval
this fixes https://github.com/google/adk-python/issues/2196

PiperOrigin-RevId: 808618368
2025-09-18 09:36:56 -07:00
Wei Sun (Jack) bf4ff31009 feat(conformance): add CLI (adk conformance create) for generating conformance tests from spec.yaml file
- Add conformance command group with create subcommand
- Implement category/name/spec.yaml with generated-*.yaml files
- Support executing agents with queries and recording sessions
- Create test cases with recorded llm interactions and tool calls/results

Expected folder structure:

```

conformance_repo/
├── agents/                            # Agent definitions - contains all config-based agents shared by test cases.
│   ├── single_basic/
│   ├── multi_basic/
│   └── single_tool_builtin/
│
└── tests/                             # Test cases
    ├── core/                          # Test category
    │   ├── desc_001/                  # Individual test case
    │   │   ├── spec.yaml             # Human-written specification
    │   │   ├── generated-session.yaml
    │   │   ├── generated-recordings.yaml
    │   │   └── ...                   # Potential future generated files
    │   ├── f_001/
    │   │   ├── spec.yaml
    │   │   ├── generated-session.yaml
    │   │   ├── generated-recordings.yaml
    │   │   └── ...

```

Help text:

```
-> % adk conformance create --help
Usage: adk conformance create [OPTIONS] [PATHS]...

  Generate ADK conformance test YAML files from TestCaseInput specifications.

  NOTE: this is work in progress.

  This command reads TestCaseInput specifications from input.yaml files, executes the specified test cases against agents, and generates conformance test files with recorded agent interactions as
  test.yaml files.

  Expected directory structure: category/name/input.yaml (TestCaseInput) -> category/name/test.yaml (TestCase)

  PATHS: One or more directories containing test case specifications. If no paths are provided, defaults to 'tests/' directory.

  Examples:

  Use default directory: adk conformance create

  Custom directories: adk conformance create tests/core tests/tools

Options:
  --help  Show this message and exit.
```
PiperOrigin-RevId: 808609547
2025-09-18 09:14:05 -07:00
Hangfei Lin 4cb07ba05e chore: Update plugins in hello_world_app
Corrected `CountInvocationPlugin` to be a class reference and added `ContextFilterPlugin` to limit the number of tool invocations kept in the context to 3.

PiperOrigin-RevId: 808591608
2025-09-18 08:26:42 -07:00
Kacper Jawoszek cee365a13d feat(otel): Add GenAI Instrumentation if --otel_to_cloud is enabled
PiperOrigin-RevId: 808460137
2025-09-18 01:33:13 -07:00
Wei Sun (Jack) 712da1bd36 feat(conformance): Integrates RecordingsPlugin into AdkWebServer to record Llm interactions and tool calls
When start the server with `--extra_plugins=google.adk.cli.plugins.recordings_plugin.RecordingsPlugin`, it will trigger recording with expected state in session.

PiperOrigin-RevId: 808432022
2025-09-18 00:05:06 -07:00
Xiang (Sean) Zhou 99405d6a8a chore: Fix the starting folder for finding ADK source
PiperOrigin-RevId: 808371099
2025-09-17 20:20:58 -07:00
Hangfei Lin a06bf278cb feat: Adding the ContextFilterPlugin
This commit introduces a new ContextFilterPlugin which allows for filtering the LlmRequest contents before they are sent to the LLM. This helps in managing and potentially reducing the size of the LLM context.

The plugin provides two primary filtering mechanisms:

num_invocations_to_keep: Keeps only the specified number of the most recent user-model invocations. An invocation is defined as one or more user messages followed by a model response.
custom_filter: Allows for a user-defined callable to be applied to the contents for more flexible filtering.
Unit tests have been added to cover the different filtering scenarios, including:

Filtering by the last N invocations.
Filtering using a custom function.
Combining both filtering methods.
Handling cases with multiple user turns in a single invocation.
Ensuring no filtering occurs when options are not provided.
Gracefully handling exceptions from custom filter functions."

For example, when num_of_innovacations=2:
-----------------------------------------------------------
Contents:
{"parts":[{"text":"9"}],"role":"user"}
{"parts":[{"text":"I am sorry, I cannot fulfill this request. I need more information on what you would like me to do. I can roll a die or check prime numbers.\n"}],"role":"model"}
{"parts":[{"text":"1"}],"role":"user"}
{"parts":[{"text":"I am sorry, I cannot fulfill this request. I need more information on what you would like me to do. I can roll a die or check prime numbers.\n"}],"role":"model"}
{"parts":[{"text":"10"}],"role":"user"}
-----------------------------------------------------------
PiperOrigin-RevId: 808355316
2025-09-17 19:28:56 -07:00
Google Team Member 10cf377494 feat: Make the bigquery sample agent run with ADC out-of-the-box
Right now the bigquery sample agent is configured to run with OAuth, which requires some set up. This change makes it more readily usable, both locally and in AgentEngine, as Application Default Credentials (ADC) is easier to set up, and often local and AgentEngine environment already have it set up.

PiperOrigin-RevId: 808315879
2025-09-17 16:52:49 -07:00
Wei Sun (Jack) 3bd2f29f3a feat(conformance): Adds a replay plugin to replay the previously recorded llm/tool recordings for conformance tests
PiperOrigin-RevId: 807979314
2025-09-16 21:54:25 -07:00
Xiang (Sean) Zhou 14f118899d chore: Add example agent to get log probabilitis
see https://github.com/google/adk-python/issues/2764

PiperOrigin-RevId: 807972596
2025-09-16 21:23:21 -07:00
Wei Sun (Jack) c0554e4b13 feat(conformance): add an ADK plugin to record Llm request/response and tool call/result to recordings.yaml file
Also moves the `Recordings` pydantic models into this plugins/ package.

Key features:
- Records LLM requests/responses and tool calls/results to YAML files in `generated-recordings.yaml`.
- Use session state to determine where to read and output recordings.

PiperOrigin-RevId: 807969100
2025-09-16 21:10:09 -07:00
Google Team Member 6bd33e1be3 fix: Retain the consumers and transport registry when recreating the ClientFactory in remote_a2a_agent.py
PiperOrigin-RevId: 807762203
2025-09-16 10:58:46 -07:00
Xiang (Sean) Zhou f7bd3c111c feat: Expose log probs of candidates in LlmResponse
fixes https://github.com/google/adk-python/issues/2764

PiperOrigin-RevId: 807516910
2025-09-15 21:36:15 -07:00
Wei Sun (Jack) 1ce043a278 chore: Fixes BasePlugin#after_run_callback return type hint
`Optional[None]` is `Union[None, None]`, which is essentially None.

PiperOrigin-RevId: 807515970
2025-09-15 21:33:05 -07:00
Xuan Yang bd21847295 chore: add a step to load adk-bot SSH Private Key for the release analysis workflow
PiperOrigin-RevId: 807479079
2025-09-15 19:20:36 -07:00
Kacper Jawoszek 1ae0b82f56 feat(otel): add --otel_to_cloud experimental support
Cloud Trace, Cloud Monitoring and Cloud Logging integrations are set up via OTel if otel_to_cloud CLI param/fast_api arg is provided.

This is similar to current Cloud Trace integration via trace_to_cloud, just extended to Monitoring and Logging as well.

PiperOrigin-RevId: 807385680
2025-09-15 14:32:22 -07:00
Xiang (Sean) Zhou d6d4b144e9 chore: Update instructions not to ask for root folder if user doesn't intent to create or implement an agent
PiperOrigin-RevId: 807372074
2025-09-15 13:59:08 -07:00
Xinran (Sherry) Tang 4dbec15d26 test: Add unittest suites for testing HITL confirmation flow on runner level
PiperOrigin-RevId: 807327997
2025-09-15 12:00:49 -07:00
Wei Sun (Jack) 402f3626b3 feat(conformance): Replaces invocation_id with user_message_index in the Recording
`invocation_id` is per-request, so we just need user_message_index to help locate where to start replay.

PiperOrigin-RevId: 807300016
2025-09-15 10:49:13 -07:00
Google Team Member 6158075a65 fix: introduces a raw_mcp_tool method in McpTool to provide direct access to the underlying MCP tool
PiperOrigin-RevId: 807299777
2025-09-15 10:48:13 -07:00
Google Team Member b1312680f4 feat(otel): add --otel_to_cloud experimental support
Cloud Trace, Cloud Monitoring and Cloud Logging integrations are set up via OTel if otel_to_cloud CLI param/fast_api arg is provided.

This is similar to current Cloud Trace integration via trace_to_cloud, just extended to Monitoring and Logging as well.

PiperOrigin-RevId: 807285744
2025-09-15 10:11:12 -07:00
Google Team Member 103e88e95f test: Add evaluation for BigQuery tools
We should treat this as the first step towards building a robust eval story for BQ tools.

PiperOrigin-RevId: 807247053
2025-09-15 08:16:33 -07:00
Kacper Jawoszek 7870480c63 feat(otel): add --otel_to_cloud experimental support
Cloud Trace, Cloud Monitoring and Cloud Logging integrations are set up via OTel if otel_to_cloud CLI param/fast_api arg is provided.

This is similar to current Cloud Trace integration via trace_to_cloud, just extended to Monitoring and Logging as well.

PiperOrigin-RevId: 807230668
2025-09-15 07:22:19 -07:00
Bastien Jacot-Guillarmod b9735b2193 docs: Correct the documentation of after_agent_callback
The `after_agent_callback` in plugin works similarly as the `after_agent_callback` in `base_agent.py`, e.g. it only append new content, but cannot modify the previous content.

PiperOrigin-RevId: 807162139
2025-09-15 03:06:57 -07:00
Wei Sun (Jack) 8ec83d6c18 feat(conformance): Add data definitions used to create adn run conformance tests
PiperOrigin-RevId: 807100057
2025-09-14 23:30:44 -07:00
Xiang (Sean) Zhou 6ab87da592 chore: Add back the request logging in RemoteA2aAgent given the logging was already fixed
PiperOrigin-RevId: 806551434
2025-09-12 22:40:58 -07:00
Wei Sun (Jack) b53e6e3567 chore: bump version to 1.14.1 with a patch for A2A logging issue
Prepare a patch version for #2918

PiperOrigin-RevId: 806537425
2025-09-12 21:29:58 -07:00
Google Team Member c29d41f0d0 feat: add Spanner similarity_search tool
Similarity search tool supports similarity search on Spanner data by embedding a text query to a vector and run vector search with the embedded vector.

PiperOrigin-RevId: 806502499
2025-09-12 18:49:50 -07:00
Google Team Member 0c1f1fadeb fix: Fix logging issues with RemoteA2aAgent
Recent change to the updated A2A Client SDK broke the logging utilities. This updates those logging utilities to work with the new A2A SDK structure.

PiperOrigin-RevId: 806482017
2025-09-12 17:20:04 -07:00
Google Team Member bb148002f8 fix: Filter out thought parts when saving agent output to state
PiperOrigin-RevId: 806478056
2025-09-12 17:05:26 -07:00
Google Team Member 4c00b86e33 feat: Provide location config for BigQuery tools
Right now the tolls are always running against multi-region US by default. With this change the agent builder can scope the tools to data and compute in a particular BigQuery location.

PiperOrigin-RevId: 806473857
2025-09-12 16:52:16 -07:00
Xuan Yang b3b31a9ffb chore: add a main.py script for the ADK docs updater agent
PiperOrigin-RevId: 806468319
2025-09-12 16:33:06 -07:00
Hangfei Lin 463dcee58c chore: specify the default sides for roll dice agent in bidi
PiperOrigin-RevId: 806468232
2025-09-12 16:32:10 -07:00
Google Team Member 4f07228f57 chore: Move framework filled params to the end in the BigQuery forecast tool
This is for better readability of the tool, specially in relation to the examples in the docstring.

PiperOrigin-RevId: 806460056
2025-09-12 16:03:57 -07:00
Google Team Member c53c02f022 chore: add clientIdEnum for CA API usage tracking
PiperOrigin-RevId: 806453560
2025-09-12 15:44:28 -07:00
Hangfei Lin 4e6b31a860 chore: Improve bug report template for Google ADK
Update the bug report issue template to request minimal reproducible examples, error/stacktrace, clarify OS options, and include questions about LiteLLM usage and specific model details.

PiperOrigin-RevId: 806435953
2025-09-12 14:53:03 -07:00
Hangfei Lin afebb5227b chore: Update ADK Live documentation on handling audio and transcriptions
Add guidelines for saving transcriptions as session Events and audio as artifacts with references in Events.

PiperOrigin-RevId: 806424916
2025-09-12 14:20:02 -07:00
Hangfei Lin 168c724866 test: Add test to ensure RunConfig instances do not share audio transcription configs
The new test verifies that `output_audio_transcription` and `input_audio_transcription` attributes are unique to each `RunConfig` instance, preventing unintended side effects from modifying one instance.

PiperOrigin-RevId: 806405671
2025-09-12 13:26:31 -07:00
Xiang (Sean) Zhou 05e3f73451 chore: Remove _in_memory_session_service from InMemoryRunner
PiperOrigin-RevId: 806385604
2025-09-12 12:29:23 -07:00
Hangfei Lin 23834e8a02 chore: Remove unused _get_audio_transcription_from_session function
This function is no longer called or needed within the `BaseLlmFlow` class.

PiperOrigin-RevId: 806351470
2025-09-12 11:02:37 -07:00
Xuan Yang de1c889a83 chore: create an initial ADK docs updater agent to create doc update PRs
PiperOrigin-RevId: 806348675
2025-09-12 10:55:36 -07:00
Hangfei Lin 2d98b2c30f chore: Update default model in live bidi streaming sample
Switched the active model from `gemini-live-2.5-flash-preview` (for AI Studio) to `gemini-2.0-flash-live-preview-04-09` (for Vertex).

PiperOrigin-RevId: 806348640
2025-09-12 10:54:41 -07:00
Xuan Yang 4cf00702a0 chore: re-structure adk_documentation folder so that agents in it can share the common files
PiperOrigin-RevId: 806348410
2025-09-12 10:53:44 -07:00
Hangfei Lin a7f4e02dc7 chore: Clarify that LLMResponse.content should only contain user/model-generated content
PiperOrigin-RevId: 806157090
2025-09-12 00:19:21 -07:00
Hangfei Lin 908757b47f chore: Add Tool Confirmation to README
This change updates the open-source workspace README to include "Tool Confirmation" in the list of new features.

PiperOrigin-RevId: 806127595
2025-09-11 22:34:01 -07:00
Wei Sun (Jack) 91528890db chore: Adds indent to YAML sequence by default for better visual readability
Both are valid YAML, just with indent, it's more visually friend to see the data structure hierarchy.

Before

```
items:
- item1
- item2
- item3
```

After

```
items:
  - item1
  - item2
  - item3
```
PiperOrigin-RevId: 806117290
2025-09-11 21:59:20 -07:00
Hangfei Lin f73ae6e101 chore: Remove redundant attribute descriptions from docstrings
The attributes are already defined as fields in the Pydantic models, making the docstring descriptions unnecessary.

PiperOrigin-RevId: 806091305
2025-09-11 20:15:19 -07:00
Google Team Member 9862b7b1e2 fix: Remove the logging method in remote a2a agent lib which is expecting a wrong type
The a2a_request is in type Message where the function expecting SendMessageRequest type

PiperOrigin-RevId: 806001430
2025-09-11 15:09:00 -07:00
Hangfei Lin ab69ef8de8 feat: Move livebidi agents esp multi-agent to use session/events
The old live/bidi agents are using a cache to store context/history during agent transfer etc. As we have added support for session for live/bidi, we are now migrating the context/history cache to it. This improves scalability, efficiency and maintainability.

It introduces several changes:
* AudioTranscriber support is removed as now we are using native transcription from models.
* Transcription is returned as input_transcription/output_transcription fields and no longer as contents.
* We will return a new event with artifact references of file type of audio/pcm.(in addition to existing audio response event. So the users of this api need to do proper filtering here.)

PiperOrigin-RevId: 805997675
2025-09-11 14:58:33 -07:00
Hangfei Lin 873551d7b9 chore: Update model references in README
Changed all instances of "gemini-2.0-flash" to "gemini-2.5-flash" in the example code snippets within the README.

PiperOrigin-RevId: 805949871
2025-09-11 12:48:39 -07:00
Xuan Yang 921e5cb370 ci: minor fix for the "bot responded" label for the discussion answering agent
PiperOrigin-RevId: 805905926
2025-09-11 10:56:43 -07:00
Xuan Yang f52608328e ci: fix discussion answering agent main.py by removing the redundant json import
PiperOrigin-RevId: 805879980
2025-09-11 09:56:38 -07:00
Ankur Sharma c5613fb6f0 feat: Add Rubrics to EvalCase datamodel
For advanced eval use cases, we do expect agent developers to have rubrics that are specific to an Eval Case and in some cases even specific to a single invocation/turn in the eval case conversation.

A separate PR will be created to consume this data model changes in ADK Eval.

PiperOrigin-RevId: 805588808
2025-09-10 18:00:15 -07:00
Xiang (Sean) Zhou 0bc2ee64e3 ci: Fix discussion answering agent
a. dump the discussion content to a tmp file first to avoid github redaction of environment variable
b. instruct the agent to use get_discussion_and_comments only when discussion content json is not available.

PiperOrigin-RevId: 805581573
2025-09-10 17:33:54 -07:00
Xuan Yang f96f0ebd0d chore: add issues: write permission for the ADK release analysis Github workflow
PiperOrigin-RevId: 805563540
2025-09-10 16:36:27 -07:00
Hangfei Lin 894bec794e chore: Update default and example Gemini models to new versions
Changes references from `gemini-1.5-flash` and `gemini-1.5-pro` to `gemini-2.5-flash` and `gemini-2.5-pro` in docstrings, default values, sample agents, and tests.

PiperOrigin-RevId: 805536434
2025-09-10 15:22:52 -07:00
Hangfei Lin 3c433b7168 chore: bidi streaming example on run live fast api
This sample connects to adk agent api server with websocket, to exchange streaming audio/text.

PiperOrigin-RevId: 805531120
2025-09-10 15:08:26 -07:00
Hangfei Lin 707c1a7bd4 ADK changes
PiperOrigin-RevId: 805523988
2025-09-10 14:49:25 -07:00
Shangjie Chen 97cf724f14 chore: Release ADK 1.14.0
PiperOrigin-RevId: 805506354
2025-09-10 14:04:22 -07:00
Ankur Sharma e88e667770 feat: Data model for Rubric based metric and eval config
Details:
- We plan on introducing Rubric based metrics in subsequent changes. This change introduces the data model needed that allows agent developer to provide rubrics.

- We also introduce a data model for the config that the eval system has been using for quite some time. It was loosely and informally described as a dictionary of metric names and expected thresholds. In this change, we actually formalize it using a pydantic data model, and extend it allow developers to specify rubrics as a part of their eval config.

What is a rubric based metric?
A rubric based metric is the assessment of a Agent's response (final or intermediate) along some rubric. This evaluation of agent's response significantly differs from the strategy where one has to provide a golden response.

PiperOrigin-RevId: 805488436
2025-09-10 13:20:07 -07:00
George Weale 37228beddd fix: Enable saving input blobs as artifacts in ADK web server for issue #2176
The `run_config` for `run_agent` now includes `save_input_blobs_as_artifacts=True`.

PiperOrigin-RevId: 805472895
2025-09-10 12:39:42 -07:00
Xuan Yang 957dc628ab chore: set up Github workflow for ADK release analyzer for doc updates
PiperOrigin-RevId: 805434018
2025-09-10 11:02:59 -07:00
Hangfei Lin 7148e0e82e test: Add tests for Runner initialization constraints
These tests verify that `ValueError` is raised when `Runner` is initialized without providing either an `app` instance or both `app_name` and `agent`.

PiperOrigin-RevId: 805427256
2025-09-10 10:48:33 -07:00
Google Team Member 0935a40011 feat: Add Bigquery Forecast tool
This tool answers questions about structured data in BigQuery using natural language.

PiperOrigin-RevId: 805414952
2025-09-10 10:20:47 -07:00
Xuan Yang 3b428ec81f chore: let adk-bot respond to discussion when it is tagged
PiperOrigin-RevId: 805406204
2025-09-10 10:02:23 -07:00
GenkiNoguchi 5cda37adb3 chore: fix typos in multiple files
Merge https://github.com/google/adk-python/pull/2864

**Reason for this change:**

  Multiple typos were found in comments, docstrings, and code throughout the codebase, which could lead to confusion and reduce code readability.

  **Changes made:**

  Fixed the following typos across 8 files:

  1. contributing/samples/adk_answering_agent/utils.py:130: "extention" → "extension"
  2. llms-full.txt:15171: "fuction" → "function"
  3. src/google/adk/a2a/converters/part_converter.py:
    - Line 96: "Conver" → "Convert", "reponse" → "response"
    - Line 99: "suervice" → "service"
    - Line 100: "accordinlgy" → "accordingly"
    - Line 191: "Conver" → "Convert", "reponse" → "response"
    - Line 195: "accordinlgy" → "accordingly"
  4. src/google/adk/agents/base_agent.py:568: "custome" → "custom"
  5. src/google/adk/evaluation/agent_evaluator.py:572: "Retruns" → "Returns"
  6. src/google/adk/flows/llm_flows/basic.py:55: "outoput_schema" → "output_schema"
  7. src/google/adk/flows/llm_flows/contents.py:136: "fuction_response" → "function_response"
  8. src/google/adk/models/google_llm.py:138: "gemini_llm_connecton.py" → "gemini_llm_connection.py"

  **Impact:**

  This change will:
  - Improve code documentation clarity and professionalism
  - Make comments, docstrings, and code more readable and accurate
  - Help prevent confusion for developers reading the code
  - Ensure consistency in terminology throughout the codebase

  This is a non-breaking change that only affects comments, documentation strings, and improves code clarity.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2864 from ammmr:chore-fix-typos 3cea9fcf6f21edb006b63e9258d2b82930dd961d
PiperOrigin-RevId: 805227784
2025-09-10 00:08:15 -07:00
Google Team Member 3e6d91f9e2 docs: Update description of task_completed function in SequentialAgent
PiperOrigin-RevId: 805223251
2025-09-09 23:53:14 -07:00
Xuan Yang 8132d3b621 chore: add instructions for the ADK release analyzer agent to sort the recommended changes and recommend API reference changes
PiperOrigin-RevId: 805099909
2025-09-09 16:07:28 -07:00
Xiang (Sean) Zhou 43c96811da ci: Fix discussion answering github action workflow to escape the quote in the discussion content JSON
PiperOrigin-RevId: 805091905
2025-09-09 15:42:34 -07:00
Xuan Yang e3422c616d chore: create an initial ADK release analyzer agent to find the doc updates needed between releases
PiperOrigin-RevId: 805030050
2025-09-09 13:00:05 -07:00
Hangfei Lin 8174a29c6d chore: update contribution guide
PiperOrigin-RevId: 804985449
2025-09-09 11:09:40 -07:00
Google Team Member a645580aa6 ADK changes
PiperOrigin-RevId: 804937691
2025-09-09 09:11:08 -07:00
Xuan Yang 78eea1aa55 chore: skip PR triage for already triaged or Google-contributor PRs
The `agent-triage-pull-request` job will now only run if the pull request does not have the 'bot triaged' or 'google-contributor' labels, avoiding redundant and unnecessary triage actions.

PiperOrigin-RevId: 804732073
2025-09-08 22:20:19 -07:00
Google Team Member fa55354a1a feat: Update to ADK + A2A Remote Client to use A2A SDK ClientFactory
Use the A2A Python SDK for client support for A2A Remote clients. This enables A2A based agents that use gRPC or RESTful interfaces, as well as the jsonrpc support. This also simplifies creation of clients and provides simpler mechanisms to inject credentials and observability into the remote agent interactions.

PiperOrigin-RevId: 804711466
2025-09-08 21:03:27 -07:00
Google Team Member 64f11a6a67 chore: Avoid mutable default arguments in local_eval_service and runners
Changed default values for `session_service`, `artifact_service`, and `run_config` from instances of mutable classes to `None`. Instances are now created within the function body if the argument is not provided, preventing unexpected shared state across function calls.

PiperOrigin-RevId: 804624564
2025-09-08 16:11:24 -07:00
George Weale d56dd08072 fix: Enable saving input blobs as artifacts in ADK web server for issue #2176
The `run_config` for `run_agent` now includes `save_input_blobs_as_artifacts=True`.

PiperOrigin-RevId: 804589111
2025-09-08 14:30:03 -07:00
Shangjie Chen 8452d2bcba feat: Allow function tool to pass in a callable to decide whether it need confirmation
PiperOrigin-RevId: 804583437
2025-09-08 14:16:59 -07:00
George Weale 43eec82f84 fix: Add a NOTE to agent transfer instructions listing available agents
The system instructions for agent transfer now include a NOTE section that lists all agents available for the `transfer_to_agent` function. This also has the target agents and, if there is one that applies, the parent agent. New unit tests are added to verify the correct generation of this NOTE.

PiperOrigin-RevId: 804569691
2025-09-08 13:43:38 -07:00
George Weale 5b465fd71b chore: Avoid mutable default arguments in local_eval_service and runners
Changed default values for `session_service`, `artifact_service`, and `run_config` from instances of mutable classes to `None`. Instances are now created within the function body if the argument is not provided, preventing unexpected shared state across function calls.

PiperOrigin-RevId: 804560641
2025-09-08 13:21:05 -07:00
George Weale ca5f7f1ff0 chore: Reorder dependencies in pyproject.toml
PiperOrigin-RevId: 804559734
2025-09-08 13:18:41 -07:00
Yujun Zou 467df1a36f docs: Update root_agent description for clarity
Update description as: Coordinator agent to greet users.

PiperOrigin-RevId: 804553925
2025-09-08 13:01:47 -07:00
Google Team Member 72ff9c64a2 feat: Add GkeCodeExecutor for sandboxed code execution on GKE #non-breaking
Merge https://github.com/google/adk-python/pull/1629

close https://github.com/google/adk-python/issues/2170

### Summary

This PR introduces `GkeCodeExecutor`, a new code executor that provides a secure and scalable method for running LLM-generated code by leveraging GKE Sandbox. It serves as a robust alternative to local or standard containerized executors by leveraging the **GKE Sandbox** environment, which uses gVisor for workload isolation.

For each code execution request, it dynamically creates an ephemeral Kubernetes Job with a hardened Pod configuration, offering significant security benefits and ensuring that each code execution runs in a clean, isolated environment.

### Key Features of GkeCodeExecutor

* **Dynamic Job Creation**: Uses the Kubernetes `batch/v1` API to create a new Job for each code snippet.
* **Secure Code Mounting**: Injects code into the Pod via a temporary `ConfigMap`, which is mounted to a read-only file.
* **gVisor Sandboxing**: Enforces execution within a `gvisor` runtime for kernel-level isolation.
* **Hardened Security Context**: Pods run as non-root with all Linux capabilities dropped and a read-only root filesystem.
* **Resource Management**: Applies configurable CPU and memory limits to prevent abuse.
* **Automatic Cleanup**: Uses the `ttl_seconds_after_finished` feature on Jobs for robust, automatic garbage collection of completed Pods and Jobs.
* **Node Scheduling**: The executor uses Kubernetes `tolerations` in its Pod specification. This allows the k8s scheduler to place the execution Pod onto a **_pre-configured_** gVisor-enabled node.
* **Module Integration**: The `GkeCodeExecutor` is registered in the `code_executors/__init__.py`, making it available for use by agents. The `ImportError` handling is configured to check for the required `kubernetes` SDK.

### Execution Flow:

1.  Agent invokes `GkeCodeExecutor` with the LLM-generated code.
2.  The `GkeCodeExecutor` will `execute_code` – creates a temporary `ConfigMap`, and then create a k8s `Job` to run it.
3.  This Job runs a standard `python:3.11-slim` container. The image is pulled once to the node and cached. The Job will mount the ConfigMap as `/app/code.py`
4.  The GkeCodeExecutor will monitor the Job to completion, fetch `stdout/stderr` logs from the container, return `CodeExecutionResult` to the LlmAgent, and ensure all temp resources are deleted.
5.  The calling agent formats the result and provides a final response to the user. If the result contains error, it will retry up to `error_retry_attempts` times.

PiperOrigin-RevId: 804511467
2025-09-08 11:15:29 -07:00
Shangjie Chen e63fe0c0eb fix: Fix pagination of list_sessions in VertexAiSessionService
Resolves https://github.com/google/adk-python/issues/2860

PiperOrigin-RevId: 804511401
2025-09-08 11:14:32 -07:00
Max Ind bc6b5462a7 test: add functional telemetry tests
This includes:
- Test verifying multiple spans are written during E2E runner execution.
- Regression tests for the "ContextVar was created in a different Context" exceptions caused by the interplay of context based instrumentation and async generators getting indeterminately suspended.

PiperOrigin-RevId: 804333483
2025-09-08 02:23:10 -07:00
George Weale 1e23652968 fix: AttributeError and indentation in parameter processing. For issue #2776 and issue #2763
PiperOrigin-RevId: 804222317
2025-09-07 18:37:42 -07:00
Google Team Member 1979dcf496 fix: Allow AgentTool to inherit/use plugins from its invocation context when running
PiperOrigin-RevId: 803656189
2025-09-05 17:09:04 -07:00
Hangfei Lin fc90ce968f test: Add unit tests for the App class and improve Runner initialization tests
-   Added `tests/unittests/apps/test_apps.py` with basic tests for `App` initialization.
-   Modified `tests/unittests/test_runners.py` to include a test that verifies `Runner` raises a `ValueError` when both `app` and `app_name` are provided during initialization.

PiperOrigin-RevId: 803556826
2025-09-05 12:16:38 -07:00
Hangfei Lin decc19b188 chore: Update release cadence in README
The release cadence is now described as "roughly bi-weekly" instead of "weekly".

PiperOrigin-RevId: 803528472
2025-09-05 11:03:05 -07:00
Xiang (Sean) Zhou 25df6c22d5 chore: Tune instructions to not ask root directory if it's already provided in the context
PiperOrigin-RevId: 803512675
2025-09-05 10:23:34 -07:00
Google Team Member 45c1fcc84f feat: disallow setting non-existent properties in BigQuery tools and credentials config
This will save the agent builder getting wrong impression if by mistake they set a property that does not exist.

PiperOrigin-RevId: 803208559
2025-09-04 15:58:19 -07:00
Wei Sun (Jack) ebf2c98e41 feat(conformance): Adds a minimal AdkWebServer http client for conformance tests to interact with
PiperOrigin-RevId: 803208215
2025-09-04 15:56:53 -07:00
Hangfei Lin 7b077ac351 chore: Add community repo dependency group to pyproject toml
PiperOrigin-RevId: 803191617
2025-09-04 15:11:09 -07:00
Google Team Member b05fef9ba7 feat: Allow custom part converters in A2A classes
This change introduces type descriptions for the functions which convert between A2A and GenAI `Part`s. It then allows passing instances of those functions to the various A2A-related functions/classes, effectively allowing users to inject their own logic for how part conversion should occur.

The benefit of this pattern is that users can create decorators around the core `Part` conversion logic, which allows them to intercept the cases they care about while delegating the ones they do not to the core converter. This is a pattern we use a lot in the A2A Python SDK.

One example where this type of logic is useful is for extensions: this allows extension logic to, for example, interpret an A2A DataPart into a FunctionResponse using extension-specific logic.

PiperOrigin-RevId: 803186799
2025-09-04 14:57:15 -07:00
Hangfei Lin 4df79dd5c9 feat: Upgrade ADK stack to use App instead in addition to root_agent
The convention:
- If some fields(like plugin) are defined both at root_agent and app, then a error will be raised.
- app code should be located within agent.py.
- an instance named app should be created

PiperOrigin-RevId: 803155804
2025-09-04 13:38:00 -07:00
Wei Sun (Jack) 14484065c6 chore: Follow pydantic convention to make field_validator a public method
PiperOrigin-RevId: 802861986
2025-09-03 22:36:25 -07:00
Che Liu 7720616c5f chore: Update comment to clarify after_run callbacks
PiperOrigin-RevId: 802852137
2025-09-03 22:01:27 -07:00
Shangjie Chen cecf7e805d fix: Support saving text artifacts in GCS artifact service
Resolves https://github.com/google/adk-python/issues/2775

PiperOrigin-RevId: 802850139
2025-09-03 21:55:07 -07:00
Mark Scannell edda922791 feat: add audience and prompt as configurable for OAuth flows
Merge https://github.com/google/adk-python/pull/2738

Some OAuth servers require audience such as [Jira](https://developer.atlassian.com/cloud/confluence/oauth-2-3lo-apps/). This change allows the configuration of audience and prompt (if it needs to be changed) and adds some tests.

This is for issue [2755](https://github.com/google/adk-python/issues/2755).

Resolves #2755

Happy to provide changes/updates if needed.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2738 from mescanne:oauth-audience-prompt 87ce1100792d9156ada2a004bcfaf2fe5fc69602
PiperOrigin-RevId: 802850034
2025-09-03 21:53:54 -07:00
Xiang (Sean) Zhou a1679dae3f feat: Allow users to pass their own agent card to to_a2a method
PiperOrigin-RevId: 802763510
2025-09-03 16:54:33 -07:00
Wei Sun (Jack) a30851ee16 fix: Fixes thought handling in contents.py and refactors its unit tests
Before this change, other agent's reply with thought will still be inserted in the outgoing LlmRequest due to the wrong `else` statement for calling all other type of part.

This commit also refactors test_contents.py to be behavior-oriented tests, instead of implementation-oriented, and add more test cases to cover expected scenarios.

The tests are divided into the following files with different focus:

- test_contents.py: covers the basic logic of event filter;
- test_contents_branch.py: covers the behavior related to branch, which takes effect when ParallelAgent is used.
- test_contents_other_agent.py: covers the retelling behavior to include other agents' reply as context for the current agent.
- test_contents_function.py: covers the function_call/function_response rearrangement logic mainly for `LongRunningFunctionTool`.

PiperOrigin-RevId: 802759821
2025-09-03 16:42:20 -07:00
Wei Sun (Jack) fe8b37b0d3 fix(planner): Fixes the thought field handling in _planning.py
Before this change: `thought` flags was incorrectly removed if the current agent enables BuiltInPlanner.

After this change:

- When it's BuiltInPlanner, keep the thought flag in content history, so that model has full context of its previous thinking.
- When it's PlanReactPlanner, removes the `thought` flag in content history, so that model sees as-is when the content was generated.

PiperOrigin-RevId: 802737130
2025-09-03 15:41:29 -07:00
Xiang (Sean) Zhou 578fad7034 feat: Allow agent loader to load built-in agents from special directories in adk folder
PiperOrigin-RevId: 802716848
2025-09-03 14:48:22 -07:00
pguerra-ce a3410fab7b fix: Pass state_delta to runner in /run endpoint
Merge https://github.com/google/adk-python/pull/2791

Fixes #2789

## Summary
Forward `state_delta` from the FastAPI `/run` request to `Runner.run_async(...)`, aligning behavior with the documented
API and the `/run_sse` endpoint.

## Why
The documentation for `/run` explicitly includes:
> `state_delta` (object, optional): A delta of the state to apply before the run.

However, the non‑SSE `/run` handler did not pass this value through, so `Runner.run_async` always received `None`. The
`/run_sse` path already forwarded it correctly.

## Changes
- `src/google/adk/cli/adk_web_server.py`
    - Add `state_delta=req.state_delta` to the "/run" handler’s `runner.run_async(...)` call.
- `tests/unittests/cli/test_fast_api.py`
    - Add `test_agent_run_passes_state_delta` to test the fix.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2791 from pguerra-ce:fix-state-delta-missing-in-run 83eec8d28b80757e24ae900285eb59530863adbd
PiperOrigin-RevId: 802703072
2025-09-03 14:13:19 -07:00
Xiang (Sean) Zhou b4310727d9 chore: Use lazy % formatting in logging functions to fix pylint warnings
PiperOrigin-RevId: 802639682
2025-09-03 11:35:49 -07:00
Xiang (Sean) Zhou 66cc98801a chore: Adjust the instruction of agent builder assistant for how to use google_search tool and url_context tool
PiperOrigin-RevId: 802629718
2025-09-03 11:14:45 -07:00
Google Team Member 49acad1252 ADK changes
PiperOrigin-RevId: 802455693
2025-09-03 01:50:08 -07:00
Alejandro Cruzado-Ruiz 455dcbda4c ADK changes
PiperOrigin-RevId: 802410800
2025-09-02 22:52:51 -07:00
Shangjie Chen fb009d8ea6 fix: Add custom_metadata to DatabaseSessionService
Resolve https://github.com/google/adk-python/issues/2677

PiperOrigin-RevId: 802375768
2025-09-02 20:09:46 -07:00
Google Team Member aad153322e docs: update the ask_data_insights docstring
PiperOrigin-RevId: 802362601
2025-09-02 19:21:04 -07:00
Shangjie Chen 219815d2d7 chore: Update create_session endpoint to use Request message as post body
Also deprecate create_session_with_id which is not very RESTful.

PiperOrigin-RevId: 802357718
2025-09-02 18:56:45 -07:00
Xiang (Sean) Zhou a503a0c807 ci: Load discussion data from event content to avoid additional GraphQL API call
PiperOrigin-RevId: 802308383
2025-09-02 15:22:17 -07:00
Xiang (Sean) Zhou 408d3dfeb1 chore: refactor discussion answering agent to merge answer_discussions.py into main.py
mainly to dedup duplicated functionality in both file.

PiperOrigin-RevId: 802291102
2025-09-02 14:25:32 -07:00
Google Team Member 831e2e6d4d ADK changes
PiperOrigin-RevId: 801284664
2025-08-30 11:08:43 -07:00
Hangfei Lin dff733c6fc feat: Upgrade ADK stack to use App instead in addition to root_agent
The convention:
- If some fields(like plugin) are defined both at root_agent and app, then a error will be raised.
- app code should be located within agent.py.
- an instance named app should be created

PiperOrigin-RevId: 801252329
2025-08-30 08:01:53 -07:00
Xiang (Sean) Zhou 67f23df25a feat: Allow user specify embedding model for file retrieval
And use Gemini embedding model as default model if no embedding model is specified.

PiperOrigin-RevId: 801161505
2025-08-29 23:35:25 -07:00
Shangjie Chen 0c87907bcb fix: Enforce foreign key constraint for SQLite DB
Resolves https://github.com/google/adk-python/issues/2752

PiperOrigin-RevId: 801106660
2025-08-29 19:07:22 -07:00
Google Team Member 214f2884f5 feat: Upgrade ADK stack to use App instead in addition to root_agent
The convention:
- If some fields(like plugin) are defined both at root_agent and app, then a error will be raised.
- app code should be located within agent.py.
- an instance named app should be created

PiperOrigin-RevId: 801103084
2025-08-29 18:49:04 -07:00
Hangfei Lin a2e89a22a5 feat: Upgrade ADK stack to use App instead in addition to root_agent
The convention:
- If some fields(like plugin) are defined both at root_agent and app, then a error will be raised.
- app code should be located within agent.py.
- an instance named app should be created

PiperOrigin-RevId: 801084463
2025-08-29 17:33:38 -07:00
Xiang (Sean) Zhou 98b0426cd2 chore: Make UT of a2a consistent about how tests should be skipped when python verison < 3.10
PiperOrigin-RevId: 801040421
2025-08-29 14:59:27 -07:00
Google Team Member 2eddc5e4d3 feat: allow setting compute project for BigQuery tools
This will allow restricting BigQuery SQL executions to the specified project. The agent/LLM should resolve the `project_id` param for tools like `execute_sql` and sometimes they can resolve it to an unexpected value due to hallucination or ambiguity. This guardrail will protect against that situation.

PiperOrigin-RevId: 801039685
2025-08-29 14:56:47 -07:00
Shangjie Chen a17bcbb2aa feat: Add a tool confirmation flow that can guard tool execution with explicit confirmation and custom input
The existing `LongRunningTool` does not define a programmatic way to provide & validate structured input, also it relies on LLM to reason and parse the user's response.

For a quick start, annotate the function with `FunctionTool(my_function, require_confirmation=True)`. A more advanced flow is shown in the `human_tool_confirmation` sample.

The new flow is similar to the existing Auth flow:
- User request a tool confirmation by calling `tool_context.request_confirmation()` in the tool or `before_tool_callback`, or just using the `require_confirmation` shortcut in FunctionTool.
- User can provide custom validation logic before tool call proceeds.
- ADK creates corresponding RequestConfirmation FunctionCall Event to ask user for confirmation
- User needs to provide the expected tool confirmation to a RequestConfirmation FunctionResponse Event.
- ADK then checks the response and continues the tool call.

PiperOrigin-RevId: 801019917
2025-08-29 13:56:54 -07:00
Xiang (Sean) Zhou 3ed9097983 chore: Add initial version of agent builder assistant that assists user to build config based agent
PiperOrigin-RevId: 801014241
2025-08-29 13:42:31 -07:00
George Weale 9291daaa8e chore: Add warning for using Gemini models via LiteLLM
Recommend to use Gemini outside of LiteLLM

PiperOrigin-RevId: 800971705
2025-08-29 11:32:45 -07:00
Google Team Member fcd748e17f chore: add contributing Spanner tools RAG agent sample
PiperOrigin-RevId: 800938492
2025-08-29 10:00:43 -07:00
Xiang (Sean) Zhou bb4cfdec12 fix: inject artifact into instructions
a. complain when artifact is None
b. inject None value as empty string instead of `None`

PiperOrigin-RevId: 800930613
2025-08-29 09:38:01 -07:00
George Weale e45c3be238 fix: send full MIME types for image/video/pdf in get_content
Use full media types (image/jpeg, video/mp4, application/pdf) instead of suffixes (jpeg/mp4/pdf) when constructing LiteLLM payloads
This fxes compatibility with providers that validate media types (Anthropic)
Updated and added unit tests to assert full MIME types for image/video/pdf

PiperOrigin-RevId: 800685204
2025-08-28 18:02:18 -07:00
Google Team Member 11a2ffe35a feat: allow setting agent/application name for BigQuery tools
This will allow tracking of tool usage per agent/application.

PiperOrigin-RevId: 800607186
2025-08-28 14:10:01 -07:00
Jinning Li f4a8df0ba2 feat:Add tool_responses to IntermediateData
PiperOrigin-RevId: 800600571
2025-08-28 13:55:15 -07:00
Wei Sun (Jack) 8e43f0dd83 fix(deploy): Add back installing requirements.txt to Dockerfile template for cloud run
PiperOrigin-RevId: 800595427
2025-08-28 13:43:03 -07:00
Xiang (Sean) Zhou b92b288c97 chore: fix flaky unit tests: tests/unittests/flows/llm_flows/test_functions_simple.py
original tests assert too strict time boundary, now we only assert the parallel execution time should be less than sequential execution time

PiperOrigin-RevId: 800563929
2025-08-28 12:17:03 -07:00
Xiang (Sean) Zhou 8d6f138fbe chore: Update oauth calendar sample agent to test the case when a subsequent tool call happends right after a tool call that requires auth
context: this is for reproducing https://github.com/google/adk-python/issues/1944 and verify corresponding fix
PiperOrigin-RevId: 800561025
2025-08-28 12:10:43 -07:00
Xiang (Sean) Zhou 3b922a2f6d fix: Only process the auth responses in the last event with content (if applicable i.e. it's authored by user)
fixes : https://github.com/google/adk-python/issues/1944
PiperOrigin-RevId: 800560805
2025-08-28 12:09:21 -07:00
Google Team Member 7975e8e196 refactor: Extract a utility for aggregating partial streaming responses and emitting LlmResponses for them as needed
PiperOrigin-RevId: 800521404
2025-08-28 10:29:14 -07:00
Wei Sun (Jack) 3bc2d77b4d chore(config): Reimplements AgentConfig with pydantic v2 convention and allow all possible values for agent_class field in all Agent Configs
All below are valid values now.

```
agent_class: LlmAgent
agent_class: google.adk.agents.LlmAgent
agent_class: google.adk.agents.llm_agent.LlmAgent
```
PiperOrigin-RevId: 800228114
2025-08-27 17:07:53 -07:00
Yifan Wang f743c29d00 chore: Bump version number to 1.13.0
PiperOrigin-RevId: 800210332
2025-08-27 16:09:42 -07:00
Yeesian Ng 69eb2b50c5 feat: Add --agent_engine_config_file option to adk deploy agent_engine
PiperOrigin-RevId: 800171071
2025-08-27 14:19:43 -07:00
Wei Sun (Jack) 2dd432cc1f fix: add the missing from_config class method in BaseToolset
PiperOrigin-RevId: 799893557
2025-08-26 23:48:05 -07:00
Hangfei Lin 3b997a0a07 fix: change LlmResponse to use Content for transcriptions
The transcription change breaks the multi-agent transfer during live/bidi.

Updates `GeminiLlmConnection` to populate the `content` field of `LlmResponse` with `types.Content` and `types.Part` objects for both input and output transcriptions, instead of using dedicated transcription fields. Also removes a debug print from `audio_cache_manager.py`.

the transcription is not fully ready to be used yet so roll back the transcription change.

PiperOrigin-RevId: 799851950
2025-08-26 21:12:59 -07:00
Google Team Member bcf0dda8bc fix: AgentTool returns last content, instead of the content in the last event
This fixes the issue when inner agent has after_agent_callback updating state only, AgentTool will always return empty.

PiperOrigin-RevId: 799814933
2025-08-26 19:15:23 -07:00
Wei Sun (Jack) 4c70606129 chore: Renames MCPTool and MCPToolset to McpTool and McpToolset
- Keep original class names for backward-compatibility.
- Log warning if user instantiate the classes with original names.
- New names are more aligned with MCP SDKs convention.

PiperOrigin-RevId: 799777320
2025-08-26 17:02:41 -07:00
Ankur Sharma 216cb7aec0 fix: Update routes for run_eval, get_eval_result, list_eval_results and list_metrics_info
PiperOrigin-RevId: 799718430
2025-08-26 14:27:00 -07:00
Mofi Rahman ad81aa54de fix: Fix adk deploy docker file permission
Merge https://github.com/google/adk-python/pull/2563

Currently in adk deploy cloud_run or gke, the dockerfile copies the agent code after the file permission is set. This can lead to file permission not being set correctly for the container to open and read the file.

This PR will make sure the files are copied with the permission of the user that is set in the container.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2563 from moficodes:deploy-docker d7f6df4d893af75b360e6d96ffd2640ce6076ca2
PiperOrigin-RevId: 799371070
2025-08-25 20:03:37 -07:00
Google Team Member 47b88d2b06 feat: Add the ask_data_insights tool for natural language queries on BigQuery data
PiperOrigin-RevId: 799267061
2025-08-25 14:23:10 -07:00
Jack Wotherspoon 6806deaf88 feat: passthrough extra args for adk deploy cloud_run as Cloud Run args
Merge https://github.com/google/adk-python/pull/2544

The command `adk deploy cloud_run` supports limited `gcloud run deploy` args 😢.

Which makes the command fine for simple deployments...

It should support all current and future Cloud Run deployment args for the command to be widely adopted.

This can easily be done by passing through all extra args passed to `adk deploy cloud_run` to gcloud...

This PR assumes any extra args/flags passed after `AGENT_PATH` are gcloud flags.

## Example

```sh
# ADK flags
adk deploy cloud_run \
--project=$GOOGLE_CLOUD_PROJECT \
--region=$GOOGLE_CLOUD_LOCATION \
$AGENT_PATH \
# Use the -- separator for gcloud args
-- \
--min-instances=2 \
--no-allow-unauthenticated
```

This gives full Cloud Run feature support to ADK users 🤖 🚀

## Test Plan

To test you can just build locally or pip install feature branch directly:

```
uv venv
uv pip install git+https://github.com/jackwotherspoon/adk-python.git
```

Deploy to Cloud Run using additional arguments following `AGENT_PATH`, such as `--min-instance=2` or `--description="Cloud Run test"`:

```sh
uv run adk deploy cloud_run \
--project=$GOOGLE_CLOUD_PROJECT \
--region=$GOOGLE_CLOUD_LOCATION \
--with_ui \
$AGENT_PATH \
-- \
--labels=test-label=adk \
--min-instances=2
```

You can click on the Cloud Run service after deployment and check the service yaml, you should see the additional label etc.

<img width="1612" height="622" alt="image" src="https://github.com/user-attachments/assets/596a260a-0052-460b-9642-c18900ccf7c9" />

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2544 from jackwotherspoon:main 184a4d73f8dbe6f565ff92cf1c1fe69bb163de5e
PiperOrigin-RevId: 799252544
2025-08-25 13:45:21 -07:00
Wei Sun (Jack) 2b2f0b52d8 chore: Fixes a2a tests for python 3.9
A more common approach is to just skip entire module in pytest.

PiperOrigin-RevId: 799164877
2025-08-25 10:03:19 -07:00
Wei Sun (Jack) 0eb65c07d5 chore: Ignore hidden files in autoformat.sh
PiperOrigin-RevId: 798490378
2025-08-23 00:38:42 -07:00
akshaypachpute-1998 0b89f1882d chore: replaced hard coded value for user_id to the value from the tool context from parent agent. Fixes google/adk-python#2407
Merge https://github.com/google/adk-python/pull/2409

Description:

This PR Fixes: #2407

The AgentTool in /google/adk/tools/agent_tool.py uses a hardcoded user_id='tmp_user' when creating a new session for the agent it wraps. This happens within the run_async method.

code snippet
... @override async def run_async( self, *, args: dict[str, Any], tool_context: ToolContext, ) -> Any: ... session = await runner.session_service.create_session( app_name=self.agent.name, user_id='tmp_user',  # <-- This is hardcoded state=tool_context.state.to_dict(), ) ...

Why is this a problem?
This hardcoding breaks the chain of user identity. When a parent agent calls a sub-agent via the AgentTool, the original user_id is lost. Any tool or logic inside the sub-agent that needs to perform user-specific actions (e.g., accessing user data from a database, retrieving user-specific memory, checking permissions) will fail or operate on the wrong context because it receives 'tmp_user' instead of the actual user's ID.

Impact:
This prevents the creation of robust, multi-agent applications where user context must be maintained across different agents and tools. It limits the utility of AgentTool to only stateless sub-agents that do not require user-specific information.

Suggested Fix:
The user_id should be retrieved from the parent context, which is available via the tool_context parameter passed into run_async. The create_session call should be updated to use the dynamic user_id from the parent session.For example, the fix might involve accessing the user ID from the tool_context.

code-snippet
session = await runner.session_service.create_session( app_name=self.agent.name, user_id=tool_context._invocation_context.user_id, state=tool_context.state.to_dict(), )

To Reproduce
Steps to reproduce the behavior:
To reproduce this bug, we need to set up a two-agent system: a ParentAgent that calls a ChildAgent using the AgentTool. The ChildAgent will have a tool designed to simply return the user_id it receives from its context.

Expected behavior
It should return the user_id of the user calling the agent,

but, in current situation we are getting tmp_user

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2409 from akshaypachpute-1998:fix-issue-2407-agent-tool-context-propogation 0c3e8656fdf11386e3ab13a3a1f2df99a396dbd1
PiperOrigin-RevId: 798315832
2025-08-22 13:10:07 -07:00
Xiang (Sean) Zhou 124fee64e5 chore: Remove unnecessary import in runners
PiperOrigin-RevId: 798285019
2025-08-22 11:38:37 -07:00
Wei Sun (Jack) a360bc2542 docs: Clean up docs in sample
PiperOrigin-RevId: 798284758
2025-08-22 11:36:58 -07:00
Ankur Sharma 75ba9689e3 fix: Update routes for list_eval_sets, add_session_to_eval_set, get_eval, update_eval and delete_eval
PiperOrigin-RevId: 798241789
2025-08-22 09:41:59 -07:00
Wei Sun (Jack) 2c088acc9b docs: Fixes root_agent.yaml in tool_mcp_stdio_notion_config for Agent Config sample and add README.md
PiperOrigin-RevId: 798241478
2025-08-22 09:40:31 -07:00
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
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
Xuan Yang f8fd6a4f09 chore: add the missing license header for core_callback_config init file
PiperOrigin-RevId: 796641146
2025-08-18 17:29:09 -07:00
Google Team Member a953807cce feat: add Bigtable tools
These tools support basic operations to interact with Bigtable table metadata and query results.

PiperOrigin-RevId: 796571736
2025-08-18 14:17:08 -07:00
Google Team Member fa64545a9d fix: Fix the path for agent card in A2A demo
`AGENT_CARD_WELL_KNOWN_PATH` already contains a leading slash so is not needed in the `agent_card` URL.

PiperOrigin-RevId: 796543208
2025-08-18 13:04:38 -07:00
George Weale 004a0a0f2d fix: litellm-test due to breaking change in dep library of extension extra
PiperOrigin-RevId: 796543071
2025-08-18 13:03:04 -07:00
Google Team Member a117cf0af3 fix: Fix the path for agent card in A2A demo
`AGENT_CARD_WELL_KNOWN_PATH` already contains a leading slash so is not needed in the `agent_card` URL.

PiperOrigin-RevId: 796537920
2025-08-18 12:49:20 -07:00
Wei Sun (Jack) 1fd58cb363 chore(config): Creates yaml_utils.py in utils to allow adk dump yaml in the same style
PiperOrigin-RevId: 796531710
2025-08-18 12:34:09 -07:00
Shangjie Chen f03f167779 chore: Return explict None type for DELETE endpoints
The HTTP response code will become 204 No Content instead of 200.

PiperOrigin-RevId: 796123628
2025-08-17 09:58:40 -07:00
Liang Wu 43f302ce1a chore(config): Add _config suffix to all yaml-based agent examples
Also expand agent folder name to full spelling, e.g. ma --> multi_agent

PiperOrigin-RevId: 795926902
2025-08-16 16:10:43 -07:00
Shangjie Chen ecaa7b4c98 chore: Rename run related method and request to align with the conventions
PiperOrigin-RevId: 795660109
2025-08-15 16:48:01 -07:00
Xiang (Sean) Zhou 279e4fedd0 fix: Using base event's invocation id when merge multiple function response event
fix https://github.com/google/adk-python/issues/1531

PiperOrigin-RevId: 795657473
2025-08-15 16:38:15 -07:00
Liang Wu b3b70035c4 feat: support deploying config agent to Agent Engine in CLI
Both pure config and config with code are successfully deployed.

PiperOrigin-RevId: 795645102
2025-08-15 16:01:50 -07:00
Dan Liebling 22f34e9d2c fix: avoid crash when there is no candidates_token_count, which is Optional
PiperOrigin-RevId: 795643665
2025-08-15 15:56:05 -07:00
Liang Wu ba6e85eb3f docs(config): fix core_callback example
PiperOrigin-RevId: 795619488
2025-08-15 14:44:53 -07:00
Terrence Ryan c84350345a feat: adding build image to deploy cloud_run options (#2502)
* feat: adding build image to deploy cloud_run options

Gives the ability for a user to set the build image for the deployment step to Cloud Run.  Currently it is hard coded to python:3.11-slim, and this is still the default, but this allows that value to be overriden.

* fix: applied formatting scripts

testing:

Added tests to ensure the behavior of the cli remains consistent with when used or omitted.

* chore: next time run the formatter before you commit.

---------

Co-authored-by: Ivan Cheung <ivans.mailbox@gmail.com>
2025-08-15 11:36:44 -07:00
Shangjie Chen a2b7909fc3 fix: Fix the packaging version comparison logic in adk cli
Resolves https://github.com/google/adk-python/issues/2503

PiperOrigin-RevId: 795519711
2025-08-15 10:16:45 -07:00
Google Team Member b66054dd0d fix: Add Spanner admin scope to Spanner tool default Oauth scopes
PiperOrigin-RevId: 795519063
2025-08-15 10:15:15 -07:00
Wei Sun (Jack) 8a9a271141 fix(config): Fixes SequentialAgent.config_type type hint
Without ClassVar, it will cause pydantic to generate warning.

PiperOrigin-RevId: 795518646
2025-08-15 10:13:39 -07:00
Xiang (Sean) Zhou a2832d5ac7 feat: Support custom tool_name_prefix in auto-generated GoogleApiToolset
PiperOrigin-RevId: 795508179
2025-08-15 09:44:16 -07:00
Wei Sun (Jack) 1328e6ef62 docs(config): Adds a minimal sample to demo how to use Agent Config to create a multi-agent setup
PiperOrigin-RevId: 795501478
2025-08-15 09:22:52 -07:00
Wei Sun (Jack) cd357bf5ae fix: Fixes the host in the ansi bracket of adk web
localhost cannot always open Web UI, since we only bind 127.0.0.1.

PiperOrigin-RevId: 795484904
2025-08-15 08:26:01 -07:00
Google Team Member a27927dc81 fix: Add spanner tool name prefix
PiperOrigin-RevId: 795339631
2025-08-14 22:14:18 -07:00
Liang Wu 6c217bad82 chore: update models in samples/ folder to be gemini 2.0+
Gemini 1.5 is obsolete and not accessible to new projects.

PiperOrigin-RevId: 795330977
2025-08-14 21:36:23 -07:00
Xuan Yang c32cb6eef9 chore: remove the "one commit" requirement from the contributing guide
PiperOrigin-RevId: 795217167
2025-08-14 15:13:19 -07:00
Hangfei Lin 80052700f6 chore: Bump version to 1.11.0
release for 1.11.0

PiperOrigin-RevId: 795195869
2025-08-14 14:19:15 -07:00
Google Team Member c8059428a2 chore: add contributing spanner sample
PiperOrigin-RevId: 795154839
2025-08-14 12:41:28 -07:00
Xuan Yang e63e2a7106 fix: add the missing required tool parameters for Anthropic models
Fixes #1692

PiperOrigin-RevId: 795125801
2025-08-14 11:31:00 -07:00
Wei Sun (Jack) 9ba8eec220 feat(tracing): Adds more OpenTelemetry convention attributes: gen_ai.request.max_tokens, gen_ai.request.top_p and gen_ai.response.finish_reasons
Fixes #1234

PiperOrigin-RevId: 795082815
2025-08-14 09:52:50 -07:00
Kacper Jawoszek 9cfe43334a fix: Uncomment OTel tracing in base_llm_flow.py
It was mistakenly commented out in the previous change.

PiperOrigin-RevId: 795048873
2025-08-14 08:20:07 -07:00
Xiang (Sean) Zhou 52284b1bae fix: A2A RPC URL got overriden by host and port param of adk api server
PiperOrigin-RevId: 794708721
2025-08-13 13:20:26 -07:00
George Weale a74d3344bc chore: Added upper version bounds to dependencies in "pyproject.toml"
This change keeps dependencies to their major versions, but for the pre 1.0.0 releases pinned to minor releases as they could have breaking changes.

PyYAML: Version 7.0 is in development and could have breaking changes

absolufy-imports: The package is archived and no longer maintained.

anyio: Follows SemVer, so version 5.0 could have breaking changes.

authlib: Follows a SemVer-like pattern, so version 2.0 could have breaking changes.

click: A mature library, version 9.0 is the expected boundary for breaking changes.

fastapi: As a pre-1.0 library, the next minor release could have breaking changes.

google-api-python-client: Although in maintenance, version 3.0 could still have breaking changes.

google-cloud-aiplatform: Follows SemVer, so breaking changes are expected in version 2.0.

google-cloud-secret-manager: A stable Google library, version 3.0 could lead to breaking changes.

google-cloud-speech: A stable Google library, version 3.0 could lead to breaking changes.

google-cloud-storage: A stable Google library.

google-genai: As an official Google SDK, version 2.0 is the expected boundary for breaking changes.

graphviz: As a pre-1.0 library, the next minor release could have breaking changes.

mcp: As an SDK, version 2.0 is the boundary for potential breaking changes.

opentelemetry-api: Follows SemVer; version 2.0 could have breaking changes.

opentelemetry-exporter-gcp-trace: It's tied to the v1 OpenTelemetry API, so version 2.0 would likely be a breaking change.

opentelemetry-sdk: It's coupled to the v1 API, so version 2.0 would likely be a breaking change.

pydantic: This stops upgrades to the incompatible version 3.0 after its major 2.0 rewrite.

python-dateutil: Follows to SemVer, making version 3.0 the boundary for potential breaking changes.

python-dotenv: Locks to stable version 1.0 major release.

requests: As a more mature library, version 3.0 is boundary for breaking changes.

sqlalchemy: This locks the dependency to the stable version 2.0 API after its major rewrite.

starlette: As a pre-1.0 library, the next minor release could have breaking changes.

tenacity: This is a mature library, version 9.0 is boundary for breaking changes.

typing-extensions: Major versions are tied to large typing changes in Python itself.

tzlocal: The library has a history of introducing breaking API changes between major versions.

uvicorn: As a pre-1.0 library, the next minor release could have breaking changes.

watchdog: As a stable library, version 7.0 could have breaking changes.

websockets: Follows SemVer, so version 16.0 is the boundary for breaking changes.
PiperOrigin-RevId: 794677571
2025-08-13 12:03:47 -07:00
George Weale ddf2e2194b chore: Update python-version in .github/workflows/python-unit-tests.yml to ["3.9", "3.10", "3.11", "3.12", "3.13"]
Verified with uv on Python 3.12 and 3.13 using the same ignores as CI.
3.12:
uv python install 3.12 && uv venv --python 3.12 .venv && source .venv/bin/activate
uv sync --extra test --extra eval --extra a2a
python -m pytest tests/unittests --ignore=tests/unittests/artifacts/test_artifact_service.py --ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
3.13: repeated the above with 3.13 (separate env)
Result: All unit tests passed

PiperOrigin-RevId: 794669437
2025-08-13 11:43:24 -07:00
Kacper Jawoszek a30c63c593 fix: aclose all async generators to fix OTel tracing context
See https://github.com/google/adk-python/issues/1670#issuecomment-3115891100

PiperOrigin-RevId: 794659547
2025-08-13 11:18:26 -07:00
Wei Sun (Jack) c5af44cfc0 docs(config): Fixes tool_functions, which is a config-based sample for using tools
PiperOrigin-RevId: 794652291
2025-08-13 11:01:52 -07:00
Google Team Member c52f956433 chore: Update comment to reference "Streamable HTTP Client"
Corrects a typo in the `StreamableHTTPConnectionParams` docstring, changing "SSE" to "Streamable HTTP" to accurately reflect the referenced client.

PiperOrigin-RevId: 794424727
2025-08-12 23:45:23 -07:00
Xuan Yang 585141e0b7 fix: Use PreciseTimestamp for create and update time in database session service to improve precision
PiperOrigin-RevId: 794422113
2025-08-12 23:36:53 -07:00
Google Team Member 114db93d70 ADK changes
PiperOrigin-RevId: 794403729
2025-08-12 22:29:23 -07:00
Hangfei Lin e2518dc371 fix: Ignore AsyncGenerator return types in function declarations
For Vertex model backend, we send response back. This doesn't work for streaming tools that the return type is AsyncGenerator. So the fix here is to ignore the return type when it's AsyncGenerator.

We can't distinguish streaming vs non-streaming tool with AsyncGenerator though as LiveRequestQueue is optional in streaming tool.

Adds an `ignore_response` option to `build_function_declaration` to skip including the return type in the function declaration. This is enabled for tools that return `AsyncGenerator`, as the model does not yet support understanding these return types, while streaming tools can still handle them. Also, removes redundant return statements in `_get_mandatory_params`.

PiperOrigin-RevId: 794392846
2025-08-12 21:45:52 -07:00
Xiang (Sean) Zhou 8c65967cdc fix: Make all subclass of BaseToolset to call parent constructor
So that all member field are created / initialized in the base toolset.

PiperOrigin-RevId: 794388671
2025-08-12 21:32:24 -07:00
Xiang (Sean) Zhou ebd726f1f5 feat: Support adding prefix to tool names returned by toolset
This is to address the name conflict issue of tools returned by different toolset. Mainly it's to give each toolset a namespace.

We have a flag `add_tool_name_prefix` to decide whether to apply this behavior
We have a `tool_name_prefix` to let client specify a custom prefix, if not set , toolset name will be used as prefix.

PiperOrigin-RevId: 794306796
2025-08-12 16:17:53 -07:00
Goldy 54680edf3c fix: path parameter extraction for complex Google API endpoints
Merge https://github.com/google/adk-python/pull/1815

fix: path parameter extraction for complex Google API endpoints

- Fix GoogleApiToOpenApiConverter to handle path parameters in complex endpoints like /v1/documents/{documentId}:batchUpdate
- Use Google Discovery Document 'location' field
- Add comprehensive test suite for Google Docs batchUpdate functionality
- Verify parameter location handling for complex endpoint patterns
- Test schema validation for BatchUpdateDocumentRequest/Response

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1815 from goldylocks87:fix-issue-1814-path-parameter-extraction af5508ec6975b1ccbc34931a0041e422ee259c16
PiperOrigin-RevId: 794301898
2025-08-12 16:02:45 -07:00
Shangjie Chen bb3735c9ca chore: Remove logging that contains full event data from DatabaseSessionService
Resolves https://github.com/google/adk-python/issues/2153

PiperOrigin-RevId: 794288546
2025-08-12 15:19:52 -07:00
Xuan Yang a09a5e67aa chore: add the missing env variables in discussion_answering.yml
PiperOrigin-RevId: 794285985
2025-08-12 15:12:03 -07:00
Google Team Member 7e0880869b feat: Expose print_detailed_results param to AgentEvaluator.evaluate
Currently `print_detailed_results` is available only in `AgentEvaluator.evaluate_eval_set` while the adk-samples data science agent uses `AgentEvaluator.evaluate` https://github.com/google/adk-samples/blob/c230c3ddc16a3f9fc7edff409b567bdd65ebd9da/python/agents/data-science/eval/test_eval.py#L32.

PiperOrigin-RevId: 794262781
2025-08-12 14:07:17 -07:00
Google Team Member 1fc8d20ae8 feat: add Spanner first-party toolset (breaking change to BigQueryTool, consolidating into generic GoogleTool)
Spanner toolset support basic operations to interact with Spanner table metadata and query results.

Consolidate BigQueryTool into generic GoogleTool, so that BigQueryToolset and SpannerToolset can share.

PiperOrigin-RevId: 794259782
2025-08-12 13:59:37 -07:00
Google Team Member 10e3dfab1a feat: remove load_dotenv() in feature_decorator.py
PiperOrigin-RevId: 794249376
2025-08-12 13:35:49 -07:00
Xuan Yang 5fba1963c3 chore: add Gemini API docs as a new datastore for the ADK Answering Agent
PiperOrigin-RevId: 794247007
2025-08-12 13:30:00 -07:00
Xuan Yang 7d2cb654f0 chore: add the missing license header for some sample agents' files
PiperOrigin-RevId: 794165986
2025-08-12 10:24:36 -07:00
Xiang (Sean) Zhou 88f759a941 fix: docstring concatenation in 3.13
The issue was caused by a breaking change in Python 3.13's inspect.cleandoc() function that made it more conservative about whitespace handling:

Root Cause:

- Python 3.12-: inspect.cleandoc() used line.lstrip() - strips all whitespace (spaces, tabs, etc.)
- Python 3.13+: inspect.cleandoc() uses line.lstrip(' ') - strips only space characters

PiperOrigin-RevId: 793921360
2025-08-11 21:26:25 -07:00
Wei Sun (Jack) e295feb4c6 docs: Add workflow_triage sample for multi-agent request orchestration
Demonstrates intelligent triage system with root planning agent and parallel
execution agents.

Use session state to store the execution plan and coordinate with other specialized agents.

Check out README.md for more details.

PiperOrigin-RevId: 793884758
2025-08-11 19:05:53 -07:00
Liang Wu d87feb8ddb docs(config): add examples for config agents
PiperOrigin-RevId: 793871778
2025-08-11 18:09:55 -07:00
Shangjie Chen 88114d7c73 chore: Add docstring to clarify the behavior of preload memory tool
PiperOrigin-RevId: 793840979
2025-08-11 16:33:49 -07:00
Xiang (Sean) Zhou d0b3b5d857 chore: add experimental messages for a2a related API
PiperOrigin-RevId: 793812544
2025-08-11 15:09:08 -07:00
Wei Sun (Jack) d674178a05 chore: Fixes generate_image sample
PiperOrigin-RevId: 793725452
2025-08-11 11:15:06 -07:00
Wei Sun (Jack) dc26aad663 docs: Adds pypi badge to README.md
PiperOrigin-RevId: 793713600
2025-08-11 10:47:57 -07:00
Shangjie Chen 7f12387eb1 chore: Make all FastAPI endpoints async
PiperOrigin-RevId: 792886431
2025-08-08 21:58:34 -07:00
Eugen-Bleck 8f937b5175 docs: update StreamableHTTPConnectionParams docstring to remove SSE references (#1456)
Co-authored-by: Terrence Ryan <tpryan@google.com>
Fixes: google/adk-docs#475
2025-08-08 20:42:43 -07:00
Shangjie Chen c323de5c69 chore: Group FastAPI endpoints with tags
PiperOrigin-RevId: 792816574
2025-08-08 17:20:46 -07:00
Liang Wu b4f1ebea31 chore(config): replace @working_in_progress with @experimental for config agent feature
PiperOrigin-RevId: 792803076
2025-08-08 16:32:50 -07:00
Google Team Member 944e39ec2a chore: allow implementations to skip defining a close method on Toolset
PiperOrigin-RevId: 792760747
2025-08-08 14:22:17 -07:00
Xiang (Sean) Zhou 9478a31bf2 fix: Lazy load retrieval tools and prompt users to install extensions if import failed
PiperOrigin-RevId: 792701550
2025-08-08 11:37:47 -07:00
Xiang (Sean) Zhou f2005a2026 chore: Add sample agent to test support of output_schema and tools at the same time for gemini model
PiperOrigin-RevId: 792694074
2025-08-08 11:16:31 -07:00
Xiang (Sean) Zhou af635674b5 feat: Support both output_schema and tools at the same time in LlmAgent
1. Allow developers to specify output schema and tools together.
2. If both are specified, do the following:
  2.1 Do not set output schema on the model config
  2.2 Add a special tool called set_model_response(result)
  2.3 `result` has the same schema as the requested output_schema
  2.4 Instruct the model to use set_model_response() to output its final result, rather than output text directly.
  2.5 When the set_model_response() is called, ADK will extract its content and put it in a text part, so the client would treat it as the model response.

PiperOrigin-RevId: 792686011
2025-08-08 10:55:22 -07:00
Xiang (Sean) Zhou b4ce3b12d1 fix: incorrect logic in LlmRequest.append_tools and make BaseTool to call it
PiperOrigin-RevId: 792642882
2025-08-08 08:53:57 -07:00
Google Team Member 98a5730115 fix: incorrect logic in LlmRequest.append_tools and make BaseTool to call it
PiperOrigin-RevId: 792518526
2025-08-08 01:29:47 -07:00
Xiang (Sean) Zhou 4b2a8e3186 fix: incorrect logic in LlmRequest.append_tools and make BaseTool to call it
PiperOrigin-RevId: 792474565
2025-08-07 22:53:54 -07:00
Sam Hatfield e4d54b66b3 fix: Creates an InMemoryMemoryService within the EvaluationGenerator
Merge https://github.com/google/adk-python/pull/2263

Addresses #2084

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2263 from sjhatfield:main 8d6fca48437f151c34b2766ea4813a777bafcabd
PiperOrigin-RevId: 792336301
2025-08-07 15:40:42 -07:00
Xuan Yang 5900273455 chore: add Github workflow config for uploading ADK docs to knowledge store
PiperOrigin-RevId: 792272706
2025-08-07 12:52:28 -07:00
Xuan Yang b5a8bad170 chore: update ADK Answering agent to reference doc site instead of adk-docs repo
PiperOrigin-RevId: 792259386
2025-08-07 12:17:09 -07:00
Shangjie Chen 20c30d5819 chore: Bump version number to 1.10.0
PiperOrigin-RevId: 792206610
2025-08-07 10:05:01 -07:00
Yeesian Ng 83e5df7862 fix: Set the agent_framework when initializing module-based agent engine
PiperOrigin-RevId: 792170095
2025-08-07 08:27:15 -07:00
Google Team Member 25b2806301 fix: accommodate for open api schema that do not have any 'properties'
PiperOrigin-RevId: 792028582
2025-08-07 00:30:50 -07:00
Xuan Yang f6a022cda3 chore: only run ADK Answering Agent automatically when Q&A discussion is created
PiperOrigin-RevId: 792025646
2025-08-07 00:19:30 -07:00
Liang Wu e0a8355219 chore(config): add the public URL of JSON schema file to template
PiperOrigin-RevId: 791983175
2025-08-06 21:50:20 -07:00
Liang Wu d9ce2e691c feat(config): implement config and from_config for MCPToolset
The connection_params argument in the constructor is split into four arguments in the config class because some of them have identical fields. In order to identify which is which, a separate name is more convenient.

PiperOrigin-RevId: 791965995
2025-08-06 20:45:58 -07:00
Liang Wu dc193f7969 fix(config): fix adk create --type=config
Previously click didn't convert the input into the enum type.

PiperOrigin-RevId: 791922529
2025-08-06 18:10:21 -07:00
Xuan Yang 6277dae749 chore: add a disclaimer for the response from the answering agent
PiperOrigin-RevId: 791915465
2025-08-06 17:49:08 -07:00
Liang Wu ef837015f3 refactor(config): move BaseToolConfig to a separate file
PiperOrigin-RevId: 791841562
2025-08-06 14:18:20 -07:00
Google Team Member 54cc849de7 feat: Add metadata field to ADK BaseTool
PiperOrigin-RevId: 791790030
2025-08-06 12:11:42 -07:00
Liang Wu e73d71d324 feat(config): implement config and from_config for ExampleTool
Only list[Example] is supported in config. BaseExampleProvider will need to be used in code.

PiperOrigin-RevId: 791763913
2025-08-06 11:05:54 -07:00
Xiang (Sean) Zhou e528749a1c fix: lazy import VertexAiRagRetrieval
original codes try to eagerly import VertexAiRagRetrieval while it doesn't want to raise error if client try to import other names in this package and dependencies of VertexAiRagRetrieval is missing. so it swallow the import error which doesn't make sense, given vertex sdk is a must have for VertexAiRagRetrieval, we should fail fast.

this fix achieve the same purpose but fail fast if client try to import  VertexAiRagRetrieval from this package and miss certain dependencies (e.g. vertex sdk)

PiperOrigin-RevId: 791759776
2025-08-06 10:54:57 -07:00
Liang Wu 1686cc57c2 feat(config): implement configs and from_config() for CrewaiTool and LangchainTool
PiperOrigin-RevId: 791742964
2025-08-06 10:19:12 -07:00
Wei Sun (Jack) 53803522b6 refactor(config): Makes BaseAgent.from_config a final method and let sub-class to optionally override _parse_config to update kwargs if needed
This ensures that the pydantic hooks (e.g. model_validators) are triggered correctly.

PiperOrigin-RevId: 791545704
2025-08-05 23:53:25 -07:00
Liang Wu e3c2bf3062 chore: remove unused Example-related classes
PiperOrigin-RevId: 791538058
2025-08-05 23:26:06 -07:00
Liang Wu 2fff882fb0 feat(config): implement from_config() for BaseTool
PiperOrigin-RevId: 791520708
2025-08-05 22:26:23 -07:00
Xuan Yang a3b31ca950 chore: add the missing name for the ADK Answering Agent workflow
PiperOrigin-RevId: 791413949
2025-08-05 16:24:24 -07:00
Xuan Yang 8dc0c949af chore: add Github workflow config for the ADK Answering agent
PiperOrigin-RevId: 791407331
2025-08-05 16:07:09 -07:00
Hangfei Lin 71fbc9275b feat: Implement Live Session Resumption
Previous implementation doesn't pass the actual handle to server. Now we cache the handle and pass it over when reconnection happens.

To enable:
    run_config = RunConfig(
        session_resumption=types.SessionResumptionConfig(transparent=True)
    )

PiperOrigin-RevId: 791308462
2025-08-05 11:50:54 -07:00
Xiang (Sean) Zhou 423542a43f fix: shared default plugin manager and cost manager instances among multiple invocations
PiperOrigin-RevId: 791303349
2025-08-05 11:38:52 -07:00
Xiang (Sean) Zhou 37dae9b631 chore: Import AGENT_CARD_WELL_KNOWN_PATH from adk instead of from a2a directly
thus let adk handle import problem for a2a, e.g. python version need to be > 3.10 etc.

PiperOrigin-RevId: 791273137
2025-08-05 10:28:37 -07:00
Liang Wu 0e28d64712 feat(tools): create enterprise_web_search_tool as a tool instance
There is no argument for the tool, so just like google_search, we should make it an easy-to-use tool instance.

PiperOrigin-RevId: 791266806
2025-08-05 10:11:37 -07:00
Xiang (Sean) Zhou 6da6c2a44c fix: using async lock for accessing shared object in parallel executions and update tests for testing various type of functions
1. given we are running parallel functions in one event loop (one thread) , we should use async lock instead of thread lock
2. test three kind of functions:
  a. sync function
  b. async function that doesn't yield
  c. async function that yield

PiperOrigin-RevId: 791255012
2025-08-05 09:45:04 -07:00
Wei Sun (Jack) 8ef2177658 test: Fixes adk cli options and method parameters mismatching and adds a unit test for future proof checking
The test will fail if `@option` list and method parameter don't match.

Future proof test for #2328

PiperOrigin-RevId: 791022512
2025-08-04 21:08:57 -07:00
Google Team Member 97318bcd19 fix: correct type annotation
Overridden `supported_models` should be a `classmethod` rather than a `staticmethod`.

PiperOrigin-RevId: 790989895
2025-08-04 19:25:52 -07:00
Xuan Yang 283303032a chore: update the prompt to make the ADK Answering Agent more objective
PiperOrigin-RevId: 790882938
2025-08-04 13:59:59 -07:00
nikkie e369c283b3 fix: typo againt (in adk run --replay help)
Merge https://github.com/google/adk-python/pull/2327

`adk run --help` (adk 1.9.0)

```
  --replay FILE      The json file that contains the initial state of the
                     session and user queries. A new session will be created
                     using this state. And user queries are run againt the
                     newly created session. Users cannot continue to interact
                     with the agent.
```

```
$ git grep againt
src/google/adk/cli/cli_tools_click.py:        " queries are run againt the newly created session. Users cannot"
```

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2327 from ftnext:fix-typo-run-replay-help 77cae65a235d9119810fe3d209910562672713c8
PiperOrigin-RevId: 790872246
2025-08-04 13:32:41 -07:00
Xuan Yang 74589a1db7 chore: make LlmRequest.LiveConnectConfig field default to a factory to avoid sharing a mutable instance
PiperOrigin-RevId: 790854215
2025-08-04 12:43:34 -07:00
Wei Sun (Jack) e41dbccf7f fix(cli): Fixes adk deploy cloud_run cli
Fixes #2328

PiperOrigin-RevId: 790775592
2025-08-04 09:16:26 -07:00
Carol Zheng d620bcb384 fix: Remove thoughts from contents in llm requests
Merge https://github.com/google/adk-python/pull/2320

Fix #843

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2320 from CAROLZXYZXY:cazheng/fix-843 5b4a4b256928cb766a44a3e18d4300b7ee5f779f
PiperOrigin-RevId: 790592793
2025-08-03 22:48:25 -07:00
Xiang (Sean) Zhou 90b9193a20 chore: Add sample agent for testing parallel functions execution
PiperOrigin-RevId: 790208057
2025-08-02 14:53:03 -07:00
Xiang (Sean) Zhou 57cd41f424 feat: Support parallel execution of parallel function calls
PiperOrigin-RevId: 790182046
2025-08-02 12:28:19 -07:00
Divyansh Shukla 7556ebc76a feat: Allow max tokens to be customizable in Claude
PiperOrigin-RevId: 789901925
2025-08-01 14:43:57 -07:00
Wei Sun (Jack) 2bb20411f4 feat(config): Adds BaseAgent.config_type field to indicate the config for the current agent and removes if-else branches against LlmAgent/LoopAgent/... in config_agent_utils::from_config
This makes the logic work with any user-defined agent with user-defined XxxAgentConfig.

PiperOrigin-RevId: 789845354
2025-08-01 12:02:07 -07:00
Xiang (Sean) Zhou 86a44873e9 fix: Annotate response type as None for transfer_to_agent tool and set empty Schema as response schema when tool has no response annotation
1. if a function has no return type annotation, we should treat it as returning any type
2. we use empty schema (with `type` as None) to indicate no type constraints and this is already supported by model server

PiperOrigin-RevId: 789808104
2025-08-01 10:22:28 -07:00
Xiang (Sean) Zhou faadef167e fix: incompatible a2a sdk changes
a. camel case to snake case
b. A2ACardResolver moved to different module

PiperOrigin-RevId: 789807686
2025-08-01 10:20:37 -07:00
Google Team Member bead607364 chore: Hide the ask_data_insights tool until the API is publicly available
PiperOrigin-RevId: 789806535
2025-08-01 10:17:13 -07:00
Xuan Yang 041f04e89c chore: change LlmRequest.config's default value to be types.GenerateContentConfig() instead of None
PiperOrigin-RevId: 789792582
2025-08-01 09:36:20 -07:00
Google Team Member 16a15c8709 docs: fix typos
PiperOrigin-RevId: 789660536
2025-08-01 01:31:41 -07:00
Liang Wu 9656ccc407 feat(config): add GenerateContentConfig to LlmAgentConfig
PiperOrigin-RevId: 789631181
2025-07-31 23:33:36 -07:00
Liang Wu db975dfe2a chore: prevent triggering of _load_from_yaml_config in AgentLoader
PiperOrigin-RevId: 789502695
2025-07-31 15:59:41 -07:00
Wei Sun (Jack) 0ccbf6f2f8 chore: Bump version and update CHANGELOG for v1.9.0
PiperOrigin-RevId: 789494584
2025-07-31 15:34:18 -07:00
Ankur Sharma a54c7024cf fix: Re-adding eval related changes
Due to reasons that are being investigated, some of the recent changes got unintentionally reverted. We are adding those back in this PR.

PiperOrigin-RevId: 789384063
2025-07-31 10:18:39 -07:00
Shangjie Chen 1cfe6e9ffe chore: Remove unnecessary flags
PiperOrigin-RevId: 789379877
2025-07-31 10:07:39 -07:00
Shangjie Chen 314d6a4f95 fix: Return session state in list_session API endpoint
Resolves https://github.com/google/adk-python/issues/2193
Resolves https://github.com/google/adk-python/issues/781

PiperOrigin-RevId: 789143973
2025-07-30 19:53:46 -07:00
Alejandro Cruzado-Ruiz 247fd2066c chore: replace module import for BaseAgent in local_eval_service
PiperOrigin-RevId: 789136339
2025-07-30 19:19:17 -07:00
Shangjie Chen 7d06fb735e chore: Move create_session log to where the session is actually created
PiperOrigin-RevId: 789094066
2025-07-30 16:46:25 -07:00
Liang Wu d5dcef2cf0 fix(config): forbid extra fields in AgentToolConfig
PiperOrigin-RevId: 789038376
2025-07-30 14:13:48 -07:00
Xuan Yang 6191412b07 fix: keep existing header values while merging tracking headers for llm_request.config.http_options in Gemini.generate_content_async
PiperOrigin-RevId: 789013693
2025-07-30 13:09:56 -07:00
Xuan Yang 3be1bb37d9 fix: use pull_request_target event as the trigger of PR triaging agent
GitHub workflows triggered by `pull_request` events from forked repositories do not have access to secrets by default due to security considerations.

PiperOrigin-RevId: 789011890
2025-07-30 13:05:15 -07:00
Google Team Member 7c9b0a2567 feat: add chat first-party tool
This tool answers questions about structured data in BigQuery using natural language.

PiperOrigin-RevId: 789000987
2025-07-30 12:35:20 -07:00
Liang Wu 0c6086cb15 chore: remove redundant definition for adk deploy gke command
PiperOrigin-RevId: 788758843
2025-07-29 22:47:56 -07:00
hsuyuming 9db5d9a3e8 fix: Unable to acquire impersonated credentials
Merge https://github.com/google/adk-python/pull/2003

add scope "https://www.googleapis.com/auth/cloud-platform" within google.auth.default

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2003 from hsuyuming:fix/issue_2001_support_impersonated_credential 8874a367273aca98460f7f250bfc4690f883ebbe
PiperOrigin-RevId: 788656025
2025-07-29 16:42:25 -07:00
Xiang (Sean) Zhou de6ebddcd2 chore: Replace selcukg with genquan
PiperOrigin-RevId: 788590913
2025-07-29 13:48:54 -07:00
Liang Wu bcac9ba44c feat(config): add --type flag to adk create to allow starting with config
Updated the `adk create` default model version to gemini-2.5-flash.

PiperOrigin-RevId: 788589859
2025-07-29 13:45:11 -07:00
Xiang (Sean) Zhou 2f73cfde18 chore: Fix the long running test cases
The test test_token_exchange_not_supported was slow because of an incorrect monkeypatch target. The test was patching google.adk.auth.auth_handler.AUTHLIB_AVAILABLE, but the actual OAuth2 exchange logic uses a different AUTHLIB_AVAILABLE variable in google.adk.auth.exchanger.oauth2_credential_exchanger.
What was happening:
Test set auth_handler.AUTHLIB_AVAILABLE = False
AuthHandler.exchange_auth_token() called OAuth2CredentialExchanger.exchange()
But oauth2_credential_exchanger.AUTHLIB_AVAILABLE was still True
The exchanger attempted real OAuth2 token exchange with client.fetch_token()
This made actual network calls to OAuth2 endpoints, causing timeouts and delays

PiperOrigin-RevId: 788576949
2025-07-29 13:14:28 -07:00
Xuan Yang ec8dd5721a fix: merge tracking headers even when llm_request.config.http_options is not set in Gemini.generate_content_async
PiperOrigin-RevId: 788568620
2025-07-29 12:52:32 -07:00
Xuan Yang 646eb42533 chore: add Github workflow config for the ADK PR triaging agent
PiperOrigin-RevId: 788519884
2025-07-29 10:49:35 -07:00
Google Team Member bf72426af2 fix: runner was expecting Event object instead of Content object when using early exist feature
PiperOrigin-RevId: 788516645
2025-07-29 10:41:19 -07:00
Holt Skinner 9c0721beaa fix: Update agent_card_builder to follow grammar rules
Merge https://github.com/google/adk-python/pull/2226

Fixes #2223

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2226 from holtskinner:a2a-fixes ff556224e4071a8287a9ced19f645f0edd9916ef
PiperOrigin-RevId: 788512608
2025-07-29 10:32:32 -07:00
Xuan Yang 5eff66a132 chore: create an initial prototype agent to triage pull requests
This agent will post a comment if the PR is not following our contribution guides or add a label and reviewer for the PR if it passes the guide check.

PiperOrigin-RevId: 788511767
2025-07-29 10:29:35 -07:00
Google Team Member 282d67f253 fix: import cli's artifact dependencies directly
PiperOrigin-RevId: 788488501
2025-07-29 09:34:19 -07:00
Xiang (Sean) Zhou 3432b22172 fix: Copy the original function call args before passing it to callback or tools to avoid being modified
PiperOrigin-RevId: 788462897
2025-07-29 08:20:48 -07:00
Yifan Wang af35e2673f chore: WIP endpoint
PiperOrigin-RevId: 788232652
2025-07-28 18:06:03 -07:00
Xuan Yang f68d4d5cd0 chore: add the missing license header for a2a/__init__.py
PiperOrigin-RevId: 788227196
2025-07-28 17:50:26 -07:00
Google Team Member 16e8419e32 fix: restore bigquery sample agent to runnable form
A previous change of import paths had rendered the agent not-runnable out of the box. This change fixes that.

PiperOrigin-RevId: 788221276
2025-07-28 17:31:50 -07:00
Xiang (Sean) Zhou 0c855877c5 docs: Update documents about the information of viber coding
PiperOrigin-RevId: 788217734
2025-07-28 17:18:53 -07:00
Yeesian Ng f29ab5db05 feat: Respect the .ae_ignore file when deploying to agent engine
PiperOrigin-RevId: 788052720
2025-07-28 10:01:54 -07:00
Liang Wu f1889ae440 feat(config): support ADK built-in and custom tools in config
PiperOrigin-RevId: 787735915
2025-07-27 11:14:04 -07:00
Ankur Sharma c69dcf8779 feat: Added an Fast API new endpoint to serve eval metric info
This endpoint could be used by ADK Web to dynamically know:
- What are the available eval metrics in an App
- A description of those metrics
- A value range supported by those metrics

We also update the metric registry to make it mandatory to supply these details. The goal is to improve usability and interpretability of the eval metrics.

PiperOrigin-RevId: 787277695
2025-07-25 16:25:20 -07:00
Wei Sun (Jack) ec7d9b0ff6 chore(config): Moves agent configs to separate python files
PiperOrigin-RevId: 787245794
2025-07-25 14:40:49 -07:00
Yeesian Ng 6419a2aa9b fix: Switch from agent_engine_name to agent_engine_id for updating instances
PiperOrigin-RevId: 787179405
2025-07-25 11:24:10 -07:00
Yifan Wang b83b0a6eec chore: experiment endpoint
PiperOrigin-RevId: 787164869
2025-07-25 10:44:09 -07:00
Wei Sun (Jack) a3ff21eb0b feat(config): Adds CustomAgentConfig to support user-defined agents in config
PiperOrigin-RevId: 787148485
2025-07-25 09:56:10 -07:00
qieqieplus 1778490e64 fix: Fix unsafe_local_code_executor for import scope
Merge https://github.com/google/adk-python/pull/869

How to reproduce the error:

```
from google.adk.code_executors import UnsafeLocalCodeExecutor
from google.adk.code_executors.code_execution_utils import CodeExecutionInput

result = UnsafeLocalCodeExecutor().execute_code(
    invocation_context=None,
    code_execution_input=CodeExecutionInput(
        code='''
import math

def pi():
    return math.pi

print(pi())
'''
    )
)

print(result)
```

output:
```
CodeExecutionResult(stdout='', stderr="name 'math' is not defined", output_files=[])
```
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/869 from qieqieplus:main 63f557bbd3b7aa5c2801f5cc9e022d3364177308
PiperOrigin-RevId: 787145189
2025-07-25 09:45:34 -07:00
Vicente Ferrara a858d79b3a feat: cli funcionality to deploy an Agent to a running GKE cluster
Merge https://github.com/google/adk-python/pull/1607

- Added CLI functionality so that we can deploy and Agent onto a GKE cluster
- Related documentation https://github.com/google/adk-docs/pull/445

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1607 from vicentefb:GkeDeployAgent 42f35d93b0a5df5f6dbeb9ee7f869cde51e2f6eb
PiperOrigin-RevId: 786857789
2025-07-24 15:32:23 -07:00
Lam Nguyen c8f8b4a20a fix: Fix incorrect token count mapping in telemetry
Merge https://github.com/google/adk-python/pull/2109

Fixes #2105

## Problem
  When integrating Google ADK with Langfuse using the @observe
  decorator, the usage details displayed in Langfuse web UI were
  incorrect.

  The root cause was in the telemetry implementation where
  total_token_count was being mapped to gen_ai.usage.output_tokens
  instead of candidates_token_count.

  - Expected mapping:
    - candidates_token_count → completion_tokens (output tokens)
    - prompt_token_count → prompt_tokens (input tokens)

  - Previous incorrect mapping:
    - total_token_count → completion_tokens (wrong!)
    - prompt_token_count → prompt_tokens (correct)

  ## Solution
  Updated trace_call_llm function in telemetry.py to use
  candidates_token_count for output token tracking instead of
  total_token_count, ensuring proper token count reporting to
  observability tools like Langfuse.

  ## Testing plan
  - Updated test expectations in test_telemetry.py
  - Verified telemetry tests pass
  - Manual verification with Langfuse integration

  ## Screenshots
  **Before**

<img width="1187" height="329" alt="Screenshot from 2025-07-22 20-20-33" src="https://github.com/user-attachments/assets/ad5fc957-64a2-4524-bd31-0cebb15a5270" />

  **After**

<img width="1187" height="329" alt="Screenshot from 2025-07-22 20-21-40" src="https://github.com/user-attachments/assets/3920df2a-be75-47e0-9bd0-f961bb72c838" />

 _Notes_: From the screenshot, there's another problem: thoughts_token_count field is not mapped, but this should be another issue imo

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2109 from tl-nguyen:fix-telemetry-token-count-mapping 3d043f558b5f8bcb2c6e0370e2cc4c0ff25d1f4a
PiperOrigin-RevId: 786827802
2025-07-24 14:01:03 -07:00
Shangjie Chen 11037fc133 chore: Filter event with only functions, thought_signatures when adding to memory
PiperOrigin-RevId: 786825628
2025-07-24 13:54:37 -07:00
Yeesian Ng 206a13271e feat: Add a CLI option to update an agent engine instance
PiperOrigin-RevId: 786816663
2025-07-24 13:27:49 -07:00
Xuan Yang 3be0882c63 feat: add -v, --verbose flag to enable DEBUG logging as a shortcut for --log_level DEBUG
PiperOrigin-RevId: 786797394
2025-07-24 12:30:30 -07:00
Alejandro Cruzado-Ruiz e176f03e8f feat: modularize fast_api.py to allow simpler construction of API Server
PiperOrigin-RevId: 786763344
2025-07-24 10:53:13 -07:00
Kavin Kumar B 7206e0a0eb fix: eval module not found exception string
Merge https://github.com/google/adk-python/pull/2148

This PR fixes #2071 exception string from `pip install google-adk[eval]` to `pip install "google-adk[eval]"` which makes it compatible for all the bash, zsh and other terminals

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2148 from kavinkumar807:fix-module-not-found-exception-string-in-eval 914281006a0e162665c0933d0c0ee0c37eb397cf
PiperOrigin-RevId: 786752261
2025-07-24 10:23:03 -07:00
Yeesian Ng fbe6a7b8d3 fix: Add absolutize_imports option when deploying to agent engine
PiperOrigin-RevId: 786749263
2025-07-24 10:15:35 -07:00
Google Team Member bfc203a92f feat: modularize fast_api.py to allow simpler construction of API Server
PiperOrigin-RevId: 786646546
2025-07-24 04:03:19 -07:00
Hangfei Lin 5e8aa15a50 feat: add support for session resumption(only transparent mode) config to run_config
This commit adds support for the session resumption configuration in the run_config.
The SessionResumptionConfig is added to RunConfig to allow the user to set up a configuration for session resumption(only transparent mode for now).

There are two modes of session resumption: manual and transparent. In manual mode, you have to manually bookkeeping the session information and restarts the session which is tricky to do right now. In transparent mode, the server does the bookkeeping for you and no hassle on ADK side. For now, the transparent mode should be enough.

Also, added the relevant unit tests to check that every possible configuration is set properly and the run_config is correctly populated.
This is needed for supporting the new session resumption feature.

PiperOrigin-RevId: 786549455
2025-07-23 21:37:00 -07:00
Che Liu 16392984c5 feat: Expose Gemini RetryOptions to client
google.genai SDK has introduced a new retry_options. This change exposes this configuration
to ADK users

Usage:

```python
root_agent = Agent(
    model=Gemini(
        model='gemini-2.0-flash',
        retry_options=types.HttpRetryOptions(
	    initial_delay=1,
	    attempts=2
	    # ... Retry options from google.genai
	),
	# ...
    ),
```
PiperOrigin-RevId: 786472564
2025-07-23 16:50:09 -07:00
Che Liu 20537e8bfa feat: Add sample plugin for logging
This plugin helps printing all critical events in the console. It is not a replacement
of existing logging in ADK. It rather helps terminal based debugging by showing all logs in the console, and serves as a
simple demo so everyone could develop their own plugins.

PiperOrigin-RevId: 786470637
2025-07-23 16:43:32 -07:00
Che Liu 00afaaf2fc feat: add new callbacks to handle tool and model errors
This CL add new callbacks in plugin system:
- `on_tool_error_callback`
- `on_model_error_callback`

This allow the user to create plugins that can handle errors.

PiperOrigin-RevId: 786469646
2025-07-23 16:40:09 -07:00
Alejandro Cruzado-Ruiz dfc25c17a9 feat: modularize fast_api.py to allow simpler construction of API Server
PiperOrigin-RevId: 786467758
2025-07-23 16:33:54 -07:00
Ariz Chang 32ae882a49 feat: Add camel case converter for agents
PiperOrigin-RevId: 786465205
2025-07-23 16:27:03 -07:00
Ankur Sharma 884c201958 chore: Release 1.8.0
PiperOrigin-RevId: 786462899
2025-07-23 16:19:49 -07:00
Andrew Larimer 70c461686e fix: add space to allow adk deploy cloud_run --a2a
Merge https://github.com/google/adk-python/pull/2138

This missing space leads to an error when deploying to cloud_run that says "No option --a2a/apps/agents"

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2138 from andrewlarimer:fix--add-space-to-allow-adk-deploy-cloud_run---a2a 47831f10e1f7f6c27b5f6b8c102b2f7db4619778
PiperOrigin-RevId: 786459787
2025-07-23 16:09:49 -07:00
Ankur Sharma 1355bd643b feat: Refactored AgentEvaluator and updated it to use LocalEvalService
With this change we ensure that all three eval entry points, web, cli and pytest use the common LocalEvalService.

Updates to web and cli happened in a previous change.

PiperOrigin-RevId: 786445632
2025-07-23 15:27:26 -07:00
Xiang (Sean) Zhou 927c75f0ee chore: Replace imports by importing from actual module instead of from package (__init__.py)
PiperOrigin-RevId: 786342250
2025-07-23 10:49:43 -07:00
Xiang (Sean) Zhou 430b82024f chore: Fixed flaky test_update_credential_with_tokens unittest
PiperOrigin-RevId: 786340983
2025-07-23 10:45:01 -07:00
Xiang (Sean) Zhou 70266abfc2 chore: fix UT failures of test_google_llm.py
Mainly it's due to GenAI sdk changed their header of genai SDK versions, we have UT to verify that ADK or ADK users won't override their headers. Updated the header accordingly in the UT.

PiperOrigin-RevId: 786334741
2025-07-23 10:31:16 -07:00
Holt Skinner a911469616 chore: Update a2a-sdk to 0.2.16
Convert a2a types to use snake_case fields

https://github.com/a2aproject/a2a-python/releases/tag/v0.2.16

PiperOrigin-RevId: 786279179
2025-07-23 07:54:03 -07:00
Michael Timblin ce7253f63f fix: Use correct type for actions parameter in ApplicationIntegrationToolset
Merge https://github.com/google/adk-python/pull/2102

Addresses https://github.com/google/adk-python/issues/2101

I've ran `pytest ./tests/unittests`, and all tests passed

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2102 from manifoldtimblin:fix-type-hint 6d4ab724ff07688158d3d121a78b2c00493a26a7
PiperOrigin-RevId: 786046567
2025-07-22 16:49:45 -07:00
Alejandro Cruzado-Ruiz bda3df2480 feat: Refactor AgentLoader into base class and add InMemory impl alongside existing filesystem impl
PiperOrigin-RevId: 786008518
2025-07-22 14:58:32 -07:00
Ankur Sharma 4ae4c69c32 fix: ModuleNotFound error should be caught when dependencies of LocalEvalService are not installed
Once caught we publish the clarifying message to install the extra.

PiperOrigin-RevId: 785999033
2025-07-22 14:32:02 -07:00
Xiang (Sean) Zhou 32df937ebc chore: Update docstring for is_final_response method
PiperOrigin-RevId: 785983329
2025-07-22 13:50:30 -07:00
Yifan Wang 702e9bf556 chore: update adk web
PiperOrigin-RevId: 785972516
2025-07-22 13:22:34 -07:00
Ankur Sharma ff31f57dc9 fix: Move some API request and responses to DEBUG logging level
Please set --log_level to DEBUG, if you are interested in having those API request and responses in logs.

NOTE: Generally it is not recommended to have DEBUG log level for services that run in a production setting. It is our recommendation to only use DEBUG log level in a debug or development setting.
PiperOrigin-RevId: 785972338
2025-07-22 13:22:18 -07:00
Max Thormé d4f01afc15 fix(comment): fix comment to malicious user cannot obtain another user’s session
Merge https://github.com/google/adk-python/pull/1959

### What

Fix misleading comment.

```diff
- # Make sure a malicious user can obtain a session and events not belonging to them
+ # Make sure a malicious user **cannot** obtain a session or events not belonging to them
```

### Why

The previous wording contradicted the assertion `assert len(session_mismatch.events) == 0`, which verifies that a malicious user **cannot** access another user’s session or events.

### Testing plan

Docs-only change.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1959 from mthorme:fix-comment-session-mismatch b1f139af340bd240d40ed58f5dea3274c3a3bd83
PiperOrigin-RevId: 785908548
2025-07-22 10:33:57 -07:00
Shangjie Chen f46396fa98 chore: Allow httpoptions override in VertexAiSessionService
PiperOrigin-RevId: 785886180
2025-07-22 09:36:17 -07:00
Google Team Member 13ff009d34 fix: Handle non-json-serializable values in the execute_sql tool
This change takes cares of SQL results containing values that are not json serializable (e.g. datetime, bignumeric) by converting them to their string representation.

PiperOrigin-RevId: 785719997
2025-07-21 23:17:06 -07:00
Jacky Wu 6cc3d9ddd1 chore: follow-up #946 to allow session db kwargs in fast api entrance
Merge https://github.com/google/adk-python/pull/1042

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1042 from Colstuwjx:chore/expose-database-args-in-fastapi 83a20cf400a8a712c57cb3574fdd654ab5d8d4d6
PiperOrigin-RevId: 785714547
2025-07-21 22:52:20 -07:00
Xiang (Sean) Zhou 083dcb4465 feat: Add ComputerUseToolset
PiperOrigin-RevId: 785646071
2025-07-21 18:08:35 -07:00
Xiang (Sean) Zhou b2c2f1bd33 chore: Add an a2a sample agent to demo running the a2a server via unvicorn command and run remote agent as root_agent
PiperOrigin-RevId: 785629271
2025-07-21 17:08:35 -07:00
Xiang (Sean) Zhou a77d68964a feat: Add an to_a2a util to convert adk agent to A2A ASGI application
Users can do :
```
a2a_app = to_a2a(root_agent)
```
then use below command to start a2a server:
```
uvicorn user_module:a2a_app --host localhost --port 8000
```

PiperOrigin-RevId: 785625048
2025-07-21 16:54:53 -07:00
Ankur Sharma d1f182e8e6 feat: Use LocalEvalService to run all evals in cli and web
We update both adk web run eval endpoint and adk eval cli to use the LocalService. The old method is marked as deprecated and will be removed in later PRs.

PiperOrigin-RevId: 785612708
2025-07-21 16:15:11 -07:00
Ariz Chang 0e173d7363 feat: Add camel case converter for agents
PiperOrigin-RevId: 785602954
2025-07-21 15:45:24 -07:00
Xiang (Sean) Zhou 18f5bea411 feat: Add agent card builder
PiperOrigin-RevId: 785565665
2025-07-21 13:59:02 -07:00
Jianfeng Zeng f2caf2eeca fix: Add buffer to the write file option
PiperOrigin-RevId: 785546915
2025-07-21 13:08:29 -07:00
Liang Wu dfee06ac06 feat(config): support input/output schema by fully-qualified code reference
PiperOrigin-RevId: 785541326
2025-07-21 12:53:13 -07:00
Wei Sun (Jack) 2aab1cf98e fix: allows current sub-agent to finish execution before exiting the loop agent due to a sub-agent's escalation. This commit also disables the summarization for exit_loop tool
Fixes #423

Related to #1670

- This avoids the `GeneratorExit` error thrown, which would crash OTel metric collection and cause `Failed to detach context` error.
- This also allows all function  calls are processed when exit_loop is called together with other tools in the same LLmResponse.

A sample agent for testing:

```
from google.adk import Agent
from google.adk.agents.loop_agent import LoopAgent
from google.adk.tools.exit_loop_tool import exit_loop

worker_1 = Agent(
    name='worker_1',
    description='Worker 1',
    instruction="""\
Just say job #1 is done.

If job #1 is said to be done. Call exit_loop tool.""",
    tools=[exit_loop],
)

worker_2 = Agent(
    name='worker_2',
    description='Worker 2',
    instruction="""\
Just say job #2 is done.

If job #2 is said to be done. Call exit_loop tool.""",
    tools=[exit_loop],
)

work_agent = LoopAgent(
    name='work_agent',
    description='Do all work.',
    sub_agents=[worker_1, worker_2],
    max_iterations=5,
)

root_agent = Agent(
    model='gemini-2.0-flash',
    name='hello_world_agent',
    description='hello world agent that can roll a  check prime',
    instruction="""Hand off works to sub agents.""",
    sub_agents=[work_agent],
)
```
PiperOrigin-RevId: 785538101
2025-07-21 12:43:19 -07:00
Xuan Yang 96a0d4b02c chore: undo the workaround which bypassed the setup-uv bug
Bug https://github.com/astral-sh/setup-uv/issues/489 has been fixed.

PiperOrigin-RevId: 785529944
2025-07-21 12:20:02 -07:00
Ankur Sharma 65cb6d6bf3 fix: Check that mean_score is a valid float value
In some cases, Vertex AI evaluation returns nan values for the metrics. That was not handled correctly.

PiperOrigin-RevId: 785514456
2025-07-21 11:36:55 -07:00
Ankur Sharma fc85348f91 fix: add utf-8 encoding to file based reads and writes of eval data
This will help manage encoding consistency between reads and writes.

PiperOrigin-RevId: 785503746
2025-07-21 11:09:45 -07:00
Xiang (Sean) Zhou 9467720919 chore: Remove unused import from hello world sample agent
PiperOrigin-RevId: 785501232
2025-07-21 11:03:03 -07:00
Xiang (Sean) Zhou ee3918e34e chore: Update the error message when A2A is not supported for the installed python version
PiperOrigin-RevId: 785490858
2025-07-21 10:37:33 -07:00
Vasilii Novikov 81e0d4083f feat: make GCS artifact service async under the hood
Merge https://github.com/google/adk-python/pull/1347

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

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1347 from condorcet:async_gcs_artifact_storage 3efee5a923b08af606aa5525e31816e0bc7b865d
PiperOrigin-RevId: 785488472
2025-07-21 10:31:41 -07:00
Dana K. Williams 2486349268 docs: Fix missing toolbox-core dependency and improve installation guide
Merge https://github.com/google/adk-python/pull/1195

## Summary
Updated the Toolbox Agent documentation to address a critical missing dependency that prevents the agent from running successfully.

## Changes Made
- **Added missing dependency**: Documented that `toolbox-core` must be installed via `pip install toolbox-core`
- **Improved documentation structure**: Added clear section numbering and better organization
- **Enhanced readability**: Fixed grammar, capitalization, and formatting throughout
- **Added Prerequisites section**: Set clear expectations before installation begins
- **Clarified optional steps**: Made it clearer when database creation can be skipped

## Problem Solved
The original documentation was missing a crucial step - installing the `toolbox-core` package. Without this dependency, users encounter an `ImportError: No module named 'toolbox-core'` when trying to use the `ToolboxToolset` class in ADK. This fix ensures users can successfully set up and run the agent without encountering import errors.

## Testing
- Verified the installation steps work correctly with the added dependency
- Confirmed the agent runs successfully after following the updated documentation

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1195 from designcomputer:patch-1 b90c71fe95aa09a3dca069e91f14791f557ab2e3
PiperOrigin-RevId: 785487495
2025-07-21 10:29:33 -07:00
Xiang (Sean) Zhou 3643b4ae19 feat: Allow toolset to process llm_request before tools returned by it
PiperOrigin-RevId: 785480813
2025-07-21 10:11:40 -07:00
Xiang (Sean) Zhou cec400ada3 chore: Autoformat history_management agent codes
PiperOrigin-RevId: 785003632
2025-07-19 17:51:54 -07:00
Google Team Member d2461ecccb refactor: only import some module when needed and add follow_symlink=True when serve static files
PiperOrigin-RevId: 784956132
2025-07-19 12:54:05 -07:00
Calvin Giles ffe2bdbe4c feat: Add support for vertex gemini model optimizer
Merge https://github.com/google/adk-python/pull/1130

This enables the use of the `model-optimizer-*` family of models in vertex, as per the [documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/vertex-ai-model-optimizer#using-vertex-ai-model-optimizer).

To use this, ensure your location is set to `global` and pass a model optimizer model to an agent:

```python
root_agent = Agent(
    model="model-optimizer-exp-04-09",
    name="fast_and_slow_agent",
    instruction="Answer any question the user gives you - easy or hard.",
    generate_content_config=types.GenerateContentConfig(
        temperature=0.01,
        model_selection_config=ModelSelectionConfig(
            feature_selection_preference=FeatureSelectionPreference.BALANCED
            # Options: PRIORITIZE_QUALITY, BALANCED, PRIORITIZE_COST
        )
    ),
)
```
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1130 from calvingiles:feat-model-optimizer 1a76bfa22420edb07d83415dcea6dd0114084e8e
PiperOrigin-RevId: 784921913
2025-07-19 09:05:17 -07:00
Calvin Giles 67284fc466 feat: History Management Sample
Merge https://github.com/google/adk-python/pull/891

This creates a sample relating to discussion #826 - how to manage context windows.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/891 from calvingiles:history-management-sample 2827817bea8d96ea0eee7e3ba84c14bd1fe4286d
PiperOrigin-RevId: 784920438
2025-07-19 08:57:11 -07:00
Hangfei Lin 0ec69d05a4 feat: Enhance LangchainTool to accept more forms of functions
Now the LangchainTool can wrap:

* Langchain StructuredTool (sync and async).
* Langchain @Tool (sync and async).

This enhance the flexibility for user and enables async functionalities.

PiperOrigin-RevId: 784728061
2025-07-18 15:56:17 -07:00
Hangfei Lin f1e0bc0b18 chore: remove pr-commit-check
With this mode, the PR commit can be squashed before copybara. So we can delete the pr-commit-check.yml.

PiperOrigin-RevId: 784665025
2025-07-18 12:26:46 -07:00
Liang Wu 5edc493da9 chore: allow "from google.adk.tools import AgentTool"
PiperOrigin-RevId: 784606041
2025-07-18 09:30:40 -07:00
Copybara-Service 3568c9291d Merge pull request #547 from jeffreyrubi:fix/missing-path-level-parameters
PiperOrigin-RevId: 784415343
2025-07-17 20:27:46 -07:00
Copybara-Service d0a330cd15 Merge pull request #2020 from thiagosalvatore:main
PiperOrigin-RevId: 784393522
2025-07-17 18:50:46 -07:00
seanzhou1023 637fa410d8 Merge branch 'main' into main 2025-07-17 18:23:32 -07:00
Sean Zhou 6f016609e8 fix: support path level parameters for open_api_spec_parser
autoformat the changes
2025-07-17 18:09:40 -07:00
Hangfei Lin bb1b1c695f Merge branch 'main' into fix/missing-path-level-parameters 2025-07-17 17:46:27 -07:00
Wei Sun (Jack) bb4ff2cc3d chore: fixes formatting in adk_project_overview_and_architecture.md
PiperOrigin-RevId: 784371131
2025-07-17 17:21:14 -07:00
Wei Sun (Jack) b1f4aebb25 chore: lint fixings in vertex_ai_memory_bank.py
* Adds type hints;
* Switches to lazy evaluation in logs.

PiperOrigin-RevId: 784353566
2025-07-17 16:21:49 -07:00
Shangjie Chen 2e778049d0 feat: Support passing fully qualified agent engine resource name when constructing session service and memory service
Resolves https://github.com/google/adk-python/issues/1760

PiperOrigin-RevId: 784353411
2025-07-17 16:19:55 -07:00
Ankur Sharma 36e45cdab3 feat: Enable FinalResponseMatchV2 metric as an experiment
PiperOrigin-RevId: 784346859
2025-07-17 15:59:47 -07:00
Xuan Yang 35de210d4e chore: add a script to upload ADK docs for the ADK Answering Agent
PiperOrigin-RevId: 784343501
2025-07-17 15:49:44 -07:00
Xuan Yang bbe1c9dc66 fix: specify version into the uv installation action to bypass the setup-uv bug
https://github.com/astral-sh/setup-uv/issues/489

PiperOrigin-RevId: 784339143
2025-07-17 15:35:15 -07:00
Thiago Salvatore 9ad4350c88 Merge branch 'main' of github.com:thiagosalvatore/adk-python 2025-07-17 18:21:59 -03:00
Thiago Salvatore 2f8bb91e6b add docstring 2025-07-17 18:21:40 -03:00
Thiago Salvatore 3f01c8c999 Merge branch 'main' into main 2025-07-17 18:20:37 -03:00
Thiago Salvatore b5850e0757 reformat file structure 2025-07-17 18:17:09 -03:00
Thiago Salvatore 53df35ee58 fix(schema to dict): fix serialization of tools with nested schema 2025-07-17 18:16:17 -03:00
Xuan Yang 6e68c2d7f3 chore: update ADK Triage Agent to set issue type
It will change bug report to "Bug" type and feature request to "Feature" type.

PiperOrigin-RevId: 784280674
2025-07-17 12:51:41 -07:00
Xuan Yang 8ada46a18e chore: remove the redundant service.bucket setting in mock_gcs_artifact_service
PiperOrigin-RevId: 784253138
2025-07-17 11:29:32 -07:00
Xuan Yang 1c4c887bec fix: use the same word extractor for query and event contents in InMemoryMemoryService
PiperOrigin-RevId: 784236637
2025-07-17 10:43:01 -07:00
Xuan Yang 78697aa6af chore: add to_session method in StorageSession for readability
PiperOrigin-RevId: 784232578
2025-07-17 10:32:18 -07:00
Ankur Sharma b17d8b6e36 fix: Raise NotFoundError in list_eval_sets function when app_name doesn't exist
PiperOrigin-RevId: 784216832
2025-07-17 09:53:26 -07:00
Xiang (Sean) Zhou 377b5a9b78 fix: Add response schema for agent tool function declaration even when it's return None
PiperOrigin-RevId: 784216811
2025-07-17 09:51:34 -07:00
Xiang (Sean) Zhou 33ac8380ad fix: Set response schema for function that returns None
PiperOrigin-RevId: 784053725
2025-07-16 23:59:45 -07:00
Jianfeng Zeng 31fa5d91bd feat: Update builder/save endpoint to accept files as input. Write the agent yaml file to the agent folder
PiperOrigin-RevId: 783963934
2025-07-16 17:55:55 -07:00
Xuan Yang b705b35977 fix: update documentation owner's Github username for the ADK Triage Agent
PiperOrigin-RevId: 783951115
2025-07-16 17:10:25 -07:00
Shangjie Chen eccb484985 chore: Update label name for bot triaged issues
Also assign agent engine related issue to yeesian as poc

PiperOrigin-RevId: 783941809
2025-07-16 16:39:25 -07:00
Yifan Wang 2f6ab08580 chore: Release 1.7.0
PiperOrigin-RevId: 783918022
2025-07-16 15:29:19 -07:00
Hangfei Lin 7415f2c094 feat: Add tool callback chaining support for live streaming
**Highlights:**

-   **Callback Chaining:** Now supports a list of before and after callbacks, as in the non-live version. Callbacks are executed in order, stopping when one returns a response.
-   **Unit Tests:** Added new unit tests for before and after callbacks, async and sync versions, callback chains and mixed callbacks.
-   **Sample Agent:** Introduced a new example agent with multiple callbacks showing various behaviors: audit, security, validation, and enhancement. This provides practical usage examples.

PiperOrigin-RevId: 783884562
2025-07-16 13:56:06 -07:00
Hangfei Lin 6071b34650 feat: Implement Activity Start and End signals in LiveRequestQueue and BaseLLMConnection
This change adds activity start and end signals to the LiveRequestQueue,
allowing clients to manually control the start and end of user input in
streaming sessions when automatic voice activity detection is disabled.

The LiveRequestQueue allows users to send messages to the model with the following semantics:
- `content`: sends turn-by-turn content.
- `blob`: sends a media blob for realtime streaming (e.g., audio).
- `activity_start`: indicates the beginning of an activity.
- `activity_end`: indicates the end of an activity.
- `close`: closes the connection.

GeminiLLMConnection has been updated to send the new activity signals to the backend.

This change is a necessary to support clients (e.g. voice assistants) that do not want to use automatic voice activity detection. In this case, the client will be responsible to send the `activity_start` signal when the user starts talking, and `activity_end` when the user finishes talking.

To test the change:
    run_config = RunConfig(
        realtime_input_config=types.RealtimeInputConfig(
            automatic_activity_detection=types.AutomaticActivityDetection(
                disabled=True,
            ),
        )
    )

    import threading  # Add this import

    def thread_target():
      # Define the async operations to run in the background.
      async def background_task():
        live_request_queue.send_activity_start()

        # live_request_queue.send_content(
        #     content=types.Content(
        #         role='user',
        #         parts=[types.Part.from_text(text="hi, what's the time?")],
        #     )
        # )

        await asyncio.sleep(3)
        live_request_queue.send_activity_end()

PiperOrigin-RevId: 783882447
2025-07-16 13:51:04 -07:00
Google Team Member b89aac9eb3 ADK changes
PiperOrigin-RevId: 783804355
2025-07-16 10:17:19 -07:00
Google Team Member 3f9f773d9b feat: Add ability to send state change with message
PiperOrigin-RevId: 783589708
2025-07-15 21:17:04 -07:00
Yifan Wang 7e8762896e chore: update adk-web
PiperOrigin-RevId: 783527209
2025-07-15 17:14:19 -07:00
Ariz Chang a4cbbf3e81 feat: Add ability to send state change with message
PiperOrigin-RevId: 783516738
2025-07-15 16:37:26 -07:00
Xiang (Sean) Zhou b977d12ea8 refactor: Add save_credential and load_credential in callback context for developer to access credential service
developer may want to save/load credentials themselves to/from credential service. see (https://github.com/google/adk-python/issues/1816)

PiperOrigin-RevId: 783487628
2025-07-15 15:09:19 -07:00
Xiang (Sean) Zhou b1fa383e73 docs: Update agent transfer related doc string and comments
This is to address https://github.com/google/adk-python/issues/1907

PiperOrigin-RevId: 783481177
2025-07-15 14:50:33 -07:00
Xiang (Sean) Zhou 1a75848391 refactor: Use CallbackContext in credential service for saving/loading credential
1. credential service may be accessed by callbacks
2. plan to add load_credential and save_credential method in CallbackContext (see cl/782158513) given customer has requirement to access credential service themselves. (see https://github.com/google/adk-python/issues/1816)

It's backward compatible given CallbackContext is parent class of ToolContext

PiperOrigin-RevId: 783480378
2025-07-15 14:48:38 -07:00
Xiang (Sean) Zhou bf7745f428 fix: Create correct object for image and video content in litellm
PiperOrigin-RevId: 783478779
2025-07-15 14:44:14 -07:00
Hangfei Lin c2058f3779 chore: adk Add more documentations for ADK live feature in ADK.md
Also added commit message guidelines.

PiperOrigin-RevId: 783450329
2025-07-15 13:27:38 -07:00
Alejandro Cruzado-Ruiz 94dc03761e fix: return empty list in place of raising FileNotFoundError when there are no eval sets
PiperOrigin-RevId: 783439932
2025-07-15 12:56:38 -07:00
Liang Wu 41f1888116 feat(config): support callbacks in BaseAgent and LlmAgent
PiperOrigin-RevId: 783422160
2025-07-15 12:05:10 -07:00
Xiang (Sean) Zhou 3c6e18fd1c fix: Don't set error_code and error_message when model stop response in normal case
PiperOrigin-RevId: 783415488
2025-07-15 11:47:53 -07:00
Liang Wu ce037ec888 feat(config): support built-in tools and referencing tools in code
PiperOrigin-RevId: 783415273
2025-07-15 11:46:04 -07:00
Copybara-Service 391cf3f320 Merge pull request #1669 from zshehov:use-starred-tuple-unpacking-on-gcs-artifact-blob-names-versions
PiperOrigin-RevId: 783413576
2025-07-15 11:43:14 -07:00
Xiang (Sean) Zhou a5d6f1e52e fix: Support project-based gemini model path for BuiltInCodeExecutor and all built-in tools
This is to support model path like :
projects/265104255505/locations/us-central1/publishers/google/models/gemini-2.0-flash-001"

PiperOrigin-RevId: 783413351
2025-07-15 11:41:37 -07:00
Xiang (Sean) Zhou 30d7b37069 refactor: Move list_artifacts from tool_context to callback_context
1. users may want to list_artifacts in callbacks
2. save/load artifacts are already in callback_context

PiperOrigin-RevId: 783399941
2025-07-15 11:08:17 -07:00
Copybara-Service 57043d3e7d Merge pull request #1955 from iwknow:func_fix
PiperOrigin-RevId: 783391431
2025-07-15 10:47:16 -07:00
Zdravko Shehov 4a2589a090 fix: Use starred tuple unpacking on GCS artifact blob names for versions function 2025-07-15 11:47:18 +03:00
Ankur Sharma c25911c912 feat: Implement in memory EvalSetsManager
This version of the EvalSetsManager is intended to support two main behaviors

1) The agent developer wants to bring in their own eval set file, which is usually the case with `adk eval` cli. Once their eval sets are uploaded into this version of the eval sets manager, the EvalSetManager could be handed over to the Eval system for running evals.

2) As a part of AgentEvaluator testing, we expect developers to supply Eval cases in json files. The in-memory version of the EvalSetsManager will help us run those test cases using LocalEvalService.

PiperOrigin-RevId: 783198788
2025-07-14 23:34:35 -07:00
Google Team Member a50419961c fix: Process ListEvents response correctly when getSession is called
When get session is being called on a session with more than 1 page of events (100+), the response of the subsequent listevents calls fails due to missing parsing logic. This change fixes the processing of the listevents responses.

PiperOrigin-RevId: 783166959
2025-07-14 21:21:51 -07:00
Xiang (Sean) Zhou 498ce906dd docs: Update doc string for GcsArtifactService
PiperOrigin-RevId: 783157778
2025-07-14 20:41:16 -07:00
Xuan Yang f52df2bdb6 chore: update ADK Answering Agent to label the discussion with "bot_responded" after responding
PiperOrigin-RevId: 783109120
2025-07-14 17:47:29 -07:00
Yifan Wang 5124252c94 feat: add testing endpoint for builder
PiperOrigin-RevId: 783090278
2025-07-14 16:44:50 -07:00
Xiang (Sean) Zhou dea1ee14ab docs: Fix docstring and update module public name list for generating API references
To fix https://github.com/google/adk-docs/issues/131

PiperOrigin-RevId: 783080206
2025-07-14 16:16:57 -07:00
Frank Liu 94b5aaf0a1 fix: Correct EventAction merging logic and add corresponding tests 2025-07-14 14:54:36 -07:00
Xiang (Sean) Zhou 62a611956f fix: Add instruction in long running tool description to avoid being invoked again by model
PiperOrigin-RevId: 783039620
2025-07-14 14:18:49 -07:00
Holt Skinner a6716a5514 fix: Import A2A well known path from A2A sdk
PiperOrigin-RevId: 783036797
2025-07-14 14:11:01 -07:00
Che Liu a4baa35b84 feat: Add a sample for how to use plugins
PiperOrigin-RevId: 782616659
2025-07-13 10:47:11 -07:00
Ankur Sharma bab3be2cf3 feat: Add support for persisting eval run results
If the EvalRunResultsManager is provided to LocalEvalService, then we want to persist the eval run results using it.

PiperOrigin-RevId: 782196848
2025-07-11 19:29:32 -07:00
Ankur Sharma 33eec34577 feat: Adding implementation of evaluate method in LocalEvalService
Also, delete agent_creator.py file. We added this file by mistake.

PiperOrigin-RevId: 782193593
2025-07-11 19:15:40 -07:00
Liang Wu 48971d43d0 feat(config): support output_key and include_contents in LlmAgentConfig
PiperOrigin-RevId: 782170665
2025-07-11 17:47:42 -07:00
Liang Wu b2ef9a069e feat(config): support sub_agents in BaseAgentConfig
Currently only support path to YAML or code reference to agent instance.

PiperOrigin-RevId: 782157110
2025-07-11 16:57:53 -07:00
Xiang (Sean) Zhou 134ec0d71e fix: Fix the long running function response event merge logic
1) raise explicit error if the response event contains responses against multiple function call events
2) merge all function responses for the corresponding function call event

PiperOrigin-RevId: 782154577
2025-07-11 16:48:59 -07:00
Xiang (Sean) Zhou a8fcc1b8ab fix: Return final task result in task artifact instead of status message
According to a2a protocol task artifact is a different concept from adk artifact.
if a task is completed the final result should be in task artifact.

PiperOrigin-RevId: 782154265
2025-07-11 16:47:28 -07:00
Xiang (Sean) Zhou a57d629bb9 chore: Update the README of a2a sample agent
PiperOrigin-RevId: 782153753
2025-07-11 16:44:58 -07:00
Copybara-Service 202558fd52 Merge pull request #1829 from matino:expose_credential_service
PiperOrigin-RevId: 782150305
2025-07-11 16:34:58 -07:00
seanzhou1023 997b6a964d Merge branch 'main' into expose_credential_service 2025-07-11 15:38:27 -07:00
seanzhou1023 c6c6f34429 Update agent_tool.py 2025-07-11 15:34:07 -07:00
seanzhou1023 7de173ed90 Update test_readonly_context.py 2025-07-11 15:32:37 -07:00
seanzhou1023 080edded76 Update readonly_context.py 2025-07-11 15:31:13 -07:00
Copybara-Service 074b7bebdf Merge pull request #1855 from marcellomaugeri:main
PiperOrigin-RevId: 782121756
2025-07-11 15:04:53 -07:00
Sean Zhou 0a187b4a7d auto format the codes 2025-07-11 14:42:12 -07:00
seanzhou1023 b2a5afaa67 Merge branch 'main' into main 2025-07-11 14:40:31 -07:00
Copybara-Service b43a73bb3f Merge pull request #1602 from DavidSchmidt00:fix_graph
PiperOrigin-RevId: 782090252
2025-07-11 13:27:57 -07:00
Sean Zhou 8acfcfeb5d auto format codes 2025-07-11 13:14:33 -07:00
seanzhou1023 274e375e6f Merge branch 'main' into fix_graph 2025-07-11 12:55:24 -07:00
Copybara-Service 0a65b528e3 Merge pull request #1866 from hironow:hironow/type-fix-for-static
PiperOrigin-RevId: 782040553
2025-07-11 11:02:03 -07:00
Copybara-Service 0a9e67dbca Merge pull request #1875 from bih:patch-1
PiperOrigin-RevId: 781815489
2025-07-10 21:32:19 -07:00
Copybara-Service 4ba0f0a8de Merge pull request #120 from soundTricker:feature/80-sa-auth-for-google-tool
PiperOrigin-RevId: 781815460
2025-07-10 21:30:49 -07:00
Sean Zhou 4c5ef1e235 feat: Add configure service account auth for google_api_tool_set 2025-07-10 21:23:59 -07:00
Ankur Sharma 51be7a899c feat: Add implementation of BaseEvalService that runs evals locally
This change:
- Introduces the LocalEvalService Class.
- Implements only the "perform_inference" method. Evaluate method will be implemented in the next CL.
- Adds required test coverage.

PiperOrigin-RevId: 781781954
2025-07-10 19:25:24 -07:00
seanzhou1023 4845b7bacc Merge branch 'main' into patch-1 2025-07-10 17:53:08 -07:00
Che Liu 162228d208 feat: Integrating Plugin with ADK
This change integrates the plugin system with ADK. PluginManager is attached to the invocation context similar to session/artifact/memory.

It includes integrations with following ADK internal callbacks:

* App callbacks: Integrated in the BaseRunner class, in run_async and run_live
* On Message callbacks: Integrated in the BaseRunner class, triggers on run_async.
* Agent callbacks: Integrated in the BaseAgent class. Leveraging the existing *callback functions
* Model callbacks: Integrating in the base_llm_flow.
* Tool callbacks: Integrated in functions.py, wrapped around the code for agent tool_callbacks

Sample code to use plugins:

```python
# Add plugins to Runner

runner = Runner(
      app_name="my-app",
      agent=root_agent,
      artifact_service=artifact_service,
      session_service=session_service,
      memory_service=memory_service,
      plugins=[
        MySamplePlugin(),
        LoggingPlugin(),
      ],
  )

```

PiperOrigin-RevId: 781746586
2025-07-10 17:28:42 -07:00
Che Liu 16ba91cd01 feat: Implement PluginService for registering and executing plugins
PluginService takes the registration of plugins, and provide the wrapper utilities to execute all plugins.

PiperOrigin-RevId: 781745769
2025-07-10 17:26:05 -07:00
Che Liu 4dce9ef519 feat: ADK Plugin Base Class
Plugin is a collection of callbacks (lifecycle hooks), including callbacks for Agent, Tools, Model and App. It helps developers to add customizations and change behaviors of their agent application easily

This is the first change that introduces only the base interfaces based on the doc.

plugins folder is generated with `create_symlink.sh plugins`

PiperOrigin-RevId: 781745044
2025-07-10 17:25:54 -07:00
seanzhou1023 297f9e3ec9 Merge branch 'main' into patch-1 2025-07-10 17:19:59 -07:00
seanzhou1023 894ef31fc1 Update base_toolset.py 2025-07-10 17:19:42 -07:00
Yanfei Chen 5a721d99a7 test: add the unit test for EnterpriseWebSearchTool
PiperOrigin-RevId: 781743222
2025-07-10 17:16:13 -07:00
Google Team Member 2f655f0c67 fix: Add support for code execution result and skip inline data in anthropic llm
```
blaze run assistant/lamda/bard/scrape/vertex/tools:use_vertex_agent --    --prompt_collection_id=cab_v0p7@3     --agent_name=vertex_1p_agent     --kernel_id=vertex_agent:claude-sonnet-4@20250514 --dynamically_inject_tools=True --add_final_answer_tag=True --example_ids=plot-line-004_0.5_new_1
```
TODO: https://evalhub.corp.google.com/runs/Uf5en14gqmK-R/links
PiperOrigin-RevId: 781724544
2025-07-10 16:17:27 -07:00
Liang Wu 68f34135fe feat(config): add ParallelAgent and SequentialAgent to the loader
PiperOrigin-RevId: 781712004
2025-07-10 15:42:51 -07:00
Liang Wu a313c2c1af feat(config): add configs for ParallelAgent and SequentialAgent
PiperOrigin-RevId: 781704814
2025-07-10 15:24:22 -07:00
Liang Wu d83362725d feat(config): add disallow_transfer_to_parent and disallow_transfer_to_peers to LlmAgentConfig
PiperOrigin-RevId: 781690247
2025-07-10 14:45:01 -07:00
Liang Wu aef54f8eb7 feat(config): support loading from YAML config in CLI
The supported CLIs are: `adk web`, `adk run` and `adk api_server`.

PiperOrigin-RevId: 781666724
2025-07-10 13:47:58 -07:00
Liang Wu ca396a3ab1 feat(config): add APIs for building config agents
Including basic fields in configs, the from_config() methods and the JSON schema. Other fields will be added in following PRs.

PiperOrigin-RevId: 781660569
2025-07-10 13:32:28 -07:00
Xuan Yang fb2415395f chore: create an initial prototype agent to answer Github discussion questions
This agent will post a comment to answer questions or provide more information according to the knowledge base.

PiperOrigin-RevId: 781651937
2025-07-10 13:09:56 -07:00
Liang Wu 2034fbb8f1 chore: remove unused line for Client()
PiperOrigin-RevId: 781617898
2025-07-10 11:41:27 -07:00
Xuan Yang 149c5fe4ff chore: update triage agent to assign the issue to owner after labeling it
PiperOrigin-RevId: 781604031
2025-07-10 11:06:45 -07:00
Bilawal Hameed 0fe8dcabda docs: s/readony_context/readonly_context/g 2025-07-10 18:42:41 +01:00
Google Team Member 10197db0d7 feat: Make InMemoryMemoryService thread-safe
Even though InMemoryMemoryService is intended only for testing and local development, we eliminate a potential source of bugs during prototyping by providing a thread-safe InMemoryMemoryService.

PiperOrigin-RevId: 781554006
2025-07-10 08:55:18 -07:00
Xiang (Sean) Zhou 584c8c6d91 fix: improve partial event handling and streaming aggregation
- Allow run_async to break on partial events instead of raising ValueError
- Generate aggregated streaming content regardless of finish_reason
- Add error_code and error_message to final streaming responses if model response is interrupted.

PiperOrigin-RevId: 781377328
2025-07-09 23:03:33 -07:00
Xuan Yang 444eba58a3 chore: rename session_factory to sql_session for readability
PiperOrigin-RevId: 781359783
2025-07-09 21:59:58 -07:00
Hangfei Lin d792018c09 test: Adds test for streaming + function calls
This commit includes a number of new tests for live streaming with function calls. These tests cover various scenarios:
- Single function calls
- Multiple function calls
- Parallel function calls
- Function calls with errors
- Synchronous function calls
- Simple streaming tools
- Video streaming tools
- Stopping a streaming tool
- Multiple streaming tools simultaneously

The tests use mock models and custom runners to simulate the interaction between the agent, model, and tools. They verify that function calls are correctly generated, executed, and that the expected data is returned.

PiperOrigin-RevId: 781318483
2025-07-09 19:41:27 -07:00
Xiang (Sean) Zhou da34692231 chore: Release 1.6.0
PiperOrigin-RevId: 781272837
2025-07-09 17:16:08 -07:00
Liang Wu d263afd91b feat: add agent.clone() method
This would allow users to easily make a copy of the agents they built without having to add too much boilerplates. This promotes code reuse, modularity and testability of agents.

PiperOrigin-RevId: 781214379
2025-07-09 14:34:58 -07:00
Ariz Chang c85330eae8 fix: Fix view eval case
PiperOrigin-RevId: 781196782
2025-07-09 13:52:54 -07:00
hironow 843b791bb0 chore(fix typo): correct typo AUTHLIB_AVIALABLE → AUTHLIB_AVAILABLE 2025-07-10 03:08:31 +09:00
Genquan Duan adef7b297a feat: Create PR agent for ADK github repo
Automatically generate reasonable PR descriptions.

PiperOrigin-RevId: 781078962
2025-07-09 09:06:28 -07:00
Marcello Maugeri 2ac8c44668 feat(lite_llm): add PDF support
Adds the ability to ingest and process PDF documents in the lite_llm pipeline.
2025-07-09 10:17:29 +02:00
Yifan Wang 18cd3844db chore: update adk web
PiperOrigin-RevId: 780740004
2025-07-08 15:35:59 -07:00
Ariz Chang e545e5a570 feat: Allow user to edit agent files/directories and apply changes without reloading anything
PiperOrigin-RevId: 780710003
2025-07-08 14:14:31 -07:00
Yanfei Chen e33161b4f8 fix: Support project-based gemini model path to use enterprise_web_search_tool
PiperOrigin-RevId: 780692178
2025-07-08 13:29:20 -07:00
Xiang (Sean) Zhou b5d9f8f3e3 chore: Update gemini model to 2.0 for a2a samples
PiperOrigin-RevId: 780657476
2025-07-08 11:56:28 -07:00
Joseph Pagadora 75699fbeca feat: Implement auto rater-based evaluator for responses
PiperOrigin-RevId: 780654576
2025-07-08 11:49:26 -07:00
Xiang (Sean) Zhou 45d60a1906 refactor: extract mcp client creation logic to a separate method
PiperOrigin-RevId: 780609120
2025-07-08 10:04:15 -07:00
Mateusz Czubak d3b500bd68 feat: expose credential service in readonly context 2025-07-08 11:32:50 +02:00
David Schmidt c592a10e94 Merge branch 'main' into fix_graph 2025-07-07 21:58:54 +02:00
Hangfei Lin bf39c00610 test: Add tests for live streaming configs
This PR extends the existing Streaming tests to consider new configurations that have been added, including:

- `output_audio_transcription`
- `input_audio_transcription`
- `realtime_input_config`
- `enable_affective_dialog`
- `proactivity`

These configurations are tested individually and also combined, to cover all the possibilities, increasing the testing coverage and ensuring everything is working as expected.

In addition, the new configuration values are also validated to be sure they are properly initialized.

PiperOrigin-RevId: 780178334
2025-07-07 11:01:46 -07:00
Hangfei Lin 28d0ea876f feat: Add adk project overview and architecture
This explains the high-level architecture and philosophy of the ADK project.
It can also be feed into LLMs for vibe-coding.

PiperOrigin-RevId: 780178125
2025-07-07 11:00:15 -07:00
Hangfei Lin 4ca77bc056 fix: Use inspect.signature() instead of typing.get_type_hints
fix: Use `inspect.signature()` instead of `typing.get_type_hints()` to find the LiveRequestQueue.
Motivation: `typing.get_type_hints()` may raise errors in complex scenarios where type annotation is not available.

Add live_bidi_streaming_tools_agent example to show how to use the live streaming feature.

PiperOrigin-RevId: 780160921
2025-07-07 10:16:13 -07:00
Shangjie Chen dc414cb507 chore: Add docstring to clarify that inmemory service are not suitable for production
environment

Resolves https://github.com/google/adk-python/issues/1569

PiperOrigin-RevId: 780013850
2025-07-07 02:13:56 -07:00
Shangjie Chen a021222077 feat: Add custom_metadata to VertexAiSessionService event handling
PiperOrigin-RevId: 779255526
2025-07-04 12:38:15 -07:00
Copybara-Service 4442167dd5 Merge pull request #1778 from rahulsamant37:fix/event-id-uuid4-collision-v1
PiperOrigin-RevId: 779177848
2025-07-04 07:06:19 -07:00
David Schmidt 438a008cb2 Merge branch 'main' into fix_graph 2025-07-04 14:02:33 +02:00
Rahul Samant e437c7aac6 fix: Replace Event ID generation with UUID4 to prevent SQLite integrity constraint failures
Fixes #719 where duplicate Event IDs caused database constraint violations
during streaming responses. Replaces 8-character random string generation
with UUID4 to ensure globally unique identifiers.

Changes:
- Replace Event.new_id() random string approach with uuid.uuid4()
- Remove unused random and string imports
- Add uuid import

Eliminates SQLite UNIQUE constraint failures in streaming scenarios.
2025-07-03 15:51:01 +00:00
Shangjie Chen 3fa2ea7cb9 fix: Remove duplicate options from adk deploy
Resolves https://github.com/google/adk-python/issues/1739

PiperOrigin-RevId: 778692588
2025-07-02 17:27:45 -07:00
Hangfei Lin 6a39c854e0 chore: update agents.md to include versioning strategy
Adds a description for docstring and comments in the AGENTS.md and adds a section for Versioning that describes how ADK follows Semantic Versioning 2.0.0

PiperOrigin-RevId: 778667398
2025-07-02 15:51:55 -07:00
Copybara-Service b04a5cebb8 Merge pull request #1644 from sindrigunnars:fix-issue-1641-database-session-service
PiperOrigin-RevId: 778630365
2025-07-02 13:51:34 -07:00
Sindri Snær Gunnarsson 362fb3f2b7 fix: scenario where a user can access another users events given the same session id
test: refine test_session_state in test_session_state to catch event leakage

fix: revert app name to my_app for test_session_state test

style: fix pyink style warnings

fix: add app_name to filter as per suggestion from rpedela-recurly
2025-07-02 18:56:08 +00:00
Ankur Sharma 0bd05df471 feat: Add Safety evaluator metric
We add a new metric for evaluating safety of Agent's response to ADK Eval. We delegate the actual implementation to Vertex Gen AI Eval SDK, so using this metric will require GCP project.

As a part of this change, we created (refactored) a simple Facade for vertex gen ai eval sdk.

PiperOrigin-RevId: 778580406
2025-07-02 11:30:31 -07:00
Ankur Sharma 62c4a85917 chore: Update ResponseEvaluator to use newer version of Eval SDK
Also,
- removed functionality that was marked deprecated from the ResponseEvaluator class.
- Added unit test cases

PiperOrigin-RevId: 778568884
2025-07-02 11:00:27 -07:00
Copybara-Service 08869ccc07 Merge pull request #1744 from google:hangfei-patch-3
PiperOrigin-RevId: 778561518
2025-07-02 10:40:03 -07:00
Shangjie Chen df141db60c chore: Add tenacity into project.toml
PiperOrigin-RevId: 778535340
2025-07-02 09:31:19 -07:00
Copybara-Service 9bd539eca9 Merge pull request #1656 from google:fix-transfer-to-agent-parameters-issue
PiperOrigin-RevId: 778334126
2025-07-01 22:03:23 -07:00
Shangjie Chen 3d2f13cecd chore: Update the retry logic of create session polling
This should slightly increase the timeout also reduce the polling frequency.

PiperOrigin-RevId: 778323416
2025-07-01 21:21:57 -07:00
Hangfei Lin d0fdfb8c8e doc: Update README.md 2025-07-01 21:05:43 -07:00
google-labs-jules[bot] 0959b06dbd Fix: Handle unexpected 'parameters' argument in FunctionTool.run_async
The LLM occasionally includes an unexpected 'parameters' argument when calling tools, specifically observed with 'transfer_to_agent'. This change makes FunctionTool.run_async more robust by filtering arguments against the function signature before invocation.

This resolves issue #1637.

Update test_function_tool.py

fix typing

fix: add `from __future__ import annotations`
2025-07-02 00:22:09 +00:00
Liang Wu 9af2394e0a fix: continue the action when grep -L returns exit status 1
`grep -L` returns status 1 when there are modified files that don't have the `from __future__ import annotations` pattern. Previously if this happens, the entire GitHub action by default will stop and exit with status 1. Adding `|| true` will prevent this from happening and continue the workflow.

PiperOrigin-RevId: 778246018
2025-07-01 16:57:56 -07:00
Copybara-Service 873beca088 Merge pull request #1709 from google:my-feature-branch-llmstxt
PiperOrigin-RevId: 778239103
2025-07-01 16:38:48 -07:00
hangfei a903c54bac chore: Add util to build our llms.txt and llms-full.txt files 2025-07-01 16:21:12 -07:00
Ankur Sharma b0d88bf172 feat: BaseEvalService declaration and surrounding data models
Also, adds a metric registry.

PiperOrigin-RevId: 778186012
2025-07-01 14:13:48 -07:00
Shangjie Chen 17d6042995 fix: Make sure each partial event has different timestamp
PiperOrigin-RevId: 778148175
2025-07-01 12:36:33 -07:00
Jianfeng Zeng 43083baddc chore: update adk web
Update minified files for adk-web

PiperOrigin-RevId: 777618082
2025-06-30 10:09:18 -07:00
Hangfei Lin 9b75e24d8c fix: Avoid pydantic.ValidationError when the model stream returns empty final chunk
Bug: When a model emits a stream of tokens, it sometimes emits a final chunk of whitespace or no content. The agent was trying to parse that content into JSON, causing a validation error.

Fix: If a model is expected to return JSON and the last streamed token is empty/whitespace, the agent will no longer try to parse it, and exit gracefully.

New unit tests confirm the scenario and the fix.

PiperOrigin-RevId: 777609415
2025-06-30 09:50:04 -07:00
Hangfei Lin a58cc3d882 chore: Create an example for multi agent live streaming
This example include multi agents:
- Root agent.
- Sub agent for Rolling Dice.
- Sub agent for checking primes.

Added README.md to demonstrate how to use it.

PiperOrigin-RevId: 777599625
2025-06-30 09:21:15 -07:00
Google Team Member 37108be855 docs: Add AGENTS.md to provide relevant project context for the Gemini CLI
Including details on the ADK style guide and how to run specific tools.

PiperOrigin-RevId: 776827602
2025-06-27 21:00:54 -07:00
Xuan Yang b6c7b5b64f chore: refactor the ADK Triaging Agent to make the code easier to read
PiperOrigin-RevId: 776763061
2025-06-27 16:45:38 -07:00
Hangfei Lin ffa9b361db docs: Update CONTRIBUTING.md
Merge https://github.com/google/adk-python/pull/1703

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1703 from google:hangfei-patch-1 251b530e8346ab03a3bfd84c837f14578be37285
PiperOrigin-RevId: 776670181
2025-06-27 12:06:18 -07:00
Google Team Member dc43d518c9 feat: Support protected write in BigQuery execute_sql tool
This change adds a new enum value which the agent builder can pass in the `BigQueryToolConfig` to allow limited writes to the `execute_sql` tool.

PiperOrigin-RevId: 776661744
2025-06-27 11:44:30 -07:00
Xiang (Sean) Zhou e2748b3ed5 chore: Add an a2a agent to demo oauth flow
PiperOrigin-RevId: 776661038
2025-06-27 11:43:05 -07:00
Xiang (Sean) Zhou 379810dd6a chore: Add a human in the loop a2a agent demo sample
PiperOrigin-RevId: 776660876
2025-06-27 11:41:47 -07:00
Xiang (Sean) Zhou 1cf5cf0d0a chore: Add a basic a2a agent demo sample
PiperOrigin-RevId: 776660703
2025-06-27 11:40:26 -07:00
Xiang (Sean) Zhou f0183a9b98 feat: Enable A2A features as experimental
PiperOrigin-RevId: 776656783
2025-06-27 11:28:28 -07:00
Xuan Yang 3f621ae6f2 fix: treat SQLite database update time as UTC for session's last update time
Fixes https://github.com/google/adk-python/issues/1180

We are using `func.now()` to set the `onupdate` time for db, when SQLAlchemy generates the SQL to build the database, it actually translates `func.now()` into `NOW()` or `CURRENT_TIMESTAMP`. The value it returns depends on the database server settings. For example, if the global/default timezone for a db is set to be UTC, the update time will be set to be a UCT time; if the global time zone for a db is set to be a local time zone (e.g. America/Los_Angeles), the update time will be a local time.

Normally, the best practice is to set database server to use UTC. Applications will convert it into different time zones as needed.

For SQLite, there is no way to config the default timezone, it will just treat it as UTC. But because it is a naive datetime (with no timezone info), python will assume it is a local time and then covert it into a UTC, which is why we see the bug (e.g. we create a session at 2025-06-17 12:49:33 local time, but when we read the session, its last update time is 2025-06-17 19:49:33 local time).

The solution is converting the native datatime to be timezone aware before `.timestamp()`.

The change in this CL only affects SQLite database.

PiperOrigin-RevId: 776654443
2025-06-27 11:22:23 -07:00
Keisuke Oohashi 4e765ae2f3 fix: raise ValueError when sessionId and userId are incorrect combination(#1653)
Merge https://github.com/google/adk-python/pull/1655

Fix #1653

When session_id and user_id are incorrect combination on vertex ai session service, it should not return the session.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1655 from soundTricker:fix/1653-invalid-session 7a3dee2fc75602a2685ea922799cc5f5ba666e97
PiperOrigin-RevId: 776648361
2025-06-27 11:06:15 -07:00
Xiang (Sean) Zhou c13c9875cf feat: Add remote a2a agent
PiperOrigin-RevId: 776643130
2025-06-27 10:52:01 -07:00
Xiang (Sean) Zhou 045aea9b15 fix: Support API-Key for MCP Tool authentication
PiperOrigin-RevId: 776641474
2025-06-27 10:47:42 -07:00
Xiang (Sean) Zhou 20279d9a50 fix: Save output in state via output_key only when the event is authored by current agent
PiperOrigin-RevId: 776640671
2025-06-27 10:45:34 -07:00
Xiang (Sean) Zhou 09e487df3c chore: Use context_id as session_id and construct temp user_id from context_id
PiperOrigin-RevId: 776639713
2025-06-27 10:42:15 -07:00
Hangfei Lin 51a559eb2a chore: Adding PR commit check github workflow
This will fail a PR check if multiple commits are added, and will give the user instructions on how to fix the issue.

PiperOrigin-RevId: 776638574
2025-06-27 10:38:36 -07:00
Xiang (Sean) Zhou 1fe9c47cc6 chore: Enhance a2a_agent_executor module to raise error with meaningful error message to ask user upgrade python when python version < 3.10
PiperOrigin-RevId: 776631647
2025-06-27 10:21:26 -07:00
Xiang (Sean) Zhou 31e41bdd06 chore: Enhance part_converter module to only import sys when needed and update the import error message
PiperOrigin-RevId: 776631415
2025-06-27 10:19:50 -07:00
Hangfei Lin 9029b8a66e fix: Lock LangGraph version to <= 0.4.10
New version removed graph.graph we rely on.
temporarily fix the version before we fix the issue.

PiperOrigin-RevId: 776619611
2025-06-27 09:48:20 -07:00
Jack Wotherspoon e153d07593 chore: updating CONTRIBUTING.md with missing extra
Merge https://github.com/google/adk-python/pull/1679

Contributing doc says to do the following:

```sh
uv sync --extra test --extra eval
pytest ./tests/unittests
```

If you follow this the tests will fail:

```sh
tests/unittests/a2a/executor/test_task_result_aggregator.py:27: in <module>
    from a2a.types import Message
E   ModuleNotFoundError: No module named 'a2a'
```

This makes sense since the `a2a` package is not part of ADK's core dep, it is an extra:

https://github.com/google/adk-python/blob/e79651cd86ba3f0c998109f2140f1db2cab78708/pyproject.toml#L79-L83

Thus for a2a tests to pass we must include the extra in the sync command:

```sh
uv sync --extra test --extra eval --extra a2a
pytest ./tests/unittests
```

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1679 from jackwotherspoon:main c1a536780409065db817088a8d5ed5979cca8d8f
PiperOrigin-RevId: 776617515
2025-06-27 09:42:54 -07:00
Xiang (Sean) Zhou e79651cd86 feat: Add A2A endpoints to fast api server when --a2a option is specified (WIP)
PiperOrigin-RevId: 776211580
2025-06-26 11:18:44 -07:00
Yifan Wang 22629a17bd chore: update adk web
Update minified files for adk-web

PiperOrigin-RevId: 776176499
2025-06-26 09:51:02 -07:00
Xiang (Sean) Zhou 5356f20ead chore: Add a2a log utils for formatting a2a reqeust/response logs
PiperOrigin-RevId: 776026554
2025-06-26 01:12:23 -07:00
Xiang (Sean) Zhou ed09cd840f chore: Add enable_a2a option to adk command line
PiperOrigin-RevId: 775991652
2025-06-25 23:05:08 -07:00
Xiang (Sean) Zhou 630f1674cb chore: Add a2a agent executor
PiperOrigin-RevId: 775983689
2025-06-25 22:32:17 -07:00
Xiang (Sean) Zhou 2f55de6ded chore: Add a2a task result aggregator
PiperOrigin-RevId: 775975982
2025-06-25 22:02:28 -07:00
Ray Iramaneerat 77b869f5e3 fix: Update google_search_tool.py to support updated Gemini LIVE model naming
Merge https://github.com/google/adk-python/pull/1518

## Description
Fixes [#1512](https://github.com/google/adk-python/issues/1512) by updating google_search_tool.py to support new Gemini LIVE model naming

## Changes
- Update the model name checking in google_search_tool.py

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1518 from rayira:rayira-patch-1 4c98f88290af6e0a4690652019ca1d7a08689340
PiperOrigin-RevId: 775941268
2025-06-25 19:56:09 -07:00
Ankur Sharma 04de3e197d fix: Adding detailed information on each metric evaluation
Additionally, few other small changes.
*   Updated a test fixture to support the latest eval data schema. Somehow I missed doing that previously.
*   Updated the `evaluation_generator.py` to use `run_async`, instead of `run`.
*   Also, raise an informed error when dependencies required eval are not installed.
*   Also, changed the behavior of AgentEvaluator.evaluate method to run all the evals, instead of failing at the first eval metric failure.

PiperOrigin-RevId: 775919127
2025-06-25 18:32:02 -07:00
SimonWei 3901fade71 fix: converts litellm generate config err
Merge https://github.com/google/adk-python/pull/1509

Fixs: #1302

Previous PR: https://github.com/google/adk-python/pull/1450

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1509 from simonwei97:fix/litellm-gen-config-converting-err 3120887f29a21789f1b4a7c54af3ed35eb5055e3
PiperOrigin-RevId: 775903671
2025-06-25 17:40:48 -07:00
Hangfei Lin 63fda1b7bf Merge branch 'main' into fix_graph 2025-06-25 16:38:20 -07:00
Xiang (Sean) Zhou a71dbdf9e2 chore: Enhance a2a event converter
a. fix function call long running id matching logic
b. fix error code conversion logic
c. add input required and auth required status conversion logic
d. add a2a Task/Message to ADK event converter
f. set task id and context id from input argument

PiperOrigin-RevId: 775860563
2025-06-25 15:32:17 -07:00
Xiang (Sean) Zhou 832a633351 chore: Enhance a2a part converters
a. fix binary data conversion
b. support thoughts, code execution result, executable codes conversion

PiperOrigin-RevId: 775827259
2025-06-25 13:58:49 -07:00
Xuan Yang 738d1a8b84 chore: create an agent to check issue format and content for bugs and feature requests
This agent will pose a comment to ask for more information according to the template if necessary.

PiperOrigin-RevId: 775742256
2025-06-25 10:20:45 -07:00
Hangfei Lin 5306ddad4d chore: Release 1.5.0
PiperOrigin-RevId: 775742049
2025-06-25 10:19:20 -07:00
Xiang (Sean) Zhou a623467299 chore: Enhance a2a context id parsing and construction logic
PiperOrigin-RevId: 775718282
2025-06-25 09:19:16 -07:00
Xiang (Sean) Zhou f54b9b6ad1 chore: Add unit tests for contents.py
PiperOrigin-RevId: 775713101
2025-06-25 09:06:01 -07:00
Google Team Member 6729edd08e refactor: Rename the Google API based bigquery sample agent
This change renames the sample agent based on the Google API based tools to reflect the larger purpose and avoid confusion with the built-in BigQuery tools. In addition, it also renames the root agent in the BigQuery sample agent to "bigquery_agent"

PiperOrigin-RevId: 775655226
2025-06-25 06:05:32 -07:00
Xiang (Sean) Zhou 917a8a19f7 chore: Adapt oauth calendar agent to use authenticated tool
PiperOrigin-RevId: 775433950
2025-06-24 16:46:20 -07:00
Aditya Mulik ef3c745d65 fix: typo fix in sample agent instruction
Merge https://github.com/google/adk-python/pull/1623

fix: minor typo fix in the agent instruction
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1623 from adityamulik:minor_typo_fix 12ea09ae397b5c5e2a9ada48017cd1ca14add72e
PiperOrigin-RevId: 775433411
2025-06-24 16:44:34 -07:00
Shangjie Chen 88a4402d14 chore: Do not send api request when session does not have events
PiperOrigin-RevId: 775423356
2025-06-24 16:15:23 -07:00
Dave Bunten 09f1269bf7 ci(tests): leverage official uv action for install
Merge https://github.com/google/adk-python/pull/1547

This PR replaces the `curl`-based installation of `uv` to instead use the [official GitHub Action from Astral](https://github.com/astral-sh/setup-uv).

Closes #1545

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1547 from d33bs:use-uv-action 05ab7a138cbb5babee30ea81e83f26064e041529
PiperOrigin-RevId: 775402484
2025-06-24 15:18:18 -07:00
Google Team Member 9e473e0abd fix: Include current turn context when include_contents='none'
The intended behavior for include_contents='none' is to:
- Exclude conversation history from previous turns
- Still include current turn context (user input, tool calls/responses within current turn)

https://google.github.io/adk-docs/agents/llm-agents/#managing-context-include_contents

This resolves https://github.com/google/adk-python/issues/1124

PiperOrigin-RevId: 775400036
2025-06-24 15:11:33 -07:00
Xiang (Sean) Zhou acbdca0d84 fix: Make raw_auth_credential and exchanged_auth_credential optional given their default value is None
PiperOrigin-RevId: 775397286
2025-06-24 15:03:54 -07:00
Google Team Member ed7a21e189 chore: Update google-genai package and related deps to latest
PiperOrigin-RevId: 775394737
2025-06-24 14:57:56 -07:00
Liang Wu a1e1441115 fix: update contributing links
Merge https://github.com/google/adk-python/pull/1528

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1528 from google:doc ec8325e126aba7257de73ab26d8d3a30064859b4
PiperOrigin-RevId: 775383121
2025-06-24 14:27:25 -07:00
Genquan Duan f33e0903b2 feat: Add ADK examples for litellm with add_function_to_prompt
Add examples for for https://github.com/google/adk-python/issues/1273

PiperOrigin-RevId: 775352677
2025-06-24 13:08:44 -07:00
Shangjie Chen abc89d2c81 feat: Add implementation of VertexAiMemoryBankService and support in FastAPI endpoint
PiperOrigin-RevId: 775327151
2025-06-24 11:57:03 -07:00
Google Team Member 00cc8cd643 feat: Add Vertex Express mode compatibility for VertexAiSessionService
PiperOrigin-RevId: 775317848
2025-06-24 11:33:37 -07:00
Joseph Pagadora 9597a446fd feat: Add rouge_score library to ADK eval dependencies, and implement RougeEvaluator that is computes ROUGE-1 for "response_match_score" metric
PiperOrigin-RevId: 774949712
2025-06-23 15:31:03 -07:00
Joseph Pagadora fa025d7559 feat: Add a new option eval_storage_uri in adk web & adk eval to specify GCS bucket to store eval data
PiperOrigin-RevId: 774947795
2025-06-23 15:24:57 -07:00
Xiang (Sean) Zhou 120cbabeb2 refactor: Rename long util function name in runner.py and move it to functions.py
PiperOrigin-RevId: 774880990
2025-06-23 12:24:10 -07:00
Xiang (Sean) Zhou 29cd183aa1 chore: Add credential service backed by session state
PiperOrigin-RevId: 774878336
2025-06-23 12:16:03 -07:00
David Schmidt a794728a2f fix(agent_graph): Prevent duplicate edges in agent graph 2025-06-23 19:54:36 +02:00
avidelatm bd67e8480f fix: make LiteLLM streaming truly asynchronous
Merge https://github.com/google/adk-python/pull/1451

## Description
Fixes https://github.com/google/adk-python/issues/1306 by using `async for` with `await self.llm_client.acompletion()` instead of synchronous `for` loop.

## Changes
- Updated test mocks to properly handle async streaming by creating an async generator
- Ensured proper parameter handling to avoid duplicate stream parameter

## Testing Plan
- All unit tests now pass with the async streaming implementation
- Verified with `pytest tests/unittests/models/test_litellm.py` that all streaming tests pass
- Manually tested with a sample agent using LiteLLM to confirm streaming works properly

# Test Evidence:
https://youtu.be/hSp3otI79DM

Let me know if you need anything else from me for this PR

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1451 from avidelatm:fix/litellm-async-streaming d35b9dc90b2fd6fad44c3869de0fda2514e50055
PiperOrigin-RevId: 774835130
2025-06-23 10:30:12 -07:00
Keisuke Oohashi ea69c9093a feat: add usage span attributes to telemetry (#356)
Merge https://github.com/google/adk-python/pull/1079

Fixes part of #356

Add usage attributes to span.
Note: Since the handling of GenAI event bodies in OpenTelemetry has not yet been determined, I have temporarily added only attributes related to usage.
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1079 from soundTricker:feature/356-support-more-opentelemetry-semantics 99a9d0352b4bca165baa645440e39ce7199f072b
PiperOrigin-RevId: 774834279
2025-06-23 10:28:14 -07:00
Shangjie Chen f033e405c1 chore: Clarify the behavior of Event.invocation_id
PiperOrigin-RevId: 774827874
2025-06-23 10:12:16 -07:00
bck-ob-gh 3b1d9a8a3e fix: Use starred tuple unpacking on GCS artifact blob names
Merges https://github.com/google/adk-python/pull/1471

Fixes google#1436

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1471 from bck-ob-gh:main 4c4f2b66ab1e6fde8b1a9d2b914dcb24040db144
PiperOrigin-RevId: 774809270
2025-06-23 09:24:31 -07:00
Xiang (Sean) Zhou 7c670f638b chore: Send user message to the agent that returned a corresponding function call if user message is a function response
PiperOrigin-RevId: 773895971
2025-06-20 17:15:29 -07:00
Xiang (Sean) Zhou fb13963ded chore: Add request converter to convert a2a request to ADK request
PiperOrigin-RevId: 773894462
2025-06-20 17:09:05 -07:00
Shangjie Chen 2fd8feb65d chore: Support allow_origins in cloud_run deployment
Also reorganize the fast_api_common_options. This resolves https://github.com/google/adk-python/issues/1444.

PiperOrigin-RevId: 773890111
2025-06-20 16:54:08 -07:00
Shangjie Chen 8677d5c8dc chore: bump version number to 1.4.2
PiperOrigin-RevId: 773867075
2025-06-20 15:41:50 -07:00
Shangjie Chen 4d72d31b13 fix: Add type checking to handle different response type of genai API client
Fixes https://github.com/google/adk-python/issues/1514

PiperOrigin-RevId: 773838035
2025-06-20 14:12:55 -07:00
Xiang (Sean) Zhou 742478fdb7 chore: Add event converters to convert adk event to a2a event (WIP)
PiperOrigin-RevId: 773795427
2025-06-20 12:14:12 -07:00
Xiang (Sean) Zhou ffcba70686 chore: skip mcp and a2a tests for python 3.9
PiperOrigin-RevId: 773785385
2025-06-20 11:46:31 -07:00
Google Team Member 2f716ada7f fix: Allow more credentials types for BigQuery tools
This change accepts the `google.auth.credentials.Credentials` type for `BigQueryCredentialsConfig`, so any subclass of that, including `google.oauth2.credentials.Credentials` would work to integrate with BigQuery service. This opens up a whole range of possibilities, such as using service account credentials to deploy an agent using these tools.

PiperOrigin-RevId: 773190440
2025-06-18 22:02:09 -07:00
Shangjie Chen 17beb32880 chore: Bump version number and update changelog for 1.4.1 release
PiperOrigin-RevId: 773148349
2025-06-18 19:08:43 -07:00
Xiang (Sean) Zhou 7f8dc8927a chore: fix the mcp_sse_agent
PiperOrigin-RevId: 773140021
2025-06-18 18:32:06 -07:00
Xiang (Sean) Zhou 9a1115c504 chore: Remove service account support
given it was not correctly supported.

PiperOrigin-RevId: 773137317
2025-06-18 18:19:05 -07:00
Xiang (Sean) Zhou 913d771d6d chore: Raise meaningful errors when importing a2a modules for python 3.9
PiperOrigin-RevId: 773128206
2025-06-18 17:43:11 -07:00
Hangfei Lin 58e07cae83 fix: Fix tracing for live
the original code passed in wrong args. now fixed.
tested locally.

PiperOrigin-RevId: 773108589
2025-06-18 16:35:16 -07:00
Xiang (Sean) Zhou 157d9be88d feat: Enable MCP Tool Auth (Experimental)
PiperOrigin-RevId: 773002759
2025-06-18 11:44:02 -07:00
Xiang (Sean) Zhou 18a541c8fa chore: Ignore mcp_tool ut tests for python 3.9 given mcp sdk only supports 3.10+
PiperOrigin-RevId: 772999037
2025-06-18 11:34:10 -07:00
Xiang (Sean) Zhou dcea7767c6 feat: Add Authenticated Tool (Experimental)
PiperOrigin-RevId: 772992074
2025-06-18 11:17:01 -07:00
Xiang (Sean) Zhou 2c739ab581 chore: Add Credential Manager for managing tools credential (Experimental)
PiperOrigin-RevId: 772986051
2025-06-18 11:01:38 -07:00
Xiang (Sean) Zhou 9a207cb832 refactor: Refactor oauth2_credential_exchanger to exchanger and refresher separately
PiperOrigin-RevId: 772979993
2025-06-18 10:46:39 -07:00
Xiang (Sean) Zhou a17ebe6ebd chore: Add a credential refresher registry
PiperOrigin-RevId: 772747251
2025-06-17 21:12:30 -07:00
Xiang (Sean) Zhou 55201cb6a1 chore: Add credential exchanger registry (Experimentals)
PiperOrigin-RevId: 772713412
2025-06-17 19:09:21 -07:00
Xiang (Sean) Zhou 0a9625317a refactor: Adapt service account credential exchanger to base credential exchanger interface
PiperOrigin-RevId: 772710438
2025-06-17 18:55:46 -07:00
Google Team Member f9fa7841df chore: add google-adk/{version} to bigquery user agent
PiperOrigin-RevId: 772703504
2025-06-17 18:31:34 -07:00
Xiang (Sean) Zhou 5f89a469ec chore: Add credential service to runner and invocation context
PiperOrigin-RevId: 772697298
2025-06-17 18:08:43 -07:00
Google Team Member 6d174eba30 fix: Set explicit project in the BigQuery client
This change sets an explicit project id in the BigQuery client from the conversation context. Without this the client was trying to set a project from the environment's application default credentials and running into issues where application default credentials is not available.

PiperOrigin-RevId: 772695883
2025-06-17 18:04:41 -07:00
Xiang (Sean) Zhou c04adaade1 chore: Add in memory credential service (Experimental)
PiperOrigin-RevId: 772534962
2025-06-17 10:45:49 -07:00
Google Team Member 1ae176ad2f fix: update conversion between Celsius and Fahrenheit
#non-breaking
The correct conversion from 25 degrees Celsius is 77 degrees Fahrenheit. The previous value of 41 was wrong.

PiperOrigin-RevId: 772528757
2025-06-17 10:31:36 -07:00
SimonWei 694b71256c fix: agent generate config error (#1450) 2025-06-17 08:48:00 -07:00
Xiang (Sean) Zhou e1812797ad chore: Add A2A Part converter (WIP)
PiperOrigin-RevId: 772282116
2025-06-16 20:35:09 -07:00
Xiang (Sean) Zhou c755cf23c5 chore: Ignore a2a ut tests for python 3.9 given a2a-sdk only supports 3.10+
PiperOrigin-RevId: 772270172
2025-06-16 19:53:46 -07:00
Xiang (Sean) Zhou 94caccc148 refactor: Extract util method from OAuth2 credential fetcher for reuse
Context: we'd like to separate fetcher into exchanger and refresher later. This cl help to extract the common utility that will be used by both exchanger and refresher.

PiperOrigin-RevId: 772257995
2025-06-16 19:03:16 -07:00
Xiang (Sean) Zhou 476805d5b9 chore: Add a2a extra dependency for github UT workflows
PiperOrigin-RevId: 772251530
2025-06-16 18:34:18 -07:00
Xiang (Sean) Zhou e2a81365ec chore: Add a base credential refresher interface
PiperOrigin-RevId: 772248299
2025-06-16 18:21:35 -07:00
Xiang (Sean) Zhou 28dfcd2512 chore: Add experimental decorator to Oauth2 credential fethcer
PiperOrigin-RevId: 772236406
2025-06-16 17:36:48 -07:00
Xiang (Sean) Zhou a6b1baa61b chore: Add base credential exchanger (Experimental)
PiperOrigin-RevId: 772227201
2025-06-16 17:05:20 -07:00
Liang Wu e384fa4ad7 chore: fix previously skipped isort issue
PiperOrigin-RevId: 772224853
2025-06-16 16:57:46 -07:00
Google Team Member aafa80bd85 fix: stream in litellm + adk and add corresponding integration tests
Fixes https://github.com/google/adk-python/issues/1368

PiperOrigin-RevId: 772218385
2025-06-16 16:37:14 -07:00
Xiang (Sean) Zhou 4bda245171 chore: fix oauth_calendar_agent example
PiperOrigin-RevId: 772214855
2025-06-16 16:26:59 -07:00
Xiang (Sean) Zhou 31b81a342d chore: Update streamable http mcp example agent
PiperOrigin-RevId: 772213323
2025-06-16 16:22:09 -07:00
Google Team Member fef8778429 fix: liteLLM test failures
Fix liteLLM test failures for function call responses.

PiperOrigin-RevId: 772212629
2025-06-16 16:20:23 -07:00
Hangfei Lin fe1d5aa439 feat: add enable_affective_dialog and proactivity to run_config and llm_request
PiperOrigin-RevId: 772175206
2025-06-16 14:35:47 -07:00
Hangfei Lin 8201f9aebd chore: Added live-streaming sample agent
Also added a readme.

PiperOrigin-RevId: 772120698
2025-06-16 12:07:09 -07:00
Xuan Yang 1cfc555e70 ADK changes
PiperOrigin-RevId: 772078053
2025-06-16 10:20:23 -07:00
SimonWei badbcbd7a4 fix: agent generate config err (#1305)
* fix: agent generate config err

* fix: resovle comment

---------

Co-authored-by: Hangfei Lin <hangfei@google.com>
Co-authored-by: genquan9 <49327371+genquan9@users.noreply.github.com>
2025-06-16 09:40:41 -07:00
Google Team Member 675faefc67 feat: Allow data_store_specs pass into ADK VAIS built-in tool
PiperOrigin-RevId: 772039465
2025-06-16 08:35:30 -07:00
Xiang (Sean) Zhou a4d432a9e6 chore: Add Service Account Credential Exchanger (Experimental)
PiperOrigin-RevId: 771507089
2025-06-14 13:39:50 -07:00
Xiang (Sean) Zhou d1bda9d946 chore: Allow working_in_progress feature for unittests
PiperOrigin-RevId: 771500394
2025-06-14 12:56:02 -07:00
Xiang (Sean) Zhou a19d617ed8 chore: Add experimental decorator to BigQuery tools
PiperOrigin-RevId: 771359886
2025-06-13 23:32:33 -07:00
Xiang (Sean) Zhou 8ebf229c47 chore: Add base credential service interface (WIP)
PiperOrigin-RevId: 771358480
2025-06-13 23:24:30 -07:00
Xiang (Sean) Zhou b51a1f45fd chore: support @working_in_progress and @expremental without calling parameters
PiperOrigin-RevId: 771357728
2025-06-13 23:18:43 -07:00
Xiang (Sean) Zhou 8932106246 chore: Raise error when using features decorated by working_in_progress decorator
set environment variable ADK_ALLOW_WIP_FEATURES=true can bypass it.
working_in_progress features are not working. ADK users are not supposed to set this environment variable.

PiperOrigin-RevId: 771333335
2025-06-13 21:17:31 -07:00
Google Team Member 233fd20243 feat: Add import session API in the fast API
PiperOrigin-RevId: 771279971
2025-06-13 17:26:08 -07:00
Xiang (Sean) Zhou d129fd636b chore: Update the comments of MCPTool
PiperOrigin-RevId: 771234262
2025-06-13 14:53:41 -07:00
Selcuk Gun 131957c531 chore: Triaging agent improvements & github workflow
* modified list issues to only return unlabelled open issues
* added github workflow to run on schedule and issue open/reopen
* interactive/workflow modes
* readme document

PiperOrigin-RevId: 771152306
2025-06-13 10:56:32 -07:00
Google Team Member 8e285874da feat: Add integration tests for litellm with and without turn on add_function_to_prompt
Add experiments for https://github.com/google/adk-python/issues/1273

PiperOrigin-RevId: 771145715
2025-06-13 10:37:09 -07:00
Google Team Member cb55970969 refactor: Simplify agent_tool.py
PiperOrigin-RevId: 771135917
2025-06-13 10:10:31 -07:00
Xiang (Sean) Zhou 40b15ad278 refactor: enhance mcp tool session management
1. remove unnecessary cached session instance in mcp toolset
2. move session reinitialization logic from mcp tool and mcp toolset to mcp session manager
3. add lock for the code block of session creation to avoid race conditions

PiperOrigin-RevId: 770949529
2025-06-12 23:11:06 -07:00
Xiang (Sean) Zhou dbdeb49090 chore: Add a2a-sdk to pyproject.toml
PiperOrigin-RevId: 770908052
2025-06-12 20:30:14 -07:00
Xiang (Sean) Zhou 177980106b feat: Support refresh access token automatically for rest_api_tool
1. let auth_handler.py to utilize the oauth2 credential fetcher to exchange token
2. restructure tool_auth_handler.py to support refresh token

PiperOrigin-RevId: 770901469
2025-06-12 20:07:43 -07:00
Xiang (Sean) Zhou c5b063f1ff feat: Add an Oauth2 credential fetcher to exchange and refresh oauth2 token
PiperOrigin-RevId: 770892243
2025-06-12 19:40:16 -07:00
Google Team Member 313f1b0913 chore: Add all missing direct deps to pyproject.toml
PiperOrigin-RevId: 770887371
2025-06-12 19:21:13 -07:00
Google Team Member b2fc7740b3 fix: Support project-based gemini model path to use google_search_tool
PiperOrigin-RevId: 770858301
2025-06-12 17:30:45 -07:00
Xiang (Sean) Zhou 29e4ca9152 chore: Add empty a2a package
PiperOrigin-RevId: 770851838
2025-06-12 17:07:05 -07:00
Xiang (Sean) Zhou 4ccda99e8e fix: Merge custom http options with adk specific http options in model api request
PiperOrigin-RevId: 770836112
2025-06-12 16:20:31 -07:00
GenkiNoguchi d22920bd7f feat: support realtime input config
Merge https://github.com/google/adk-python/pull/981

issue: https://github.com/google/adk-python/issues/982

This pull request introduces a new configuration option, `realtime_input_config`, to the `RunConfig` class.

**Reason for this change:**

Currently, there is no direct way to configure real-time audio input behaviors, such as Voice Activity Detection (VAD), for live agents through the `RunConfig`. The Gemini API documentation (specifically [Configure automatic VAD](https://ai.google.dev/gemini-api/docs/live#configure-automatic-vad)) outlines parameters for VAD that users may want to customize.

This change enables users to pass these real-time input configurations, providing more granular control over the audio input for live agents.

**Changes made:**

- Added a new optional field `realtime_input_config: Optional[types.RealtimeInputConfig]` to the `RunConfig` class.
- The docstring for `realtime_input_config` has been added to explain its purpose.

**Example Usage (Conceptual):**

While the specific structure of `types.RealtimeInputConfig` would define the exact parameters, a user might configure it like this:

```python
# (Assuming types.RealtimeInputConfig and types.VadConfig are defined elsewhere)
# import your_project.types as types

run_config = RunConfig(
    # ... other configurations ...
    realtime_input_config=types.RealtimeInputConfig(
        automatic_activity_detection =types.AutomaticActivityDetection(
            # VAD specific parameters like sensitivity, endpoint_duration_millis etc.
            # based on https://ai.google.dev/gemini-api/docs/live#configure-automatic-vad
        )
        # Potentially other real-time input settings could be added here in the future
    )
)
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/981 from ammmr:patch-add-realtime-input-config b2e17fbf5742d264029ad49bf632422b5c5b1e0a
PiperOrigin-RevId: 770797640
2025-06-12 14:33:05 -07:00
Google Team Member 2ff9b1f639 test: Add unit tests for execute_sql tool
This change introduces unit tests in which the behavior of the tool is asserted for various query types in various write modes through a mocked BigQuery client.

PiperOrigin-RevId: 770653117
2025-06-12 07:52:41 -07:00
Google Team Member 0a5cf45a75 feat: Implement GcsEvalSetResultsManager to handle storage of eval sets on GCS, and refactor eval set results manager
Eval results will be stored as json files under `gs://{bucket_name}/{app_name}/evals/eval_history/`

PiperOrigin-RevId: 770499242
2025-06-11 23:41:54 -07:00
Google Team Member 1551bd4f4d feat: Re-factor some eval sets manager logic, and implement GcsEvalSetsManager to handle storage of eval sets on GCS
Eval sets will be stored as json files under `gs://{bucket_name}/{app_name}/evals/eval_sets/`

PiperOrigin-RevId: 770487129
2025-06-11 23:02:53 -07:00
Koichi Shiraishi bbceb4f2e8 fix: remove unnecessary double quote on Claude docstring
Merge https://github.com/google/adk-python/pull/1266

Subject says it all.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1266 from zchee:fix-docstring b5ceacc82b45398e9421c0f9a1a4d6352d12e21a
PiperOrigin-RevId: 770478088
2025-06-11 22:33:07 -07:00
Wei Sun (Jack) b08bdbcd7f chore: Fixes the sample of example_tool
The `Example` objects should be strong typed.

PiperOrigin-RevId: 770476132
2025-06-11 22:27:25 -07:00
Shangjie Chen fc65873d7c chore: Set agent_engine_id in the service constructor, also use the agent_engine_id field instead of overriding app_name in FastAPI endpoint
PiperOrigin-RevId: 770427903
2025-06-11 19:46:25 -07:00
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
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
Selcuk Gun 3b1f2ae9bf fix: Fix broken agent graphs
Fixes #973, #1170

PiperOrigin-RevId: 767921051
2025-06-05 22:46:39 -07:00
Google Team Member 6ed635190c feat: show the used metric in evaluation history
PiperOrigin-RevId: 767843229
2025-06-05 18:08:07 -07:00
Google Team Member d1b058707e feat: use threshold from the eval config dialog to run eval
PiperOrigin-RevId: 767829097
2025-06-05 17:20:20 -07:00
Google Team Member 54367dcc56 feat: support to customize timeout for mcpstdio connections
Fixes https://github.com/google/adk-python/issues/643

PiperOrigin-RevId: 767788472
2025-06-05 15:27:23 -07:00
Google Team Member fe1de7b103 feat: Add url_context_tool
PiperOrigin-RevId: 767747328
2025-06-05 13:44:35 -07:00
Xiang (Sean) Zhou 078ac842d7 chore: replace print with logger.info
PiperOrigin-RevId: 767732597
2025-06-05 13:09:07 -07:00
Wei Sun (Jack) 4b1c218cbe fix: Prevent agent_graph.py throwing when workflow agent is root agent
Partial fix for https://github.com/google/adk-python/issues/1170

TODOs:
- UI rendering still has issue to match the event with the correct agent.
- graph building needs further fix when there is a workflow agent in the tree.
PiperOrigin-RevId: 767711701
2025-06-05 12:15:14 -07:00
Liang Wu 7dbd8c6a5b chore: add file contents check in a GitHub action
PiperOrigin-RevId: 767710673
2025-06-05 12:12:56 -07:00
Copybara-Service b7ebb6947f Merge pull request #1171 from google:hangfei-patch-3
PiperOrigin-RevId: 767701441
2025-06-05 11:49:25 -07:00
Xiang (Sean) Zhou 4269cac953 chore: change import path to import directly from module instead of package
PiperOrigin-RevId: 767697759
2025-06-05 11:40:24 -07:00
Hangfei Lin 19dbe244e0 Merge branch 'main' into hangfei-patch-3 2025-06-05 11:32:08 -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
Hangfei Lin 1d8d1e0a4e Update agent.py 2025-06-04 21:38:49 -07:00
Hangfei Lin 0d232588e6 chore: Update agent.py 2025-06-04 21:34:33 -07:00
Hangfei Lin cf689fd528 chore: Create agent.py
add a ADK triaging agent to help triaging issues.


This is an MVP. We can iterate further.
2025-06-04 21:25:02 -07:00
Selcuk Gun 78bfce4d89 chore: bump version number to 1.2.1
PiperOrigin-RevId: 767338013
2025-06-04 16:51:05 -07:00
Google Team Member 068df04bce fix: import deprecated from typing_extensions
Fixes https://github.com/google/adk-python/issues/1125

and add it to pyproject.toml. This was added to typing_extensions in 4.5.0. I followed versioning guidance from https://typing-extensions.readthedocs.io/en/latest/index.html#versioning-and-backwards-compatibility.

PiperOrigin-RevId: 767317467
2025-06-04 15:51:43 -07:00
Google Team Member 86e15cab89 chore: Make ArtifactService transparent to AgentTools
PiperOrigin-RevId: 767225493
2025-06-04 11:35:49 -07:00
Selcuk Gun 92e7a4a488 chore: bump version number to 1.2.0
PiperOrigin-RevId: 767218068
2025-06-04 11:18:30 -07:00
Shangjie Chen c6e1e82efb chore: Minor improvement to session service
- Add missing override.
- Add warning to failed actions.
- Remove unused import.
- Remove unused fields.
- Add type checking.

PiperOrigin-RevId: 767209697
2025-06-04 10:58:35 -07:00
Google Team Member 54ed031d1a feat: support None as return type, such as def func() -> None:
None:

PiperOrigin-RevId: 767204150
2025-06-04 10:43:35 -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
Copybara-Service 552e42fa06 Merge pull request #1154 from google:hangfei-patch-2
PiperOrigin-RevId: 767197024
2025-06-04 10:25:07 -07:00
Hangfei Lin d052e8f13a chore: Update agent.py 2025-06-04 09:29:33 -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
Google Team Member 98a635afee feat: set the max width and height of view image dialog to be 90%
PiperOrigin-RevId: 766973033
2025-06-03 22:17:26 -07:00
Hangfei Lin e21ea161f5 chore: Update agent.py
Merge https://github.com/google/adk-python/pull/1136

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1136 from google:hangfei-patch-1 63ff81eb2f152cf74a8a610562999101a6362ef8
PiperOrigin-RevId: 766913586
2025-06-03 18:59:23 -07:00
Google Team Member 0127c3f9d8 chore: Minor improvement to session service
- Add missing override.
- Add warning to failed actions.
- Remove unused import.
- Remove unused fields.
- Add type checking.

PiperOrigin-RevId: 766913196
2025-06-03 18:57:53 -07:00
Hangfei Lin 0724a83aa9 ADK changes
PiperOrigin-RevId: 766902914
2025-06-03 18:20:10 -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
Selcuk Gun 32c5ffa8ca chore:Restore errors path in copybara
PiperOrigin-RevId: 766888018
2025-06-03 17:30:10 -07:00
Liang Wu 433c423d35 chore: include contributing/ folder in autoformat.sh
Also formatted the files in that folder in this same commit.

PiperOrigin-RevId: 766885306
2025-06-03 17:20:52 -07:00
Shangjie Chen e99f87de73 chore: Minor improvement to session service
- Add missing override.
- Add warning to failed actions.
- Remove unused import.
- Remove unused fields.
- Add type checking.

PiperOrigin-RevId: 766882634
2025-06-03 17:13:33 -07:00
Hangfei Lin 349a414120 chore:ADK: add section comment
PiperOrigin-RevId: 766877814
2025-06-03 16:57:49 -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
Liang Wu bf12a4ab48 chore: add GitHub Action to check imports' order
PiperOrigin-RevId: 766804783
2025-06-03 16:56:20 -07:00
Liang Wu ed2aef9120 chore: fix Pyink GitHub Action to check on all changed .py files
Three fixes:
1. used "fetch-depth: 2" to ensure that files in all commits in the PR are checked
2. triggered by all changed ".py" files in the repo
3. merged the "check modified files" and "run Pyink" steps because $GITHUB_ENV cannot handle multi-line env vars without special treatment

PiperOrigin-RevId: 766793736
2025-06-03 16:56:11 -07:00
Yifan Wang 934af25343 chore: update adk web to include latest changes
PiperOrigin-RevId: 766772232
2025-06-03 16:56:03 -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
Selcuk Gun 57d99aa789 Enable release-please workflow
PiperOrigin-RevId: 766717222
2025-06-03 16:55:42 -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 44f507895e chore: Make return_str more accurate in_build_function_declaration_log
PiperOrigin-RevId: 766526064
2025-06-03 16:55:25 -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
Selcuk Gun eb2b9ef88f chore: Fix formatting
PiperOrigin-RevId: 766407362
2025-06-03 16:55:08 -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
Wei Sun (Jack) b1898890ca chore: format .gitignore.
PiperOrigin-RevId: 766390804
2025-06-03 16:54:49 -07:00
Ankur Sharma a7575e078a feat: Added implementation for get_eval_case, update_eval_case and delete_eval_case for the local eval sets manager.
PiperOrigin-RevId: 766383391
2025-06-03 16:54:37 -07:00
Bhadraksh Bhargava da4bc0efc0 feat: New Agent Visualization
Merge https://github.com/google/adk-python/pull/482

Added new agent visualzation that accounts for the internal architecture of the Workflow Agents and shows them inside of a cluster with a label as the name of the Workflow Agent. The sub agents are conencted as per the Workflow Agents' working and architecture

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/482 from BhadrakshB:new_agent_visualization 994a9e28039b62d9d1d99fc73374a3fa97807aca
PiperOrigin-RevId: 766345311
2025-06-02 14:33:02 -07:00
Google Team Member 273594215e Add tooltip to the export session button.
PiperOrigin-RevId: 766334704
2025-06-02 14:05:25 -07:00
Xiang (Sean) Zhou 821f751b5a chore: add agent for testing Notion MCP server
PiperOrigin-RevId: 766325293
2025-06-02 13:41:56 -07:00
Hangfei Lin 94c0aca685 ADK: Rename the root agent in the example to match the example name.
This makes logs a bit less confusing.

PiperOrigin-RevId: 766312673
2025-06-02 13:10:42 -07:00
Google Team Member 1db601c4bd Update pending event dialog style. Mock is not ready yet.
PiperOrigin-RevId: 766301924
2025-06-02 12:40:25 -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
Google Team Member f7cb66620b fix: Use inspect.cleandoc on function docstrings in generate_function_declaration.
This creates proper indent of the doc.

PiperOrigin-RevId: 766285907
2025-06-02 11:57:25 -07:00
Google Team Member 11b504c808 chore: Add functions to convert between storage and event classes
PiperOrigin-RevId: 766280876
2025-06-02 11:44:46 -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
MikeTako bd588bce50 docs: Fix typo in envs.py
Copybara Merge: https://github.com/google/adk-python/pull/1095

--
3f3bbf1967ee58aa0d321d8b670b1a9736f62b87 by MikeTako <kaito@hiru-t.com>:

docs: Fix typo in envs.py
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1095 from miketako3:patch-1 3f3bbf1967ee58aa0d321d8b670b1a9736f62b87
PiperOrigin-RevId: 766257832
2025-06-02 10:50:38 -07:00
Hangfei Lin f1803312c6 Copybara import of the project:
--
618add7d297cbe26f26f45aa01b39c3d086a13e8 by Hangfei Lin <hangfei@google.com>:

doc: Create readme.md
--
5ba85d653cac11b2858ee5d53d175c1c16d933ec by Hangfei Lin <hangfei@google.com>:

doc: Update CONTRIBUTING.md
--
02606a34babba6a660886a073332979fb2b12fc3 by Wei Sun (Jack) <weisun@google.com>:

Rename readme.md to README.md
--
08a38bd5727bf554f6fb043c73623d367e9b138e by Hangfei Lin <hangfei@google.com>:

Update README.md
--
92e7ee6d498dfce35f1c6df44c1ec0f86ae5d513 by Wei Sun (Jack) <weisun@google.com>:

Update README.md
--
69c3a44e6946b3541746ded43dae8a70d47d538f by Wei Sun (Jack) <weisun@google.com>:

Update README.md
--
9de40783990ae9935463b37225c186e91c93025d by Wei Sun (Jack) <weisun@google.com>:

Update README.md
--
0f8a011ddc5b22ba8361ce7b34413a34cfcf15ba by Wei Sun (Jack) <weisun@google.com>:

Update README.md

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1058 from google:hangfei-patch-2 81eacedef69468fa554312a187880ccf4c30c559
PiperOrigin-RevId: 766234622
2025-06-02 09:57:35 -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
Yongsul Kim 5c6001d90f fix(sample): Correct text artifact saving in artifact_save_text sample
Copybara import of the project:
--
95292471f6dba29b55a17239670cdc6cc14619b5 by Yongsul Kim <ystory84@gmail.com>:

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/936 from ystory:fix/artifact-sample-save 7b0babc53266afadb8421ccafa0f3de092eeeae5
PiperOrigin-RevId: 766220649
2025-06-02 09:19:19 -07:00
Yeesian Ng 2409c3ef19 feat: Add agent engine as a deployment option to the ADK CLI
PiperOrigin-RevId: 766199746
2025-06-02 08:18:39 -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
Garrett Bischof 62d7bf58bb docs: change eval_dataset to eval_dataset_file_path_or_dir
Copybara import of the project:

--
6596c477c7138df79d77e67181fd5979fd1a72e3 by Garrett Bischof <bischofgarrett@gmail.com>:

docs: change eval_dataset to eval_dataset_file_path_or_dir
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/397 from gwbischof:eval_dataset e8a0d0911c21ac76dab83e8520aaebc38d24adf5
PiperOrigin-RevId: 765638775
2025-05-31 13:06:57 -07:00
Edward Funnekotter 7fdc6b4417 fix: ensure function description is copied when ignoring parameters
Copybara import of the project:

--
8540f266ebc0210749834d73ee61f01783ae3526 by Edward Funnekotter (aider) <efunneko@gmail.com>:

fix: ensure function description is copied when ignoring parameters

--
b9fb5916593fe552a7b02bff379ebf2f3b3cf69f by Edward Funnekotter <efunneko@gmail.com>:

Fix annoying comments

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/552 from efunneko:efunneko/122/copy_doc_string_for_tool d9bc24343d9f32376b5647c4309d6cb172833534
PiperOrigin-RevId: 765470363
2025-05-30 22:35:14 -07:00
Xiang (Sean) Zhou 2623c71086 fix: add adk icon for UI
PiperOrigin-RevId: 765453471
2025-05-30 21:21:30 -07:00
Xiang (Sean) Zhou af2180c6d0 chore: add more comments to MCPTooset and MCPSessionManager
PiperOrigin-RevId: 765448413
2025-05-30 21:01:16 -07:00
Xiang (Sean) Zhou 5d297169d0 fix: remove labels from config when using API key from Google AI Studio to call model
PiperOrigin-RevId: 765448305
2025-05-30 21:00:23 -07:00
Xiang (Sean) Zhou 3ec496dd81 chore: add requirements.txt for langchain_youtube_search_agent
PiperOrigin-RevId: 765409052
2025-05-30 18:19:01 -07:00
Xiang (Sean) Zhou 3616bb5fc4 feat:support Langchain tools that has run_manager in _run args and don't have args_schema populated
PiperOrigin-RevId: 765405793
2025-05-30 18:05:42 -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
Google Team Member 63822c3fa8 Remove the gap between event holder and image.
PiperOrigin-RevId: 765402231
2025-05-30 17:52:26 -07:00
Google Team Member 95e33baf57 fix: add support for running python main function in UnsafeLocalCodeExecutor when the code has an if __name__ == "__main__" statement.
Fixes https://github.com/google/adk-python/issues/791

PiperOrigin-RevId: 765359512
2025-05-30 15:30:01 -07:00
Calvin Giles 4075290a1d chore: Fix reqeust -> request typo
Copybara import of the project:

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

chore: Fix reqeust -> request typo
#non-breaking
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/883 from calvingiles:fix-reqeust-typo cfe592e6ad4ebc79bd2b3ebcd0370f868b57ff10
PiperOrigin-RevId: 765354040
2025-05-30 15:13:42 -07:00
Google Team Member ba5b80d5d7 feat: use bigquery scope by default in bigquery credentials.
Right now the agent builder has to specify the bigquery scope explicitly for bigquery tools, which is somewhat unnecessary. With this change the user does not have to specify scopes, although they would still have the ability to overrides scopes if necessary.

PiperOrigin-RevId: 765354010
2025-05-30 15:12:49 -07:00
Karthigayan Devan 8759a25251 Copybara import of the project:
--
e1c479d037d37e1ee1ddd86a4cd180f2692d952f by Karthigayan Devan <karthidec@gmail.com>:

add jira_agent adk samples code which connect Jira cloud

--
ef9fe57538252ad69f825f3ff77023b1f9eb004f by Karthigayan Devan <karthidec@gmail.com>:

update variables comment

--
f6adaaddd2decdd1e35aa06ba88031ec3b8a8521 by Karthigayan Devan <karthidec@gmail.com>:

renamed tool name to match exactly align with tool naming standard, removed keyword

--
150e63d4270b141e21195c5be7d67dce72e216fb by Karthigayan Devan <karthidec@gmail.com>:

updated tool and agent instructions

--
5048043195a5b1d397d9d439b3f6c6e650b4a6a3 by Karthigayan Devan <karthidec@gmail.com>:

add image application integration

--
bf3ee1553929d6d031f7b14f0b28f8f0ae7b84cc by Karthigayan Devan <karthidec@gmail.com>:

update read me instructions on configure app integration connector

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/785 from karthidec:adk-samples-jira-agent 2b984fa8c242e164541353b4597aebf4fd422288
PiperOrigin-RevId: 765351338
2025-05-30 15:04:38 -07:00
Cristopher Hugo Olivares Del Real 7aaf811616 fix: typos in documentation
Copybara import of the project:

--
db506da1c38f0a27df51b0e672ef78d62077af78 by Cristopher Hugo Olivares Del Real <crissins041196@gmail.com>:

fix: typos in documentation
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/840 from crissins:main 76a5e9bfbe73e7744b144010741a4e80425282a9
PiperOrigin-RevId: 765347788
2025-05-30 14:55:36 -07:00
Shawn Yang 3930a4b989 chore: Add agent engine telemetry
PiperOrigin-RevId: 765346182
2025-05-30 14:49:39 -07:00
Google Team Member 45ef668435 fix: timeout issues for mcpstdio server when mcp tools are incorrect.
Fixes https://github.com/google/adk-python/issues/643

PiperOrigin-RevId: 765342572
2025-05-30 14:39:07 -07:00
Shangjie Chen 01965bdd74 chore:Extract common options for adk web and adk api_server.
PiperOrigin-RevId: 765326316
2025-05-30 13:58:22 -07:00
iamb4uc.xyz ccd05e0b00 BugFix: Unused import for deprecated.
--
512e810b6dbb88248bfbfc1dbff598a247a099be by swapnil <swapnilbhmk.intrn@gmail.com>:

BugFix: Unused import for deprecated.
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/726 from swapxs:patch-2 44590f0085c06410aac58a6519aaa080dc277a40
PiperOrigin-RevId: 765285320
2025-05-30 12:09:33 -07:00
Yifan Wang daac8cedfe fix: adk web not working on some env for windows, fixes https://github.com/google/adk-web/issues/34
PiperOrigin-RevId: 765271751
2025-05-30 11:36:00 -07:00
Hangfei Lin aabfde56e4 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-30 11:33:24 -07:00
Shangjie Chen 65063023a5 fix: Continue fetching events if there are multiple pages.
Fixes https://github.com/google/adk-python/issues/920

PiperOrigin-RevId: 764985371
2025-05-29 19:42:50 -07:00
Wei Sun (Jack) 18fbe3cbfc docs: Adds a sample agent to illustrate state usage via callbacks.
PiperOrigin-RevId: 764981675
2025-05-29 19:30:44 -07:00
Wei Sun (Jack) 4214c7eddd chore: auto-format files.
PiperOrigin-RevId: 764980009
2025-05-29 19:24:16 -07:00
Amulya Bhatia face2e8cf2 Copybara import of the project:
--
8baeb0b569eaedc638b20e46894178a3b878dbd6 by Amulya Bhatia <amulya.bhatia@t-online.de>:

test: unit tests for built_in_code_executor and unsafe_code_executor

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

test: unit tests for built_in_code_executor and unsafe_code_executor
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/971 from iamulya:code-executor-tests 55290e27b5e58ef3835905aec88639e936318d01
PiperOrigin-RevId: 764976316
2025-05-29 19:08:55 -07:00
Wei Sun (Jack) 04e07b4a14 docs: updates CONTRIBUTING.md to refine setup process using uv.
PiperOrigin-RevId: 764974667
2025-05-29 19:03:22 -07:00
Eugen-Bleck b226a06c0b fix: match arg case in errors
--
d9b0a6f822f773a61bcc507d252ca46da660b70b by Eugen-Bleck <eugenbleck@gmail.com>:

fix: match arg case in errors
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/724 from bl3ck:fix/preserve-arg-case-in-errors 3ac43ef2090f5e4b4158ea97cbcf16399aabe2e5
PiperOrigin-RevId: 764953570
2025-05-29 17:40:12 -07:00
Google Team Member 5c2ad327bf Render HTML artifact in chat window.
PiperOrigin-RevId: 764942273
2025-05-29 17:02:36 -07:00
Alankrit Verma 854a544061 fix(transfer_to_agent): update docstring for clarity and accuracy
Copybara import of the project:

--
e246af5965dfd4d032e0a3ce29513f3e2e874f73 by Alankrit Verma <alankrit386@gmail.com>:

tools: allow transfer_to_agent to accept extra kwargs

transfer_to_agent now takes **kwargs to swallow unexpected keyword args
Added integration tests covering single and multiple extra kwargs.
Fixes #458.

--
55fea786a9b7eb19b830dc67d7a2e37fe7937608 by Alankrit Verma <alankrit386@gmail.com>:

fix(tests): correct indentation in test_transfer.py for better readability

--
0c04f2d777bd4f3d8951dadd5e4e105530bd6281 by Alankrit Verma <alankrit386@gmail.com>:

fix(transfer_to_agent): restore strict two-arg signature and clarify usage

Revert the earlier **kwargs change so transfer_to_agent again only accepts
(agent_name, tool_context).  Improve the doc-string to make clear that no
other parameters should be passed to this tool.

Fixes #458

--
d37448dd0ef9fc6199ca0e42b211b3cd9c886eb0 by Alankrit Verma <alankrit386@gmail.com>:

fix(transfer_to_agent): update docstring for clarity and accuracy

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

Update transfer_to_agent_tool docstring for better prompt
--
a144069a67b2e5652ffd50224b1ce68ddea14783 by Wei Sun (Jack) <Jacksunwei@gmail.com>:

Update transfer_to_agent_tool.py

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/466 from AlankritVerma01:tools/transfer-accept-kwargs 686d436457e3141d128c6e81452fddc546a14a7e
PiperOrigin-RevId: 764940463
2025-05-29 16:57:27 -07:00
Yongsul Kim 0d66a7888b Copybara import of the project:
--
cd9130aca29b5d07b069cfc4a9aa022455e005e9 by Yongsul Kim <ystory84@gmail.com>:

docs: Fix broken link to A2A example
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1021 from ystory:patch-1 5d827f7834ca33120bd2a87d63e29ac5b93eb7c9
PiperOrigin-RevId: 764937930
2025-05-29 16:50:10 -07:00
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
Shangjie Chen db4bc9809c fix: Filter memory by app_name and user_id.
Fixing https://github.com/google/adk-python/issues/1019.

PiperOrigin-RevId: 764903966
2025-05-29 15:15:59 -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
Jacky Wu 841e10ae35 fix: introduce PreciseTimestamp to fix mysql datetime precision issue.
Copybara import of the project:

--
c62a0a6da4317497b991f83d4d8561bdbe7292aa by Jacky W <wjx_colstu@hotmail.com>:

--
59c0606ac08ddb45ce469a4d1e1c6e515ef94df4 by Jacky W <wjx_colstu@hotmail.com>:

fix: add cache_ok option to remove sa warning.

--
1922599075af935a63544762765d6f0e6224907a by Jacky W <wjx_colstu@hotmail.com>:

chore: format code.
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/1001 from Colstuwjx:fix/issue-480-precise-mysql-timestamp 50e764fb9646e326ad0204ff7adb2a5b65bf875a
PiperOrigin-RevId: 764853016
2025-05-29 13:10:13 -07:00
Wei Sun (Jack) a9dcc588ad ADK changes
PiperOrigin-RevId: 764820494
2025-05-29 12:10:41 -07:00
Liang Wu a8a20743f9 fix: handles function tool parsing corner case where type hints are stored as strings.
Previously if you add `from __future__ import annotations` in your code, the parsing code would fail because the type hints will be a string instead of the class itself (e.g. input: 'str' instead of input: str).

Also added "_" to the util file name.

PiperOrigin-RevId: 764817339
2025-05-29 11:48:35 -07:00
Selcuk Gun d587270327 Prevent JSON parsing errors and preserve non-ascii characters in telemetry
PiperOrigin-RevId: 764801572
2025-05-29 11:48:28 -07:00
Google Team Member 1de5c340d8 Raise HTTPException when running evals in fast_api if google-adk[eval] is not installed.
PiperOrigin-RevId: 764798561
2025-05-29 11:48:22 -07:00
Xiang (Sean) Zhou 7e637d3fa0 feat: support Langchain StructuredTool for Langchain tool
for fixing: https://github.com/google/adk-python/issues/707

PiperOrigin-RevId: 764781197
2025-05-29 11:48:15 -07:00
Google Team Member 2a65c4118b fix: Assign empty inputSchema to MCP tool when converting an ADK tool that wraps a function which takes no parameters.
Fixes https://github.com/google/adk-python/issues/948

PiperOrigin-RevId: 764780248
2025-05-29 11:48:08 -07:00
Google Team Member 9bdd813be1 Fix typos in README for sample bigquery_agent and oauth_calendar_agent
PiperOrigin-RevId: 764777424
2025-05-29 11:48:01 -07:00
Google Team Member ac52eab88e ADK changes
PiperOrigin-RevId: 764776124
2025-05-29 11:47:55 -07:00
Mohammad Ghaffarifar a9345a072e chore: add py.typed and include it in flit config
Copybara import of the project:

--
f56fd74efecc2cf6fbe6db70e91dfa7780fb9c68 by Mohammad <mohammaddevgermany@gmail.com>:

build(package): add py.typed and include it in flit config

This adds a py.typed marker file to the google.adk package and updates
the Flit configuration in pyproject.toml to include it in the distribution.

This ensures the package is PEP 561 compliant and allows static type
checkers (like mypy and pyright) to recognize that the package supports type hints.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/913 from mohamadghaffari:add-py-typed f56fd74efecc2cf6fbe6db70e91dfa7780fb9c68
PiperOrigin-RevId: 764603119
2025-05-29 11:47:46 -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 2b5c89b3a9 feat: expose more config of VertexAiSearchTool from latest Google GenAI SDK
for fixing: https://github.com/google/adk-python/issues/955

PiperOrigin-RevId: 764568728
2025-05-28 22:32:44 -07:00
Xiang (Sean) Zhou b92e068155 chore: fix function tool UT
PiperOrigin-RevId: 764567867
2025-05-28 22:30:42 -07:00
Xiang (Sean) Zhou a0714b8afc ADK changes
PiperOrigin-RevId: 764564638
2025-05-28 22:19:24 -07:00
Google Team Member 1452dacfeb Use media type in chat window. Remove isArtifactImage and isArtifactAudio reference.
PiperOrigin-RevId: 764563376
2025-05-28 22:15:28 -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 b70e74c450 chore: auto format mcp tools
PiperOrigin-RevId: 764547299
2025-05-28 21:14:42 -07:00
Xiang (Sean) Zhou 791ac9eb68 refactor: refactor cli to use agent loader
PiperOrigin-RevId: 764546019
2025-05-28 21:09:40 -07:00
Xiang (Sean) Zhou 623957c0a8 refactor: refine agent_loader to load the most common folder structure first and don't including unnecessary case
PiperOrigin-RevId: 764545194
2025-05-28 21:06:07 -07:00
Arpit R 6157db77f2 Copybara import of the project:
--
bdb2ddff1336db7fbeae71d3d76b4d294d7c4bea by Arpit Roopchandani <17565234+whoisarpit@users.noreply.github.com>:

Fix: Set output_schema correctly for LiteLllm
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/580 from whoisarpit:fix/lite_llm_response_schema 08bdb5a993fc44adf03e985c820c2083de30ba58
PiperOrigin-RevId: 764524765
2025-05-28 19:56:03 -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
Google Team Member fc3e374c86 Add export to json button in the chat window.
PiperOrigin-RevId: 764504072
2025-05-28 18:37:12 -07:00
Yifan Wang fda34ea9ff chore: bump version number to 1.1.1
Include https://github.com/google/adk-python/commit/d6c6bb4b2489a8b7a4713e4747c30d6df0c07961 in addition to 1.1.0

PiperOrigin-RevId: 764478592
2025-05-28 17:09:01 -07:00
Selcuk Gun 609b3a572c Provide sample LongRunningFunctionTool runner script and documentation
PiperOrigin-RevId: 764475345
2025-05-28 16:59:52 -07:00
Liang Wu 2a8ca06c3e chore: remove reference to genai SDK folder.
Added `from __future__ import annotations` to follow the best practice.

PiperOrigin-RevId: 764473253
2025-05-28 16:54:19 -07:00
Google Team Member 3489bb598d Minor typo fix.
PiperOrigin-RevId: 764468987
2025-05-28 16:41:40 -07:00
Liang Wu ed63cd86eb chore: re-format import statements in mcp_session_manager.py.
They are causing Kokoro failures.

PiperOrigin-RevId: 764467630
2025-05-28 16:37:56 -07:00
Ankur Sharma 447798d573 Accounting for "references" to be absent in eval files in older format.
PiperOrigin-RevId: 764454937
2025-05-28 16:04:18 -07:00
Google Team Member 958c18db2b Add download object as json function in the download service.
PiperOrigin-RevId: 764421398
2025-05-28 14:37:47 -07:00
Google Team Member 83ba6419cd Allow GOOGLE_AI to support optional args.
PiperOrigin-RevId: 764419789
2025-05-28 14:34:11 -07:00
Omar BENHAMID d232e6216d feat: google/adk-python#479 support for streamable http MCP servers for MCPToolset
Copybara import of the project:

--
c5b9d49d7b6d858ff0a93bd690e6d653b7c32221 by Omar BENHAMID <omar.benhamid@smart-gts.com>:

feat: google/adk-python#479 support for streamable http MCP servers for MCPToolset

--
9431bc19e6538c1b814aba0b24ff564acf046075 by Omar BENHAMID <omar.benhamid@smart-gts.com>:

feat: google/adk-python#479 streamable http added to right package

--
8b4aabed45a6f0dc828beb61f12985dc7b14f3d0 by Omar BENHAMID <omar.benhamid@smart-gts.com>:

feat: google/adk-python#479 streamable http : review feedbacks + sample agent
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/650 from omarbenhamid:feature/mcp-streamable-http 625f028784c216401d45cb1b5d4d998535ebcb00
PiperOrigin-RevId: 764419586
2025-05-28 14:33:19 -07:00
Xiang (Sean) Zhou c7ce987676 chore: reformat load_memory_tool
PiperOrigin-RevId: 764402270
2025-05-28 13:52:40 -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
Yuan Chai c4cd1802bf Copybara import of the project:
--
50b09bbe9735c889a9c815eddcee6715ebe848da by Yuan Chai <350365422@qq.com>:

fix: improve json serialization by allowing non-ascii characters
--
c66977ae6ec4edc71a2d633eb09918eb2a226461 by Yuan Chai <350365422@qq.com>:

fix: serialize function call arguments to JSON string

Previously accepted JSON objects directly, which was less robust. Now serialize arguments to JSON strings using `_safe_json_serialize`, ensuring stability and handling non-ASCII characters correctly.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/605 from nauyiahc:fix_non_ascii_char a52513c5747296b717acee989684324e1b072d34
PiperOrigin-RevId: 764396496
2025-05-28 13:38:11 -07:00
Sanchit Rk 3cd4cd3ecf Fix: add missing kwargs to db session service
Copybara import of the project:

--
bbd21e72e46227d5bbcaef6601f4a81724e7829f by Sanchit Rk <sanchitrrk@gmail.com>:

Fix: add missing kwargs to db session service
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/946 from sanchitrk:fix/missing-kwargs-db-session-service ebb699b04d8420ad14244cf3d43a2982b01d6b7f
PiperOrigin-RevId: 764392251
2025-05-28 13:27:58 -07:00
Alankrit Verma 2a07eefc27 chore: Raises error if the last event is partial, which is an unexpected state and can happen when the model output limit is maxed out.
Copybara import of the project:

--
a6e3a220a507a27523e427e88a803f4fec40db9c by Alankrit Verma <alankrit386@gmail.com>:

test(base_llm_flow): add test for infinite loop on truncated responses

--
b5f2245788b8ed51189d1ad057372989452f070d by Alankrit Verma <alankrit386@gmail.com>:

feat(base_llm_flow): break run_async loop on partial/truncated events

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

Raise ValueError if the last event is partial.

This is invalid state for llm flow.
--
6eebae0bc27c664eee4743ff7278ae5803415c9f by Wei Sun (Jack) <Jacksunwei@gmail.com>:

Delete tests/unittests/flows/llm_flows/test_base_llm_flow_truncation.py
--
e08b0ab19ca6eb88eb84f044bf72e815b2cf317c by Wei Sun (Jack) <Jacksunwei@gmail.com>:

format base_llm_flow.py

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/659 from AlankritVerma01:fix/522-base-llm-flow-truncation e08b0ab19ca6eb88eb84f044bf72e815b2cf317c
PiperOrigin-RevId: 764380150
2025-05-28 12:58:04 -07:00
Shangjie Chen d83ee1a6f2 fix: Remove excessive db call to update state table.
PiperOrigin-RevId: 764375522
2025-05-28 12:46:13 -07:00
shubham rajput 3611e9fe09 Copybara import of the project:
--
19b6701800bc3a26321ff3633b356106aba5a800 by shubham rajput <42935066+shu8hamrajput@users.noreply.github.com>:

fix: Update load_memory_tool.py

make `query` args required.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/389 from shu8hamrajput:fix/make-query-required-arg 92eb6472a380aa02b287a6ca94d2bfabdaa1c38b
PiperOrigin-RevId: 764303198
2025-05-28 09:49:36 -07:00
Wei Sun (Jack) 97bf28bad6 chore: Adds --version to adk cli.
Sample:

```
-> % adk --version
adk, version 1.0.0
```

Help with https://github.com/google/adk-python/issues/832

PiperOrigin-RevId: 764297949
2025-05-28 09:37:23 -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
Wei Sun (Jack) 46282eeb0d chore: Don't add prompt about parent agent when disallow_transfer_to_parent=True
Fixes https://github.com/google/adk-python/issues/844

PiperOrigin-RevId: 764116180
2025-05-27 23:41:30 -07:00
Wei Sun (Jack) f4c7d788b0 fix: build_graph is not awaited.
Fixes https://github.com/google/adk-python/issues/927

PiperOrigin-RevId: 764113488
2025-05-27 23:32:21 -07:00
Yifan Wang 15109c6879 fix: oauth fix for adk web
PiperOrigin-RevId: 764111115
2025-05-27 23:22:45 -07:00
Xiang (Sean) Zhou d40df2edf2 chore: fix unit tests
PiperOrigin-RevId: 764107186
2025-05-27 23:07:29 -07:00
Yifan Wang a66f12273c bump version number to 1.1.0.
PiperOrigin-RevId: 764026739
2025-05-27 18:17:04 -07:00
Yifan Wang 5d2a876ca8 feat:update minified adk web files
PiperOrigin-RevId: 763970627
2025-05-27 15:26:19 -07:00
Yifan Wang 0c4f52699b fix: serve web app at /dev-ui/
PiperOrigin-RevId: 763965859
2025-05-27 15:14:23 -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
Wei Sun (Jack) 16d9696012 fix: avoid duplicating log in stderr.
This was introduced to work around google-auth kills all logs via `google` root logging namespace. Given we're now using `google_adk` as root logging namesapce, we don't need additional Stream log handler now.

PiperOrigin-RevId: 763924531
2025-05-27 13:28:00 -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
Google Team Member b79400162d Use audio player component in the artifact tab
PiperOrigin-RevId: 763875097
2025-05-27 11:23:04 -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
Wei Sun (Jack) 19ca61d241 fix: model_config is misplaced for EvalMetricResultPerInvocation.
PiperOrigin-RevId: 763648920
2025-05-26 23:50:05 -07:00
Xiang (Sean) Zhou 7c2df7e4f6 refactor: refactor evaluation to make cli module depends on evaluation module. Modules outside of cli module should not reference cli module
PiperOrigin-RevId: 763577749
2025-05-26 19:18:55 -07:00
Wei Sun (Jack) d43c80b718 chore: updates mypy config in pyproject.toml.
1. Use non-strict as starting point;
2. Apply python_version to 3.9.
3. Sets `follow_imports` to skip.

PiperOrigin-RevId: 763553672
2025-05-26 17:25:48 -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
Wei Sun (Jack) 6b89ceb49a fix: mutable object cannot be default value in parameter.
PiperOrigin-RevId: 763479612
2025-05-26 11:32:07 -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
Google Team Member 55cb36edfe Add handling for None param.annotation.
This is the case for function tools that have no return value.

PiperOrigin-RevId: 763306054
2025-05-26 00:21:15 -07:00
Xiang (Sean) Zhou 74a331f1fb chore: reformat the code with autoformat.sh
PiperOrigin-RevId: 763256626
2025-05-25 20:33:45 -07:00
Xiang (Sean) Zhou 98c8a71d67 refactor: rename parameter name and add type annotation of _get_agent_to_run method
PiperOrigin-RevId: 763234780
2025-05-25 18:56:16 -07:00
Xiang (Sean) Zhou b0fb3536e5 chore: cleanup unused import in cli module
PiperOrigin-RevId: 763233551
2025-05-25 18:50:31 -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 a134ba6f7a feat: add toolset cleanup logic to run_cli
PiperOrigin-RevId: 762638389
2025-05-23 18:06:30 -07:00
Yifan Wang 7067c0319d fix: adk web now can be served under custom route
PiperOrigin-RevId: 762629432
2025-05-23 17:35:44 -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
Hangfei Lin 0e284f45ff Copybara import of the project:
--
76f579c8f75e28c79e322dc60c9dca56ac96d0fa by Hangfei Lin <hangfei@google.com>:

doc: Update README.md
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/901 from google:hangfei-patch-3 6c5e264c8134e8eb164114992f3d8f2f2efe83fc
PiperOrigin-RevId: 762603928
2025-05-23 16:10:22 -07:00
Google Team Member 8076b2294f ADK changes
PiperOrigin-RevId: 762573275
2025-05-23 14:41:27 -07:00
Ariz Chang f1a92e9674 chore: add google search agent for testing
PiperOrigin-RevId: 762571269
2025-05-23 14:36:27 -07:00
Google Team Member 717993b14f Fix eval history cases can't be toggled
PiperOrigin-RevId: 762561171
2025-05-23 14:06:35 -07:00
Shangjie Chen d212e50c10 feat:Make VertexAiSessionService true async.
PiperOrigin-RevId: 762547133
2025-05-23 13:31:38 -07:00
Google Team Member 79681e3513 Write eval results locally from adk eval cli.
PiperOrigin-RevId: 762499588
2025-05-23 11:16:00 -07:00
Google Team Member 33921d524f Add click event to the image in chat window.
PiperOrigin-RevId: 762473152
2025-05-23 10:12:15 -07:00
Xiang (Sean) Zhou 92c37496d3 refactor: simplify toolset cleanup codes and extract common cleanup codes to utils which could be utilized by cli or client codes that directly call runners
PiperOrigin-RevId: 762463028
2025-05-23 09:49:19 -07:00
Wei Sun (Jack) b9b2c3fb54 chore: Adds autoformat.sh for formatting codebase.
PiperOrigin-RevId: 762301862
2025-05-23 00:41:18 -07:00
Stephen Smith b4c4f88c22 Copybara import of the project:
--
aa92081193ccf4710e5aefb93c715791eab2c2ef by Stephen Smith <stephen.smith@newfront.com>:

docs: Fix typos in issue templates.
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/880 from stephensmithnewfront:stephensmithnewfront/address-typos-in-issue-templates-pr 65b7f85e26fca76b3e076ef0b826189353e8ab13
PiperOrigin-RevId: 762259304
2025-05-22 21:57:09 -07:00
sudu 68de9adc18 Copybara import of the project:
--
004eb36c16b042ba2d8be0cca39b739c0c8ca6c1 by sudu <teric@outlook.com>:

Update tools.yaml

When search hotels with some LLM, the date format shows as bellow
```
**Check-in Date:** April 23, 2024
```
So i update the SQL in tools.yaml to be compatible with following instruction:
```sql
update checkin date to 'April 24,2024' and checkout date to 'April 26,2024' of Best Western Bern
```
--
1300688ee1407212658d57712c1ad6ee61b052fe by qidu <qidu@outlook.com>:

Fix the tools of `ToolboxToolset` initialization bugs for
`samples/toolbox_agent`

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/794 from qidu:main 5b3199da564efdd07915e24e75659055a17dad82
PiperOrigin-RevId: 762259287
2025-05-22 21:56:18 -07:00
Sasha Sobran 0026edc1c9 chore: update filtered schema parameters for Gemini API.
PiperOrigin-RevId: 762209590
2025-05-22 18:39:58 -07:00
GenkiNoguchi d3910e7b8c Copybara import of the project:
--
3fb305691e0ecc8b75d56d0b9ef43c97cef8f773 by ammmr <m.hoshii777@gmail.com>:

fix: add missing await in runner run_live
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/849 from ammmr:patch-missing-await-in-runner-run-live b75b5d0105f18eaa06a0d7fb7d608b05eb59b3c9
PiperOrigin-RevId: 762113004
2025-05-22 13:55:00 -07:00
Google Team Member 30e10c87c5 feat:Integrate audio player component in the chat window.
PiperOrigin-RevId: 762105827
2025-05-22 13:37:37 -07:00
Wei Sun (Jack) fe618c3d93 chore: use relative import in google_api_toolsets.py. Adds open source header for base_toolset.py
PiperOrigin-RevId: 762042799
2025-05-22 11:13:57 -07:00
Wei Sun (Jack) a63ea2735c chore: Removes unused import.
PiperOrigin-RevId: 762039696
2025-05-22 11:05:45 -07:00
Xiang (Sean) Zhou ff8a3c9b43 chore: reformat the codes using autoformat.sh
PiperOrigin-RevId: 762004002
2025-05-22 09:43:54 -07:00
Xiang (Sean) Zhou a2263b1808 refactor: refactor toolset to extract tool_filter logic to base class
PiperOrigin-RevId: 761828251
2025-05-21 23:54:33 -07:00
Wei Sun (Jack) e0851a1e57 chore: batch organize imports.
PiperOrigin-RevId: 761824628
2025-05-21 23:40:47 -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
Google Team Member 505d936007 The saved filename should include the original file name instead of a generated one.
PiperOrigin-RevId: 761727488
2025-05-21 17:09:47 -07:00
Hangfei Lin d7af2b2815 Copybara import of the project:
--
cd8c580cbd4a2dc1c49c690ea81c4111860aa52c by Hangfei Lin <hangfei@google.com>:

doc: Update README.md
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/842 from google:hangfei-patch-2 aa9842a43d8c464a8999beb2f6f5d491aa63ef6c
PiperOrigin-RevId: 761722188
2025-05-21 16:54:40 -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
Xiang (Sean) Zhou b2a2b11776 ADK changes
PiperOrigin-RevId: 761650284
2025-05-21 13:39:16 -07:00
Wei Sun (Jack) 1773cdab96 chore: Batch organize imports with isort.
Command: `isort /src`
PiperOrigin-RevId: 761644934
2025-05-21 13:23:32 -07:00
Google Team Member 1807e73472 ADK changes
PiperOrigin-RevId: 761640805
2025-05-21 13:13:50 -07:00
Liang Wu 98f504cebe feat!: use BuiltInCodeExecutor in Runner for CFC.
The BuiltInCodeExecutionTool is deleted.

PiperOrigin-RevId: 761608273
2025-05-21 11:45:35 -07:00
Google Team Member 9928cafe32 Refactor eval results reporting with Eval Set Results manager.
PiperOrigin-RevId: 761601525
2025-05-21 11:30:40 -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
Google Team Member e060344e39 ADK changes
PiperOrigin-RevId: 761572168
2025-05-21 10:18:55 -07:00
Google Team Member 1561b0f15c Support fine-tuned gemini model path to use google_search_tool
PiperOrigin-RevId: 761543344
2025-05-21 08:59:19 -07:00
Google Team Member 62a543bd58 Add dynamicAuthConfig to ExecuteCustomQuery. Add sample agent for ApplicationIntegrationToolset which uses Integration Connectors with end user credentials.
PiperOrigin-RevId: 761356343
2025-05-20 21:45:27 -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
Xiang (Sean) Zhou 76700d790b chore: add doc string for auto generated google api toolset
PiperOrigin-RevId: 761266870
2025-05-20 16:08:27 -07:00
Google Team Member fe01103b74 ADK changes
PiperOrigin-RevId: 761251203
2025-05-20 15:23:12 -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
Google Team Member b299241b56 ADK changes
PiperOrigin-RevId: 761197136
2025-05-20 13:01:05 -07:00
Google Team Member 68f0fca832 ADK changes
PiperOrigin-RevId: 761190844
2025-05-20 12:44:05 -07:00
Wei Sun (Jack) bb00c9519d chore: Adds link to Java ADK in README.md
PiperOrigin-RevId: 761162478
2025-05-20 11:30:45 -07:00
Selcuk Gun 00798af881 Add usage_metadata for sse response with finish_reason
This is needed for covering the generation what ends with finish reason during streaming.

PiperOrigin-RevId: 761144245
2025-05-20 10:47:08 -07:00
Google Team Member 7d809eb9d9 Minor typo and grammar correction.
PiperOrigin-RevId: 761119061
2025-05-20 09:42:19 -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) 5115474f2b chore!: bump version to 1.0.0, updated changelog.md and removed src/google/adk/tools/built_in_code_execution_tool.py
Mark src/google/adk/tools/_built_in_code_execution_tool.py as private and will be fully removed soon.

PiperOrigin-RevId: 760889060
2025-05-19 20:31:27 -07:00
Xiang (Sean) Zhou de7c9c6509 enhance toolbox toolset:
1. use async client
2. expose add headers and bind parameters functionality of toolbox tool

PiperOrigin-RevId: 760845486
2025-05-19 18:08:02 -07:00
Xiang (Sean) Zhou 9eef4464c6 fix: fix toolbox import path in sample toolbox agent
PiperOrigin-RevId: 760837908
2025-05-19 17:43:41 -07:00
Yifan Wang 1bfc7590b4 update minified files to include the latest eval detail changes (only UI)
PiperOrigin-RevId: 760770101
2025-05-19 14:26:28 -07:00
Wei Sun (Jack) 3f21a52853 chore: Fixes the main.py for memory/agent.py sample.
PiperOrigin-RevId: 760741263
2025-05-19 13:08:57 -07:00
Xiang (Sean) Zhou 74454170a3 refactor: refactor and refine LangChainTool
PiperOrigin-RevId: 760726719
2025-05-19 12:29:44 -07:00
Wei Sun (Jack) ae7d19a4c6 chore: Moves toolbox-core to extensions extra dependency.
PiperOrigin-RevId: 760722343
2025-05-19 12:15:55 -07:00
Hangfei Lin 171b1145ee fix:Makes TranscriptionEntry.role optional
For function call or response, the role is None for now.

PiperOrigin-RevId: 760692876
2025-05-19 11:02:08 -07:00
Wei Sun (Jack) 9932015f3b chore: Makes --host backward compatible for cloud_run deploy. --host only available after 0.5.0.
PiperOrigin-RevId: 760681697
2025-05-19 10:35:05 -07:00
Xiang (Sean) Zhou 3f117391a5 refactor: remote remote agent as there is no use case and it's not implemented properly
PiperOrigin-RevId: 760652423
2025-05-19 09:24:37 -07:00
Shangjie Chen 0497fc578c fix: fix return type of get_session.
PiperOrigin-RevId: 760638917
2025-05-19 08:46:54 -07:00
Xiang (Sean) Zhou 3b5232c14f feat: add sample mcp agent that connects to mcp server via sse endpoint directly
PiperOrigin-RevId: 760388717
2025-05-18 17:00:03 -07:00
Wei Sun (Jack) 9e767b3fe1 chore: Creates a sample main.py to demonstrate how to use adk as a library for the workflow agent in docs.
For Issue #573.

PiperOrigin-RevId: 760380509
2025-05-18 16:17:16 -07:00
Xiang (Sean) Zhou 2ad1f79422 refactor: replace logger.warn which is deprecated with logger.warning
PiperOrigin-RevId: 760311574
2025-05-18 10:25:29 -07:00
Jeffrey Mak f2b9e72f82 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-17 16:57:00 -04:00
Wei Sun (Jack) e278ca9541 chore: Refines mcp_agent instruction to include the allowed folder in the instruction.
PiperOrigin-RevId: 760057162
2025-05-17 12:57:11 -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) f592de4cc0 chore: constructor shouldn't have return type hint.
PiperOrigin-RevId: 760021373
2025-05-17 09:57:30 -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
Wei Sun (Jack) 729001fc0b chore: logger = logging.getLogger(__name__) --> logger = logging.getLogger('google_adk.' + __name__)
PiperOrigin-RevId: 760019467
2025-05-17 09:47:55 -07:00
Wei Sun (Jack) 0d7d7918b6 chore: logger = logging.getLogger(__name__) --> logger = logging.getLogger('google_adk.' + __name__)
PiperOrigin-RevId: 759894901
2025-05-16 23:04:02 -07:00
Wei Sun (Jack) 482099c925 chore!: Sets up google_adk for top level logger namespace. Removes --log_to_tmp option in adk web and adk api_server for the same reason.
Context: google-auth commit [1] broke adk log, because it disables the top level logger named "google", which is also adk's top level logger. We establish a separate top level logger with a different name `google_adk` to prevent this in the future.

This commit only changes google_llm.py. All other files will be changed in later commits.

[1] https://github.com/googleapis/google-auth-library-python/commit/77ad53eb00c74b3badc486c8207a16dbc49f37e5#diff-e386c2b2c39b4d746c1e257f503acecbde49b1746b1a34f53b57083ed6094161

PiperOrigin-RevId: 759872317
2025-05-16 21:28:33 -07:00
Wei Sun (Jack) 021aaddf32 chore: Allows BaseAgent in the constructor of InMemoryRunner.
PiperOrigin-RevId: 759818175
2025-05-16 17:42:58 -07:00
Google Team Member 74b8841e62 ADK changes
PiperOrigin-RevId: 759809705
2025-05-16 17:11:03 -07:00
Wei Sun (Jack) 186b5de826 chore: formats google_llm.py.
PiperOrigin-RevId: 759803357
2025-05-16 16:49:45 -07:00
Wei Sun (Jack) 03f167c1d3 chore: Adds toolbox-core to deps and fixes toolbox code error.
PiperOrigin-RevId: 759802478
2025-05-16 16:46:11 -07:00
Google Team Member 93e8f020ed ADK changes
PiperOrigin-RevId: 759775958
2025-05-16 15:24:40 -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
Google Team Member 801549f734 ADK changes
PiperOrigin-RevId: 759758769
2025-05-16 14:35:37 -07:00
Xiang (Sean) Zhou f83504dffb chore: add toolbox sample agent
PiperOrigin-RevId: 759746416
2025-05-16 14:01:53 -07:00
Jack Wotherspoon 11ca528090 feat!: remove ToolboxTool in favor of using toolbox-core directly
Copybara import of the project:

--
9cefcdde97685bc6966a13019bfb80cc232a399b by Jack Wotherspoon <jackwoth@google.com>:

chore: delete toolbox_tool.py
--
b2607eb0397e72b6b616ac592920f74d42a8ee5d by jackwotherspoon <jackwoth@google.com>:

feat: expose toolbox

--
a4a0859997af9a68e240f78ff351f0fded6a52e2 by Jack Wotherspoon <jackwoth@google.com>:

chore: update formatting
--
070dc93cdc289a5ee5935bd5995d3005bf8396a0 by jackwotherspoon <jackwoth@google.com>:

chore: add base toolbox tests

--
ab84a0f49eccc9b993317b3ffe2b5b6cad278d70 by jackwotherspoon <jackwoth@google.com>:

chore: remove ToolboxTool

--
87f4f909acc294468bcb3053e300f4df252bdb27 by Jack Wotherspoon <jackwoth@google.com>:

chore: update formatting
--
ddc1a11c0ce45fe34e5f2dd43c808d88a7d6af0b by Jack Wotherspoon <jackwoth@google.com>:

chore: Update pyproject.toml
--
aee173d8df40ffefe535b266e1bd6528c9aeb1b9 by Jack Wotherspoon <jackwoth@google.com>:

chore: Update pyproject.toml
--
22fc95922b500ddb0ec4901dccbe2fbfcc53b35f by Jack Wotherspoon <jackwoth@google.com>:

chore: Update __init__.py
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/763 from jackwotherspoon:expose-toolbox 3cb629a9d0d18aaeeeed59fb0d0d1e1b225b7437
PiperOrigin-RevId: 759744557
2025-05-16 13:56:58 -07:00
Ankur Sharma 76116c8008 Minor documentation update to a file.
PiperOrigin-RevId: 759742154
2025-05-16 13:49:46 -07:00
Xiang (Sean) Zhou 939b45a1c8 feat: add Toolbox Toolset
PiperOrigin-RevId: 759741922
2025-05-16 13:48:47 -07:00
Xiang (Sean) Zhou 015c667917 refactor: refactor base toolset to import from relative path
PiperOrigin-RevId: 759735824
2025-05-16 13:33:04 -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
Shangjie Chen 5ee17a3268 feat!: remove close_session from session service as it is not implemented yet.
PiperOrigin-RevId: 759705443
2025-05-16 12:08:57 -07:00
Google Team Member 370eed1c7a Update the adk-web-dev-ui-function-call screenshot.
PiperOrigin-RevId: 759677811
2025-05-16 10:57:24 -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
Shangjie Chen 2f006264ce chore: fix python format.
PiperOrigin-RevId: 759674648
2025-05-16 10:49:06 -07:00
Wei Sun (Jack) d0f117ebbc chore: call base class constructor in McpTool constructor.
PiperOrigin-RevId: 759644369
2025-05-16 09:28:15 -07:00
Adrian Cole dcb50effef Copybara import of the project:
--
636685818a512e9de30d5119f0244261cf16af27 by Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>:

fix: corrects typo in bigquery sample

Noticed while reading that google was spelled wrong.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/709 from codefromthecrypt:patch-1 b30e819979f81962a2e44922bfd2dadd539fe3ea
PiperOrigin-RevId: 759641065
2025-05-16 09:18:48 -07:00
Xiang (Sean) Zhou f384793649 fix: fix mcp agent filter logic
PiperOrigin-RevId: 759638254
2025-05-16 09:10:49 -07:00
Xiang (Sean) Zhou 05a853bc91 fix:fix mcp toolset close issue
PiperOrigin-RevId: 759636772
2025-05-16 09:05:56 -07:00
Xiang (Sean) Zhou 12507dc6cc fix: fix tool filtering in mcp toolset
PiperOrigin-RevId: 759632573
2025-05-16 08:53:21 -07:00
Xiang (Sean) Zhou 755ce74550 fix: stage correct ui files to adk
PiperOrigin-RevId: 759632290
2025-05-16 08:52:22 -07:00
Wei Sun (Jack) b72573c57d chore: Adds mypy to dev extra.
PiperOrigin-RevId: 759460917
2025-05-15 22:57:54 -07:00
Xiang (Sean) Zhou eb076a9ee8 fix: fix application integration toolset
PiperOrigin-RevId: 759450502
2025-05-15 22:23:49 -07:00
Xiang (Sean) Zhou fe5a5494e9 fix: fix oauth for dev UI
PiperOrigin-RevId: 759433563
2025-05-15 21:24:28 -07:00
Xiang (Sean) Zhou f0e11c72ab refactor: make readonly context optional in tool predicate
PiperOrigin-RevId: 759429453
2025-05-15 21:07:00 -07:00
Xiang (Sean) Zhou 770ecd8bb3 refactor: hide non-public field and cleanup for tools
PiperOrigin-RevId: 759400805
2025-05-15 19:24:10 -07:00
Zhining e62e15e720 fix: sqlalchemy query error in DatabaseSessionService when using custom GetSessionConfig with PostgreSQL
Copybara import of the project:
--
cec6f5044307e3ecdd20a513e0d8202b0854ff4c by ZhiNing <574775237@qq.com>:

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/705 from czn574775237:fix/issue-655 c15f116d4bc0328e8a90a437958042ef1b087c14
PiperOrigin-RevId: 759381068
2025-05-15 18:07:56 -07:00
Wei Sun (Jack) a786f75968 Uses logs method parameter to set log level.
PiperOrigin-RevId: 759378777
2025-05-15 18:00:40 -07:00
Yifan Wang 01a21e40d0 ADK changes
PiperOrigin-RevId: 759377414
2025-05-15 17:55:53 -07:00
Selcuk Gun 69f7ed8d0e Rename ollama sample script and await create_session
PiperOrigin-RevId: 759369988
2025-05-15 17:29:56 -07:00
Google Team Member ebfe8fe51c Resolve issue where --with_ui flag boolean was not being passed correctly, preventing CMD adk web [...] from being deployed to Cloud Run.
PiperOrigin-RevId: 759364440
2025-05-15 17:13:47 -07:00
Xiang (Sean) Zhou cb000e5a94 refactor: remove async root_agent handling as it no longer needed for MCP toolset
PiperOrigin-RevId: 759364382
2025-05-15 17:12:57 -07:00
Selcuk Gun 01cf186299 Update samples for async session changes and remove exp suffix from gemini model
PiperOrigin-RevId: 759364113
2025-05-15 17:12:07 -07:00
Wei Sun (Jack) 04820cb0a7 chore: Fixes a few samples for the breaking session service change.
PiperOrigin-RevId: 759354632
2025-05-15 16:44:23 -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
Google Team Member 4d5760917d chore: Add alias_generators to new Eval pydantic models
PiperOrigin-RevId: 759346603
2025-05-15 16:21:20 -07:00
Wei Sun (Jack) d27fe90d37 chore: fix wrong imports.
PiperOrigin-RevId: 759321579
2025-05-15 15:17:51 -07:00
Ankur Sharma 1c23556225 Updated test cases to use the new EvalSet schema to store test data. Also, added a utility to help migrate existing tests files to the new schema.
Also, migrated existing test files to the new schema and deleted test session files as they are no longer needed.

PiperOrigin-RevId: 759318735
2025-05-15 15:10:06 -07:00
Shangjie Chen a71d9ea9a1 fix: fix broken tests.
PiperOrigin-RevId: 759312577
2025-05-15 14:57:04 -07:00
Xiang (Sean) Zhou fccd17df6f fix: adapt oauth calendar agent and bigquery agent to new Google API toolset interface
PiperOrigin-RevId: 759298612
2025-05-15 14:21:45 -07:00
Ankur Sharma 4c6820e78c Update AgentEvaluator to new new EvalSchema
PiperOrigin-RevId: 759293759
2025-05-15 14:09:23 -07:00
Xiang (Sean) Zhou bdd678db31 refactor: refactor google api toolset to expose class instead of instance
PiperOrigin-RevId: 759289358
2025-05-15 13:59:57 -07:00
Yifan Wang f298d07579 ADK changes
PiperOrigin-RevId: 759276411
2025-05-15 13:28:50 -07:00
Liang Wu c399c50be5 Add --host argument to adk web and adk api_server commands and change the default binding host to localhost.
PiperOrigin-RevId: 759276079
2025-05-15 13:27:49 -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
Yifan Wang d161a2c3f7 ADK changes
PiperOrigin-RevId: 759218509
2025-05-15 11:04:21 -07:00
Ankur Sharma 95f994d7ca chore:add in memory session service to in memory runner.
PiperOrigin-RevId: 759206471
2025-05-15 10:35:21 -07:00
Shangjie Chen 3ea9eca929 feat! Remove list_events from session service interface as it has many overlap with get_session.
PiperOrigin-RevId: 759184310
2025-05-15 09:41:16 -07:00
Xiang (Sean) Zhou 2214c1558f fix: fix the typo in MCPToolset when parsing the errlog argument to MCPSessionManager
PiperOrigin-RevId: 759018462
2025-05-15 00:31:18 -07:00
Xiang (Sean) Zhou 4a0751941b fix: fix application integration toolset
PiperOrigin-RevId: 759018346
2025-05-15 00:30:19 -07:00
Liang Wu 9c2358e2a5 Update the usage of built-in code execution in documentation and sample agent.
PiperOrigin-RevId: 758997215
2025-05-14 23:17:13 -07:00
Ankur Sharma 3686608f8d Fixes test_cli_eval_success_path test.
PiperOrigin-RevId: 758981214
2025-05-14 22:20:59 -07:00
Ankur Sharma ada24d7171 Update Response Evaluators to use the new eval schema.
PiperOrigin-RevId: 758929683
2025-05-14 19:26:29 -07:00
Ankur Sharma ee674ce0ef Update Eval Run and TrajectoryEvaluator to use the new schema.
PiperOrigin-RevId: 758927160
2025-05-14 19:16:33 -07:00
Ankur Sharma 2cb74dd20e Update Eval Set Manager to use new EvalSet and EvalCase schema.
PiperOrigin-RevId: 758921365
2025-05-14 18:51:38 -07:00
Shangjie Chen 293f406148 fix: fix breaking delete_session.
PiperOrigin-RevId: 758862440
2025-05-14 15:42:44 -07:00
Shangjie Chen bc43a1196a feat: add _sync implementation in the inmemory session sevice.
PiperOrigin-RevId: 758832846
2025-05-14 14:22:46 -07:00
Google Team Member dc90c91ed1 Fix typo in import
PiperOrigin-RevId: 758736571
2025-05-14 10:20:24 -07:00
Liang Wu 22e4210b47 Deprecate BuiltInCodeExecutionTool in favor of BuiltInCodeExecutor.
PiperOrigin-RevId: 758713057
2025-05-14 09:22:49 -07:00
Jeffrey Mak 3263a97999 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-14 10:57:06 -04:00
Wei Sun (Jack) b67182c50f chore: Adds docstring for LlmAgent.disallow_transfer_to_parent to clarify the expected behavior.
PiperOrigin-RevId: 758676926
2025-05-14 07:36:51 -07:00
Wei Sun (Jack) 71bd808a14 Fixes: eval_result endpoint throws due to folder not existing.
PiperOrigin-RevId: 758508672
2025-05-13 22:03:38 -07:00
Tanue Eugen-Bleck Mbunwo b33bdb9a03 fix: Display full help text for adk create CLI command when argument…
Copybara import of the project:

--
dcfb9ff720562802f9ce15c90a71b4cd40f77280 by Eugen-Bleck <eugenbleck@gmail.com>:

fix: Display full help text for adk create  CLI command when arguments are missing

--
f2eea8d1e5947b1631ac2de3824d8bf0cf833cbc by Eugen-Bleck <eugenbleck@gmail.com>:

fix: Display full help text for adk run and eval  CLI command when arguments are missing
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/443 from bl3ck:fix/cli-help-display c2bca420b00aa3391ab8cfb6baedc9ea0dbfb7e1
PiperOrigin-RevId: 758498242
2025-05-13 21:22:05 -07:00
Xiang (Sean) Zhou fc40226ec0 refactor: refactor mcp toolset to hide non-public field
PiperOrigin-RevId: 758494601
2025-05-13 21:06:03 -07:00
Xiang (Sean) Zhou 14cf910ce6 refactor: refactor application integration toolset to hide non-public field
PiperOrigin-RevId: 758469938
2025-05-13 19:28:01 -07:00
Xiang (Sean) Zhou 00e0035c8a refactor: refactor google api toolset to hide non-public field
PiperOrigin-RevId: 758469484
2025-05-13 19:26:05 -07:00
Wei Sun (Jack) 30947b48b8 feat(memory)!: Uses the new MemoryEntry schema for all memory related components.
BREAKING CHANGE. This commit changes all memory related interface to using the newly introduced MemoryEntry class.

PiperOrigin-RevId: 758464887
2025-05-13 19:07:11 -07:00
Wei Sun (Jack) 825f5d4f2e feat: Adds new interface for MemoryEntry.
PiperOrigin-RevId: 758448993
2025-05-13 18:01:33 -07:00
Yifan Wang 6f00df3df0 ADK changes
PiperOrigin-RevId: 758444575
2025-05-13 17:43:53 -07:00
Xiang (Sean) Zhou da55b5a943 fix: update google api toolset to remove 'match' for python 3.9 compliant
PiperOrigin-RevId: 758438091
2025-05-13 17:21:05 -07:00
Wei Sun (Jack) d046367826 chore: Removes logging config in tools/google_api_tool/googleapi_to_openapi_converter.py.
PiperOrigin-RevId: 758436692
2025-05-13 17:16:03 -07:00
Xiang (Sean) Zhou 9647426500 refactor: refactor openapi toolset and tool parser to hide non public field
PiperOrigin-RevId: 758436303
2025-05-13 17:14:20 -07:00
Alec Daling 1f0fd7bfce Copybara import of the project:
--
e4aceb8428b8d2c321e7b44a16869997dd5f0dff by ajdaling <ajdaling@gmail.com>:

Fixes issue #311: Add usage_metadata to llm_response

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/694 from chapelhillnorth:fix-issue-311 2735bc01a6a57a5302b58af33266bfbeafc8e184
PiperOrigin-RevId: 758435162
2025-05-13 17:10:34 -07:00
Wei Sun (Jack) 66553b18c6 chore: Treats google.adk as known_third_party in pyproject.toml for organizing imports in samples.
PiperOrigin-RevId: 758434037
2025-05-13 17:06:52 -07:00
Liang Wu 933f01b89f fix: Concatenate all text Parts from an AgentTool agent's response.
PiperOrigin-RevId: 758424011
2025-05-13 16:38:54 -07:00
Google Team Member d6cf660506 chore: Migrate json field names to camelCase (4/4)
PiperOrigin-RevId: 758423361
2025-05-13 16:36:45 -07:00
Xiang (Sean) Zhou 931fb338f8 rename tool_set to toolset to uniform the naming
PiperOrigin-RevId: 758422703
2025-05-13 16:34:23 -07:00
Xiang (Sean) Zhou af978fe194 fix apihub toolset ut
PiperOrigin-RevId: 758400203
2025-05-13 15:32:28 -07:00
Google Team Member 4def3f1bd3 chore: Migrate json field names to camelCase (3/n)
PiperOrigin-RevId: 758394880
2025-05-13 15:16:16 -07:00
Selcuk Gun ff9de71869 Add role to the event returned in agent callback sample
Events without a role are filtered out in the next turns.

PiperOrigin-RevId: 758393355
2025-05-13 15:12:06 -07:00
Xiang (Sean) Zhou f6bdd555fb refactor apihub toolset to hide non public field
PiperOrigin-RevId: 758378396
2025-05-13 14:34:04 -07:00
Ankur Sharma cf06cc507a Refactor Eval Set Management into its own class.
PiperOrigin-RevId: 758378377
2025-05-13 14:32:38 -07:00
Selcuk Gun 303af440ee Await canonical instructions in test_llm_agent_fields.py
PiperOrigin-RevId: 758372807
2025-05-13 14:17:31 -07:00
Ankur Sharma 82b8e304ec Convert Session To Invocation.
PiperOrigin-RevId: 758356942
2025-05-13 13:39:52 -07:00
Hangfei Lin 4188673b0f feat(live): Support live mode of sequential agent
Add a `task_completed` function to the agent so when a model finished the task, it can send a signal and the program knows it can go to next agent.

This cl include:
* Implements the `_run_live_impl` in `sequential_agent` so it can handle live case.
* Add an example for sequential agent.
* Improve error message for unimplemented _run_live_impl in other agents.

Note:
1. Compared to non-live case, live agents process a continuous streams of audio
or video, so it doesn't have a native way to tell if it's finished and should pass
to next agent or not. So we introduce a task_compelted() function so the
model can call this function to signal that it's finished the task and we
can move on to next agent.

2. live agents doesn't seems to be very useful or natural in parallel or loop agents so we don't implement it for now. If there is user demand, we can implement it easily using similar approach.

PiperOrigin-RevId: 758315430
2025-05-13 11:56:16 -07:00
Hangfei Lin 39f78dc28f feat(live): Support native(model-side) audio transcription for agent transferring in live mode.
The old implementation:
1. We only started transcription at the beginning of agent transferring.
2. The transcription service we used is not as good / fast as the model/native transcription.

In the current implementation, the live agent will rely on the llm's transcription, instead of our transcription when llm support audio transcription in the input. And in that case, the live agent won't use our own audio transcriber. This reduces the latency from 5secs to 2 secs during agent transferring. It also improves the transcription quality.

When the llm doesn't support audio transcription, we still use our audio transcriber to transcribe audio input.

PiperOrigin-RevId: 758296647
2025-05-13 11:13:08 -07:00
Hangfei Lin c4d5e3b298 feat: Align run_live interface with run_async etc
PiperOrigin-RevId: 758289318
2025-05-13 10:57:26 -07:00
Yanfei Chen 08c9cf86c3 feat: Add an enterprise web search tool for web grounding.
PiperOrigin-RevId: 758206509
2025-05-13 07:15:46 -07:00
Xiang (Sean) Zhou dd8e9b71e5 fix application integration toolset unit tests
PiperOrigin-RevId: 758080966
2025-05-13 00:06:56 -07:00
Google Team Member d740b93e03 feat: trigger in ApplicationIntegrationTools is changed to triggers and is a list of strings
PiperOrigin-RevId: 758034458
2025-05-12 21:13:27 -07:00
Xiang (Sean) Zhou 2d84b13219 fix toolset codes to make it work with python 3.9
PiperOrigin-RevId: 757991503
2025-05-12 18:23:18 -07:00
Yifan Wang 80813a75cf Add debug trace endpoint in api server
Details:
- Add a in-memory SpanExporter to capture all trace information.
- Add /debug/trace/session/{session_id} endpoint to retrieve traces from the in-memory exporter.
- Add Session ID in Telemetry spans.

PiperOrigin-RevId: 757984565
2025-05-12 17:56:50 -07:00
Xiang (Sean) Zhou d35b99e6dd update mcp toolset and sample agent based on new tool_filter definition
PiperOrigin-RevId: 757969950
2025-05-12 17:05:24 -07:00
Xiang (Sean) Zhou 722028801a update application integration toolset agent based on new toolset interface
PiperOrigin-RevId: 757963384
2025-05-12 16:43:41 -07:00
Xiang (Sean) Zhou 57d1315533 adapt application integration toolset to new toolset interface
PiperOrigin-RevId: 757960706
2025-05-12 16:36:43 -07:00
Xiang (Sean) Zhou d19927b1bc update bigquery agent and oauth calendar agent according to new toolset interface
PiperOrigin-RevId: 757949732
2025-05-12 16:06:45 -07:00
Xiang (Sean) Zhou 6a04ff84ba adapt google api toolset and api hub toolset to new toolset interface
PiperOrigin-RevId: 757946541
2025-05-12 15:58:39 -07:00
Google Team Member 27b229719e chore: Migrate json field names to camelCase (2/n)
PiperOrigin-RevId: 757937550
2025-05-12 15:33:34 -07:00
Google Team Member 05a0c6b307 Add 'get_eval_report' and 'list_eval_reports' endpoints.
PiperOrigin-RevId: 757936497
2025-05-12 15:30:53 -07:00
Selcuk Gun df0892a7b8 Update import for override decorator in mcp_toolset for python version < 3.12
PiperOrigin-RevId: 757934273
2025-05-12 15:24:37 -07:00
Google Team Member 660c2efa4d Define EvalReport data model.
PiperOrigin-RevId: 757933585
2025-05-12 15:22:57 -07:00
Ankur Sharma 1237d5334f Adding Pydantic data models for eval set and eval case.
PiperOrigin-RevId: 757920694
2025-05-12 14:48:21 -07:00
Google Team Member 993f9971bb Add new GeminiCodeExecutor to code_executors/ folder.
PiperOrigin-RevId: 757895291
2025-05-12 13:44:17 -07:00
Xiang (Sean) Zhou 5462862795 fix eval unittests failure
PiperOrigin-RevId: 757872670
2025-05-12 12:42:19 -07:00
Shangjie Chen c39f24f072 fix: Refine the confusing error message.
PiperOrigin-RevId: 757841288
2025-05-12 11:20:54 -07:00
Alan 847c8fd11a Copybara import of the project:
--
d481e0604a79470e2c1308827b3ecb78bfb5327e by Alan B <alan@nerds.ai>:

feat: 🚧 catch user transcription

--
bba436bb76d1d2f9d5ba969fce38ff8b8a443254 by Alan B <alan@nerds.ai>:

feat:  send user transcription event as llm_response

--
ad2abf540c60895b79c50f9051a6289ce394b98d by Alan B <death1027@outlook.com>:

style: 💄 update lint problems

--
744703c06716300c0f9f41633d3bafdf4cb180a1 by Hangfei Lin <hangfeilin@gmail.com>:

fix: set right order for input transcription

--
31a5d42d6155b0e5caad0c73c8df43255322016f by Hangfei Lin <hangfeilin@gmail.com>:

remove print

--
59e5d9c72060f97d124883150989315401a4c1b5 by Hangfei Lin <hangfeilin@gmail.com>:

remove api version

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/590 from BloodBoy21:feat/api-version-vertex 1ed855249cae398b40691b91c6e468bccec07a3a
PiperOrigin-RevId: 757840099
2025-05-12 11:18:01 -07:00
Google Team Member f15f64af0f chore: Migrate json field names to camelCase (1/n)
PiperOrigin-RevId: 757832114
2025-05-12 10:59:35 -07:00
Shangjie Chen 70a6bfae90 fix: Explictly throw execption when custom id is set for vertex ai session service.
PiperOrigin-RevId: 757815469
2025-05-12 10:19:25 -07:00
Selcuk Gun 4c4cfb74ae Support async instruction and global instruction provider
PiperOrigin-RevId: 757808335
2025-05-12 10:03:34 -07:00
Selcuk Gun 812485fdfa Move callback samples to dedicated directory
Sample chained callback logs can we seen running asyncio_run.py

PiperOrigin-RevId: 757793406
2025-05-12 09:24:29 -07:00
Mukund Jha cdb4cac237 Copybara import of the project:
--
84abc07d2342e88e601949faa67a3014c0f491e8 by mukundjha-mj <mukundjha204@gmail.com>:

Fix spelling mistakes, reorder sections, and improve readability in pyproject.toml

--
122c19d4be0fad394fbd02720734aa4625877637 by mukundjha-mj <mukundjha204@gmail.com>:

fix(pyproject): correct spelling and reorder config sections for clarity

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/669 from mukundjha-mj:fix/typos-pyproject 122c19d4be0fad394fbd02720734aa4625877637
PiperOrigin-RevId: 757318920
2025-05-10 22:53:20 -07:00
Yifan Wang 16014764b6 Fix eval run without engaging agent result in api key missing error
PiperOrigin-RevId: 757015581
2025-05-09 21:02:23 -07:00
Google Team Member 9a8c77e04a Added filterClause in Update and Delete Request
PiperOrigin-RevId: 757013222
2025-05-09 20:50:36 -07:00
Selcuk Gun 4c191ba6b9 Move uv install under install dependencies
PiperOrigin-RevId: 757008562
2025-05-09 20:33:42 -07:00
Jeffrey Mak 36866935a3 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-09 19:21:46 -04:00
kmak de238eeab1 fix: unittest for path-level parameters case 2025-05-09 19:20:59 -04:00
Google Team Member 2a0524692b feat: Typo fixes in a few files.
PiperOrigin-RevId: 756921945
2025-05-09 15:10:23 -07:00
Xiang (Sean) Zhou 166df01236 fix eval in api server and cli for below issue:
https://github.com/google/adk-python/issues/651

PiperOrigin-RevId: 756906937
2025-05-09 14:26:29 -07:00
Shangjie Chen c4ecef54bc fix: Generate event id at beginning, and regen for every new yield event. This is because trace module requires an event id.
PiperOrigin-RevId: 756905471
2025-05-09 14:22:42 -07:00
Yifan Wang 415104743d the agent evetn graph is not able to be shown due to missing await keyword. this change is to fix missing await for build_graph
PiperOrigin-RevId: 756876056
2025-05-09 13:01:25 -07:00
Wei Sun (Jack) 33acb26565 chore: Bump min version for google-genai sdk to 1.13.0.
PiperOrigin-RevId: 756806752
2025-05-09 09:57:08 -07:00
Thiago Neves ac97fc638f fix(tests): use mock GCS client in artifact service tests to avoid real credentials
Copybara import of the project:

--
ade1d98e030a966183f56cb5c9c1b04cf51f5337 by Thiago Neves <thiagohneves@gmail.com>:

fix(tests): use mock GCS client in artifact service tests to avoid real credentials

--
becd2925feebf60196129b029a0ab8d490f7b19e by Thiago Neves <thiagohneves@gmail.com>:

test(agents): add unit tests for live_request_queue, readonly_context, and run_config

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/641 from thiagoneves:feature/increase-test-coverage 0f7a9fc55d97902e190a394f099324fbeb1541af
PiperOrigin-RevId: 756798390
2025-05-09 09:33:40 -07:00
Xiang (Sean) Zhou dc5c23c675 fix predicate class name in MCP toolset
PiperOrigin-RevId: 756761193
2025-05-09 07:39:08 -07:00
Xiang (Sean) Zhou 8c78945ec9 update mcp agent to use latest toolset interface
PiperOrigin-RevId: 756613972
2025-05-08 22:57:49 -07:00
Xiang (Sean) Zhou 7dffb59096 adapt MCP toolset to the latest Toolset interface
PiperOrigin-RevId: 756611140
2025-05-08 22:47:51 -07:00
Xiang (Sean) Zhou 4d7298e4f2 add toolset base class and allow llm agent to accept toolset as tools
PiperOrigin-RevId: 756605470
2025-05-08 22:27:52 -07:00
𝕂 8963300518 test(cli): Add unit tests for CLI functionality
Copybara import of the project:

--
f60707a22905f30040808b41b7e3510a47a80fc6 by K <51281148+K-dash@users.noreply.github.com>:

test(cli): Add unit tests for CLI functionality

This commit introduces unit tests for the following CLI-related components:

- cli_deploy.py: Tests for the cloud deployment feature.
- cli_create.py: Tests for the agent creation feature.
- cli.py: Tests for the main CLI execution logic.
- cli_tools_click.py: Tests for the Click-based CLI tools.

--
7be2159a475d0785619fea5e40c70e6461a7f4e1 by K <51281148+K-dash@users.noreply.github.com>:

fix test_cli_eval_success_path

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/577 from K-dash:test/add-unit-tests-for-cli 69f12d3a27d9c50a46ef269075e050f498dee67a
PiperOrigin-RevId: 756602765
2025-05-08 22:18:33 -07:00
Selcuk Gun 2cbbf88135 Support chaining for tool callbacks
(before/after) tool callbacks are invoked throughout the provided chain until one callback does not return None. Callbacks can be async and sync.

PiperOrigin-RevId: 756526507
2025-05-08 17:38:04 -07:00
Shangjie Chen 0299020cc4 ADK v0.5.0 release.
PiperOrigin-RevId: 756410107
2025-05-08 12:15:46 -07:00
Thiago Neves 5fd6a448de Copybara import of the project:
--
0723b0915550a0af9d1eb2952ee193238eee8178 by Thiago Neves <thiagohneves@gmail.com>:

fix(tests): use mock GCS client in artifact service tests to avoid real credentials

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/601 from thiagoneves:fix/mock-gcs-client-in-tests e7d16719b9c3116b652988d2ed1b1f8893686f3e
PiperOrigin-RevId: 756381115
2025-05-08 11:02:13 -07:00
魏超 85ccacbf2d fix(cli): Add auto-reload flag
Copybara import of the project:

--
a4a998d5418af47a4f263823810e8ab85a9ae4d6 by 魏超 <nneverwei@gmail.com>:

fix(cli): Disable auto-reload feature on Windows system

Fixed the issue caused by the auto-reload feature when running the CLI tool on Windows system. By detecting the operating system type, the auto-reload is disabled on Windows system to avoid potential errors: When mcp is asynchronously loaded, it will enter the _make_subprocess_transport NotImplementedError logic due to uvicorn reload=True in fastapi.
--
46c9bb600e4530d3f9c22369c4a99774efa024c9 by 魏超 <nneverwei@gmail.com>:

add an option in the CLI to enable or disable the reload feature. So users(esp. windows) can disable this if they come across the '_make_subprocess_transport NotImplementedError' bug on windows.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/415 from nneverwei:win-subprocess-NotImplError-with-mcp fbb9ab03350bb0a98769cf1a4cf930983ba9fa78
PiperOrigin-RevId: 756360981
2025-05-08 10:14:12 -07:00
Selcuk Gun d45084f311 Support chaining for agent callbacks
(before/after) agent callbacks are invoked throughout the provided chain until one callback does not return None. Callbacks can be async and sync.

PiperOrigin-RevId: 756359693
2025-05-08 10:09:33 -07:00
Google Team Member a61d20e3df feat: Add --session_id option to adk run:
--session_id : The session ID to save the session to on exit when --save_session is set to true. User will be prompted to enter a session ID if not set.

PiperOrigin-RevId: 756335619
2025-05-08 09:07:18 -07:00
Kavin Kumar B 41564de689 Copybara import of the project:
--
5eabc6c1fe339e87637b9ed6d0516a3edcbcb060 by kavinkumarbaskar <kavinkumarbaskar@gmail.com>:

fix readme pip install

--
bb21018aea7a4b8d8a60e6ef42b084dae51d7845 by kavinkumarbaskar <kavinkumarbaskar@gmail.com>:

fix: added build and local testing command

--
aa1f2305b098b79480eab9ab37b744d0273a5fcf by kavinkumarbaskar <kavinkumarbaskar@gmail.com>:

fix: added example

--
69b649d81e6757d6305c481e3415ec8f017a75ac by kavinkumarbaskar <kavinkumarbaskar@gmail.com>:

fix: updated the windows command

--
bd5202308bf08b9b44099c4cd016af23f2e2350e by kavinkumarbaskar <kavinkumarbaskar@gmail.com>:

fix: removed redundant code
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/529 from kavinkumar807:fix-readme-pip-install a49d82d49a0cecb4cee399620c62ae10c1f3370a
PiperOrigin-RevId: 756122021
2025-05-07 20:43:10 -07:00
Google Team Member 7f76af4d76 feat: trigger in ApplicationIntegrationTools is changed to triggers and is a list of strings
PiperOrigin-RevId: 756111287
2025-05-07 20:04:47 -07:00
Xiang (Sean) Zhou e7d9cf359a make eval functions async
PiperOrigin-RevId: 756106627
2025-05-07 19:53:19 -07:00
Yifan Wang cc1ef3f2ad ADK changes
PiperOrigin-RevId: 756067015
2025-05-07 17:19:33 -07:00
Shangjie Chen 26f55fb5ab fix: Use new id for every event.
Fixes #297

PiperOrigin-RevId: 755901205
2025-05-07 10:07:38 -07:00
Hangfei Lin a4adb739c0 Create a developer folder and add samples.
PiperOrigin-RevId: 755885332
2025-05-07 09:26:19 -07:00
Mrigank Khandelwal 180c2a934b Copybara import of the project:
--
8d5e7f017d975d4ecd5ad6004079fec0f6b417e1 by Mrigank Khandelwal <mrigankkhandelwal300@gmail.com>:

fix: Fixed incorrect difinition of MCP in function docstring
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/594 from Mrigankkh:main 0d52a8059a7c3438207a86c03cfd3f25204d4b2e
PiperOrigin-RevId: 755698357
2025-05-06 23:20:07 -07:00
Pratik Mahajan c565473bf8 Copybara import of the project:
--
09b10cd96fc095061c6891a0d3cc3cc83948a126 by pratikmahajan <pmahajan@redhat.com>:

fix: change litellm request log level to debug

Litellm was previously logging every request at the info level,
which could clutter the logs with unnecessary detail in production environments.
This commit changes the log statement to use the debug level instead,
ensuring that request details are only logged when debug mode is active.
This helps keep the standard logs focused on more critical information.

Co-authored-by: pratikmahajan<pmahajan@redhat.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/583 from PratikMahajan:litellm-log-levels 04fcd7247693e0c733318789f1ea47ecec81add4
PiperOrigin-RevId: 755691209
2025-05-06 22:59:10 -07:00
Google Team Member 357143c2aa feat: trigger in ApplicationIntegrationTools is changed to triggers and is a list of strings
PiperOrigin-RevId: 755691136
2025-05-06 22:58:12 -07:00
luaifei d5b3a89fe7 fix: fix a few unit tests
Copybara import of the project:

--
93cc9c0b71a92991a888c93675ddc8aee11f21dc by luaifei <lu.aifei@thoughtworks.com>:

fix: Update skipped tests in test_auth_handlers

--
06ddf559c76c113231719bff549d41801a93daf4 by luaifei <lu.aifei@thoughtworks.com>:

fix: Update skipped & failed tests in test_connections_client and test_streaming

--
b8f2d357c1101c59ee9b65fa89a75f216e014a7c by luaifei <lu.aifei@thoughtworks.com>:

fix: Remove ignored test file from Python unit tests workflow
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/553 from luaifei:fix-tests d51e42841e71d388c16cc719a4798b029182084f
PiperOrigin-RevId: 755669644
2025-05-06 21:45:17 -07:00
Selcuk Gun e4317c9eb7 Support chaining for model callbacks
(before/after) model callbacks are invoked throughout the provided chain until one callback does not return None. Callbacks can be async and sync.

PiperOrigin-RevId: 755565583
2025-05-06 16:16:02 -07:00
Selcuk Gun 794a70edcd Support async agent and model callbacks
PiperOrigin-RevId: 755542756
2025-05-06 15:14:10 -07:00
Shangjie Chen f96cdc675c fix: Use await to wait for the full list rather than async for which only works for async iterable.
PiperOrigin-RevId: 755541004
2025-05-06 15:10:14 -07:00
Allen 1393965720 Fix: config.after_timestamp behavior in InMemorySessionService.get_session() and add a test
Copybara import of the project:

--
c1d0d649b5aae1322a02dbaa586822d69b8546f6 by allengour <allengour@google.com>:

fix: fix and test `config.after_timestamp` behavior in `InMemorySessionService.get_session()`
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/438 from allengour:fix/issue-437-after_timestamp-behavior 4b49a5e6509b5ad9dd9103a6dc357fd44c101f31
PiperOrigin-RevId: 755492201
2025-05-06 13:09:59 -07:00
Shangjie Chen e2ba484b43 fix: add missing async change in code execution.
PiperOrigin-RevId: 755429199
2025-05-06 10:37:17 -07:00
Wei Sun (Jack) 28abc306c3 chore: fixes type hint in base_artifact_service.py
`pass` is not required when docstring exists.

PiperOrigin-RevId: 755413158
2025-05-06 09:58:18 -07:00
Alan fcca0afdac add input transcription support for live/streaming.
Copybara import of the project:

--
d481e0604a79470e2c1308827b3ecb78bfb5327e by Alan B <alan@nerds.ai>:

feat: 🚧 catch user transcription

--
bba436bb76d1d2f9d5ba969fce38ff8b8a443254 by Alan B <alan@nerds.ai>:

feat:  send user transcription event as llm_response

--
ad2abf540c60895b79c50f9051a6289ce394b98d by Alan B <death1027@outlook.com>:

style: 💄 update lint problems

--
744703c06716300c0f9f41633d3bafdf4cb180a1 by Hangfei Lin <hangfeilin@gmail.com>:

fix: set right order for input transcription

--
31a5d42d6155b0e5caad0c73c8df43255322016f by Hangfei Lin <hangfeilin@gmail.com>:

remove print

--
59e5d9c72060f97d124883150989315401a4c1b5 by Hangfei Lin <hangfeilin@gmail.com>:

remove api version

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/495 from BloodBoy21:main ea29015af041f9785abaa8583e2c767f9d8c8bc8
PiperOrigin-RevId: 755401615
2025-05-06 09:26:33 -07:00
Shangjie Chen 905c20dad6 ADK changes
PiperOrigin-RevId: 755201925
2025-05-05 21:58:47 -07:00
Yifan Wang 6dec235c13 ADK changes
PiperOrigin-RevId: 755126232
2025-05-05 17:07:57 -07:00
Wei Sun (Jack) dbea793cf5 chore: Updates model_config docstring to explicitly mentioning pydantic.
This is to disambiguate between pydantic model and LLM.

PiperOrigin-RevId: 754981617
2025-05-05 10:12:44 -07:00
Wei Sun (Jack) a930633fad chore: Sets single_line_exclusions to [] to be consistent with internal style guide.
PiperOrigin-RevId: 754974408
2025-05-05 09:56:27 -07:00
Yuwei Fu fb3915da3b fix: Fix install command for Zsh compatibility. (#520)
* Fix install command for Zsh compatibility. Wrapped extras list in quotes to prevent Zsh from expanding it as a glob pattern.

* Fix install command for Zsh compatibility. Wrapped extras list in quotes to prevent Zsh from expanding it as a glob pattern.

---------

Co-authored-by: Hangfei Lin <hangfei@google.com>
2025-05-04 08:27:26 -07:00
Yuwei Fu 5824c89ee4 Copybara import of the project:
--
ec246aeee44156db8a94661b7e997cf2012f2e4e by Yuwei Fu <fuyuweiwill@gmail.com>:

Fix install command for Zsh compatibility. Wrapped extras list in quotes to prevent Zsh from expanding it as a glob pattern.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/520 from Imfuyuwei:main 6cd4ecc9216ea2f03c3fed43e37d18d1838cac05
PiperOrigin-RevId: 754625822
2025-05-04 08:00:27 -07:00
Jeffrey Mak 84579cab56 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-04 08:51:14 -04:00
kmak 34b001292a fix: support path level parameters for open_api_spec_parser 2025-05-04 08:50:02 -04:00
Hangfei Lin 97d29a1d9f Copybara import of the project:
--
41329f091a31b3d32af3025000951295477c717b by Hangfei Lin <hangfei@google.com>:

doc: Update CONTRIBUTING.md to include testing requirements
--
380b82e00fa8f16cbfd9e113ef45e1fc8e8c0932 by Hangfei Lin <hangfei@google.com>:

doc: Update CONTRIBUTING.md
--
61e81d848c275d4be3da2cb60a93e84bc68b3b4b by Hangfei Lin <hangfei@google.com>:

doc: Update CONTRIBUTING.md
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/541 from google:hangfei-patch-1 63d5c56e663cdfe6f6e78be85d9686873aeb2a5a
PiperOrigin-RevId: 754541490
2025-05-04 00:18:08 -07:00
Hangfei Lin a7b4c98253 fix: Handle the case when parameter.required is None and fix tests
PiperOrigin-RevId: 754519323
2025-05-03 22:39:28 -07:00
Bart ad4226b3d8 Copybara import of the project:
--
1ca16aba5b7b869afa8e0a0cddaea539acd737f5 by bart.lee(이철민)/kakao <bart.lee@kakaocorp.com>:

chore: Improves session update time validation message

Enhances the error message when a session's last update time is later than the storage update time.
This provides better readability by formatting the timestamps in the error message.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/446 from kakao-bart-lee:main a2a0cff036429b61bd7cf1600fc4c2c0cf50089d
PiperOrigin-RevId: 754452381
2025-05-03 17:07:53 -07:00
seanzhou1023 9bec05ce86 Merge pull request #538 from hangfei/main
fix: fix typo in function name in unit tests(test_rest_api_tool.py)
2025-05-03 15:16:49 -07:00
Hangfei Lin 81aa11f070 fix: Update test_operation_parser.py 2025-05-03 14:50:30 -07:00
Hangfei Lin 6f182821c4 fix: Update operation_parser.py 2025-05-03 14:47:07 -07:00
Hangfei Lin 88fe4c58a0 fix: handle None case 2025-05-03 14:35:40 -07:00
Hangfei Lin a6b3c23f74 fix: fix typo in function name in unit tests(test_rest_api_tool.py)
fix: fix typo in function name in unit tests
2025-05-03 14:25:36 -07:00
Xiang (Sean) Zhou 5846b24b71 set param required tag to False by default
PiperOrigin-RevId: 754382785
2025-05-03 10:31:38 -07:00
Bart 24024f7fc4 chore: Improves session update time validation message (#446)
Enhances the error message when a session's last update time is later than the storage update time.
This provides better readability by formatting the timestamps in the error message.

Co-authored-by: Hangfei Lin <hangfei@google.com>
2025-05-03 07:55:47 -07:00
Nilesh c74879d849 fix: Correct various typos in CHANGELOG.md and test_rest_api_tool.py (#498)
Corrected the following spelling errors:
 - CHANGELOG.md: "impprovements" -> "improvements"
 - test_rest_api_tool.py: "def sample_endpiont:" -> "def sample_endpoint:"
 - Updated all the references of sample_endpiont -> sample_endpoint as well.
 - CHANGELOG.md: "credentails" -> "credentials"
 - CHANGELOG.md: "auido" -> "audio"

Co-authored-by: Hangfei Lin <hangfei@google.com>
2025-05-02 23:12:00 -07:00
Wei Sun (Jack) 6595cda037 Update description of before/after_agent_callback to clarify the behavior.
PiperOrigin-RevId: 754207459
2025-05-02 18:57:50 -07:00
Hangfei Lin 60d23c028f ADK changes
PiperOrigin-RevId: 754193272
2025-05-02 17:53:31 -07:00
Nilesh eff5903175 Copybara import of the project:
--
6c3b8b5fa2eb9805c6f723f560e5526649dd61f0 by knileshh <neutron_stays@protonmail.com>:

fix: Correct various typos in CHANGELOG.md and test_rest_api_tool.py

Corrected the following spelling errors:
 - CHANGELOG.md: "impprovements" -> "improvements"
 - test_rest_api_tool.py: "def sample_endpiont:" -> "def sample_endpoint:"
 - CHANGELOG.md: "credentails" -> "credentials"
 - CHANGELOG.md: "auido" -> "audio"

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/498 from knileshh:main caadbdbd78e3dc757b494f3f4d45991e88eac30d
PiperOrigin-RevId: 754189420
2025-05-02 17:36:16 -07:00
Tanmay Ghare da677b7a34 chore: Fix typos in CONTRIBUTING.md (#460)
Co-authored-by: Hangfei Lin <hangfei@google.com>
2025-05-02 17:35:39 -07:00
Ankur Sharma 4289e02854 Update the 'type' value on the items/properties nested structures for Anthropic models to adhere to JSON schema.
PiperOrigin-RevId: 754154596
2025-05-02 15:30:44 -07:00
Shangjie Chen bcf1deb582 ADK changes
PiperOrigin-RevId: 754131080
2025-05-02 14:19:18 -07:00
hsuyuming 879064343c Copybara import of the project:
--
ad923c2c8c503ba73c62db695e88f1a3ea1aeeea by YU MING HSU <abego452@gmail.com>:

docs: enhance Contribution process within CONTRIBUTING.md

--
8022924fb7e975ac278d38fce3b5fd593d874536 by YU MING HSU <abego452@gmail.com>:

fix: move _maybe_append_user_content from google_llm.py to base_llm.py,
so subclass can get benefit from it, call _maybe_append_user_content
from generate_content_async within lite_llm.py

--
cf891fb1a3bbccaaf9d0055b23f614ce52449977 by YU MING HSU <abego452@gmail.com>:

fix: modify install dependencies cmd, and use pyink to format codebase
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/428 from hsuyuming:fix_litellm_error_issue_427 dbec4949798e6399a0410d1b8ba7cc6a7cad7bdd
PiperOrigin-RevId: 754124679
2025-05-02 13:59:50 -07:00
Hangfei Lin 8f94a0c7b3 ADK v0.4.0 release.
PiperOrigin-RevId: 754103716
2025-05-02 12:56:42 -07:00
Divyansh Shukla 4f48ea1c08 ADK changes
PiperOrigin-RevId: 754103075
2025-05-02 12:54:38 -07:00
Wei Sun (Jack) 3fddac5813 Merge pull request #256 from sumant-pangotra/#247-OpenAPIToolSet-Considering-Required-parameters
fix: #247 OpenAPIToolSet Parameter required field and description 

Merged in https://github.com/google/adk-python/commit/e8fb4ed3fcba1f455507c38275ee17218017a409
2025-05-02 10:47:28 -07:00
Wei Sun (Jack) 9b52ce28f5 Merge branch 'main' into #247-OpenAPIToolSet-Considering-Required-parameters 2025-05-02 10:46:47 -07:00
sumant-pangotra e8fb4ed3fc Copybara import of the project:
--
27b214df3e by Sumant Pangotra <sumantpangotra@gmail.com>:

Fixed Parameter required field and description

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/256 from sumant-pangotra:#247-OpenAPIToolSet-Considering-Required-parameters 42f87a9c94
PiperOrigin-RevId: 754050217
2025-05-02 10:23:49 -07:00
sumant-pangotra 42f87a9c94 Merge branch 'main' into #247-OpenAPIToolSet-Considering-Required-parameters 2025-05-02 12:06:41 +05:30
Xiang (Sean) Zhou d387ab0c38 don't send content with empty text to LLM
PiperOrigin-RevId: 753869699
2025-05-01 23:01:50 -07:00
Wei Sun (Jack) f12300113d Merge branch 'main' into #247-OpenAPIToolSet-Considering-Required-parameters 2025-05-01 18:47:28 -07:00
Selcuk Gun 6c0a0d69ca Add pyink-annotation-pragmas to match google formatting
PiperOrigin-RevId: 753778114
2025-05-01 16:50:36 -07:00
Wei Sun 23b41c3f94 Uses google's profile for isort.
PiperOrigin-RevId: 753619497
2025-05-01 09:31:06 -07:00
Shangjie Chen 14933ba470 feat: Extract content encode/decode logic to a shared util and resolve issues with JSON serialization.
feat: Update key length for DB table to avoid key too long issue in mysql

PiperOrigin-RevId: 753614879
2025-05-01 09:13:28 -07:00
Wei Sun b691904e57 chore: Adds a github action to check pyformat via pyink.
PiperOrigin-RevId: 753246116
2025-04-30 11:28:12 -07:00
Wei Sun (Jack) 641781bced Merge pull request #434 from AlankritVerma01/support-async-tool-callbacks
feat(llm_flows): support async before/after tool callbacks
2025-04-29 22:49:18 -07:00
Wei Sun (Jack) c4e09a2edb Merge branch 'main' into support-async-tool-callbacks 2025-04-29 22:48:45 -07:00
João Campista acbbdb7266 Copybara import of the project:
--
709e1dd079d03d7eb4d742b9448ed3d1b946ff30 by joao.campista <joaocampista@proton.me>:

feat: add ordering to recent events in database session service
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/454 from lugui-co:main 912503f972c9cbd8982f2b7f8b210d4e0fe08b69
PiperOrigin-RevId: 753013663
2025-04-29 22:13:41 -07:00
Alankrit Verma 27ce65ff50 Copybara import of the project:
--
21736067f9 by Alankrit Verma <alankrit386@gmail.com>:

feat(llm_flows): support async before/after tool callbacks

Previously, callbacks were treated as purely synchronous,
so passing an async coroutine caused “was never awaited”
errors and Pydantic serialization failures.

Now we detect awaitable return values from
before_tool_callback and after_tool_callback,
and `await` them if necessary.

Fixes: #380

--
08ac9a117e by Alankrit Verma <alankrit386@gmail.com>:

Refactor function callback handling and update type signatures

- Simplify variable names in `functions.py`: always use `function_response` and `altered_function_response`
- Update LlmAgent callback type aliases to support async:
  - Import `Awaitable`
  - Change `BeforeToolCallback` and `AfterToolCallback` signatures to return `Awaitable[Optional[dict]]`
- Ensure `after_tool_callback` uses `await` when necessary

--
fcbf57466e by Alankrit Verma <alankrit386@gmail.com>:

refactor: update callback type signatures to support sync and async responses
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/434 from AlankritVerma01:support-async-tool-callbacks 926b0ef1a6
PiperOrigin-RevId: 753005846
2025-04-29 21:40:33 -07:00
Alankrit Verma 926b0ef1a6 Merge branch 'main' into support-async-tool-callbacks 2025-04-29 22:08:18 -04:00
Xiang (Sean) Zhou dbbeb190b0 Add two adk run options:
--replay : a json file that contains the initial session state and user queries, adk run will create a new session based on the state and run the user queries against the session. Users cannot continue to interact with agent.

--resume : a json file that contains the previously saved session (by --save_session option), adk run will replay this session and then user can continue to interact with the agent.
PiperOrigin-RevId: 752923403
2025-04-29 16:23:10 -07:00
Shangjie Chen 2a9ddec7e3 Set the max size of strings in database columns.
PiperOrigin-RevId: 752918808
2025-04-29 16:07:45 -07:00
Xiang (Sean) Zhou 2ea4315e9f update the doc comments of requested_auth_configs to make it more precise.
PiperOrigin-RevId: 752861847
2025-04-29 13:33:37 -07:00
Wei Sun (Jack) 67b6fbbe01 chore: Adds a github action to check pyformat via pyink. (#440)
* Adds pyink.yml github action to check file format

* Update pyink.yml to give recommended commands.
2025-04-29 09:39:18 -07:00
Alankrit Verma fcbf57466e refactor: update callback type signatures to support sync and async responses 2025-04-29 09:02:09 -04:00
Alankrit Verma 504aa6ba06 Merge branch 'main' into support-async-tool-callbacks 2025-04-28 23:21:10 -04:00
Alankrit Verma 08ac9a117e Refactor function callback handling and update type signatures
- Simplify variable names in `functions.py`: always use `function_response` and `altered_function_response`
- Update LlmAgent callback type aliases to support async:
  - Import `Awaitable`
  - Change `BeforeToolCallback` and `AfterToolCallback` signatures to return `Awaitable[Optional[dict]]`
- Ensure `after_tool_callback` uses `await` when necessary
2025-04-28 23:16:43 -04:00
Paul Lam 4ae8d72a8d docs: correct typo in conversion_utils.py (#351)
* docs: correct typo in conversion_utils.py

* docs: edited for conciseness
2025-04-28 19:47:34 -07:00
Alankrit Verma 21736067f9 feat(llm_flows): support async before/after tool callbacks
Previously, callbacks were treated as purely synchronous,
so passing an async coroutine caused “was never awaited”
errors and Pydantic serialization failures.

Now we detect awaitable return values from
before_tool_callback and after_tool_callback,
and `await` them if necessary.

Fixes: #380
2025-04-28 14:36:25 -04:00
Shangjie Chen 9a9f7a3765 Update callback comments.
PiperOrigin-RevId: 752162448
2025-04-27 22:20:02 -07:00
Hangfei Lin aa7a98ad9d update readme
PiperOrigin-RevId: 751168005
2025-04-24 15:50:09 -07:00
Yifan Wang a5bf6e3608 ADK changes
PiperOrigin-RevId: 751099184
2025-04-24 12:48:31 -07:00
Ankur Sharma f872577f68 Currently if a model calls a FunctionTool without all the mandatory parameters, the code will just break. This change basically adds the capability for the FunctionTool to identify if the model is missing required arguments, and in that case, instead of breaking the execution, it provides a error message to the model so it could fix the request and retry.
PiperOrigin-RevId: 751023475
2025-04-24 09:31:40 -07:00
Wei Sun (Jack) e6109b1dd6 Copybara import of the project:
--
005028831b2e0873414db62af9ec02ef47a670d2 by Wei Sun (Jack) <weisun@google.com>:

Excludes tests/unittests/tools/application_integration_tool/clients/test_connections_client.py from python-unit-tests.yml
--
42ed38ff814f1a4811468d78cf1872869279919d by Wei Sun (Jack) <weisun@google.com>:

reorder skipped tests in python-unit-tests.yml

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/368 from google:fix-unittests 42ed38ff814f1a4811468d78cf1872869279919d
PiperOrigin-RevId: 750782234
2025-04-23 17:35:34 -07:00
Google Team Member ca993277de ADK changes
PiperOrigin-RevId: 750763037
2025-04-23 16:28:57 -07:00
Wei Sun a49d339251 bump version number to 0.3.0.
PiperOrigin-RevId: 750661619
2025-04-23 11:22:54 -07:00
Wei Sun (Jack) 04e4c85b4e Merge pull request #355 from wyf7107/live-error-toast
fix: Add error toast message when live does not work with certain models
2025-04-22 22:26:38 -07:00
Yifan 3ad939d34c Copybara import of the project:
--
dc53678606 by Yifan Wang <wanyif@google.com>:

Update Google Search Tool display to the correct one

--
bbeb6525ea by Yifan Wang <wanyif@google.com>:

add license header to complied js file

--
db5ea6bc56 by Yifan Wang <wanyif@google.com>:

fix: Enable error toast when live does not work with certain models
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/355 from wyf7107:live-error-toast 2062aa38a7
PiperOrigin-RevId: 750449832
2025-04-22 22:09:59 -07:00
Yifan 2062aa38a7 Merge branch 'main' into live-error-toast 2025-04-22 21:19:43 -07:00
Yifan Wang db5ea6bc56 fix: Enable error toast when live does not work with certain models 2025-04-22 21:16:20 -07:00
Hangfei Lin 5c069cca8f chore: Update README.md (#353)
add instruction about our releases.
2025-04-22 18:18:44 -07:00
Hangfei Lin 22cab9e9a4 chore: Update README.md (#328)
* chore: Update README.md

chore: update readme for contributing guideline

* chore: Update CONTRIBUTING.md

chore: Update CONTRIBUTING.md

* Update CONTRIBUTING.md
2025-04-22 17:20:24 -07:00
Shangjie Chen a9da7a8fc3 feat: Add session_db_url to adk deploy option.
PiperOrigin-RevId: 750355535
2025-04-22 15:53:09 -07:00
Xiang (Sean) Zhou 956fb912e8 feat(auth)!: expose access_token and refresh_token at top level of auth credentails
BREAKING CHANGE: `token` attribute of OAuth2Auth credentials used to be a dict containing both access_token and refresh_token, given that may cause confusions, now we replace it with access_token and refresh_token at top level of the auth credentials

PiperOrigin-RevId: 750346172
2025-04-22 15:23:21 -07:00
Wei Sun 49d8c0fbb2 bump min version of google-genai sdk to latest.
PiperOrigin-RevId: 750324961
2025-04-22 14:17:27 -07:00
Yifan Wang 645402903a ADK changes
PiperOrigin-RevId: 750287732
2025-04-22 12:32:01 -07:00
Yifan c531bb6ef1 Merge branch 'main' into google-search-display 2025-04-22 12:18:57 -07:00
Yifan 7cc3167e54 Copybara import of the project:
--
dc53678606 by Yifan Wang <wanyif@google.com>:

Update Google Search Tool display to the correct one

--
bbeb6525ea by Yifan Wang <wanyif@google.com>:

add license header to complied js file

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/325 from wyf7107:google-search-display 353ff50611
PiperOrigin-RevId: 750284170
2025-04-22 12:17:25 -07:00
Yifan 353ff50611 Merge branch 'main' into google-search-display 2025-04-22 11:30:38 -07:00
Yifan Wang bbeb6525ea add license header to complied js file 2025-04-22 11:21:22 -07:00
Vignesh Iyer 0e9096d865 chore: add support for overriding skip_summarization in AgentTool (#324) 2025-04-22 09:41:31 -07:00
Vignesh Iyer 923d806637 Copybara import of the project:
--
94c7f9579c56cb20252fd61b5fe568f73d864679 by Vignesh Iyer <vgnshiyer@gmail.com>:

chore: add support for overriding `skip_summarization` in AgentTool
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/324 from vgnshiyer:main 94c7f9579c56cb20252fd61b5fe568f73d864679
PiperOrigin-RevId: 750060638
2025-04-21 23:24:25 -07:00
Yifan 463797be25 Merge branch 'main' into google-search-display 2025-04-21 20:53:06 -07:00
Yifan Wang dc53678606 Update Google Search Tool display to the correct one 2025-04-21 20:50:26 -07:00
Che Liu 21d2047ddc ADK changes
PiperOrigin-RevId: 749973427
2025-04-21 17:28:53 -07:00
Wei Sun a5f191650b chore: update the readme for a2a integration.
PiperOrigin-RevId: 749856734
2025-04-21 11:17:04 -07:00
Wei Sun 1e752b1378 chore: Fixes type hints in google_api_tool_set.py.
PiperOrigin-RevId: 749844560
2025-04-21 10:42:48 -07:00
Hangfei Lin 5ab43e804a chore: update the readme for a2a integration (#319)
chore: update the readme for a2a integration
2025-04-21 09:55:30 -07:00
Nilanjan De 220b327a73 chore: fix typos (#272)
Co-authored-by: Hangfei Lin <hangfei@google.com>
2025-04-21 09:26:02 -07:00
Nilanjan De 1664b45562 Copybara import of the project:
--
16994cb2d5d646341f5285ca71d72697d81d18fe by Nilanjan De <nilanjan.de@gmail.com>:

chore: fix typos
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/272 from n1lanjan:fix-typos a1ab655b08ec08c5dd2da71aab9a2386e3610e84
PiperOrigin-RevId: 749690489
2025-04-20 22:53:15 -07:00
Hangfei Lin 23f0383284 fix: The previous commit has a merge conflict. Fix it by adding this back.
The previous commit has a merge conflict. Fix it by adding this back.
2025-04-20 17:08:25 -07:00
Hangfei Lin f7b436a985 No public description
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/282 from hangfei:main 7b9c5e3bff76ed475fb57d45333a9ab135cac32d
PiperOrigin-RevId: 749616712
2025-04-20 16:05:06 -07:00
Wei Sun 2af777af6d No public description
PiperOrigin-RevId: 749409258
2025-04-19 16:34:44 -07:00
Shangjie Chen 32dc145ace No public description
PiperOrigin-RevId: 749399264
2025-04-19 15:16:19 -07:00
Wei Sun 6742ab9236 No public description
PiperOrigin-RevId: 749202950
2025-04-18 18:08:03 -07:00
Rasheedat atinuke jamiu daed456125 Fix AttributeError in run_live when using AgentTool (#274)
Co-authored-by: Hangfei Lin <hangfei@google.com>
2025-04-18 13:37:17 -07:00
Sumant Pangotra 27b214df3e Fixed Parameter required field and description 2025-04-18 03:49:59 +05:30
1033 changed files with 190487 additions and 9326 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"contextFileName": "AGENTS.md"
}
+8 -3
View File
@@ -7,18 +7,19 @@ assignees: ''
---
** Please make sure you read the contribution guide and file the issues in the rigth place. **
** Please make sure you read the contribution guide and file the issues in the right place. **
[Contribution guide.](https://google.github.io/adk-docs/contributing-guide/)
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Please share a minimal code and data to reproduce your problem.
Steps to reproduce the behavior:
1. Install '...'
2. Run '....'
3. Open '....'
4. See error
4. Provie error or stacktrace
**Expected behavior**
A clear and concise description of what you expected to happen.
@@ -27,9 +28,13 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- OS: [e.g. macOS, Linux, Windows]
- Python version(python -V):
- ADK version(pip show google-adk):
**Model Information:**
- Are you using LiteLLM: Yes/No
- Which model is being used(e.g. gemini-2.5-pro)
**Additional context**
Add any other context about the problem here.
+1 -1
View File
@@ -7,7 +7,7 @@ assignees: ''
---
** Please make sure you read the contribution guide and file the issues in the rigth place. **
** Please make sure you read the contribution guide and file the issues in the right place. **
[Contribution guide.](https://google.github.io/adk-docs/contributing-guide/)
**Is your feature request related to a problem? Please describe.**
+5
View File
@@ -0,0 +1,5 @@
releaseType: python
handleGHRelease: true
bumpMinorPreMajor: false
extraFiles:
- src/google/adk/version.py
+1
View File
@@ -0,0 +1 @@
enabled: true
@@ -0,0 +1,47 @@
name: Analyze New Release for ADK Docs Updates
on:
# Runs on every new release.
release:
types: [published]
# Manual trigger for testing and retrying.
workflow_dispatch:
jobs:
analyze-new-release-for-adk-docs-updates:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Load adk-bot SSH Private Key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.ADK_BOT_SSH_PRIVATE_KEY }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests google-adk
- name: Run Analyzing Script
env:
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_GENAI_USE_VERTEXAI: 0
DOC_OWNER: 'google'
CODE_OWNER: 'google'
DOC_REPO: 'adk-docs'
CODE_REPO: 'adk-python'
INTERACTIVE: 0
PYTHONPATH: contributing/samples/adk_documentation
run: python -m adk_release_analyzer.main
+113
View File
@@ -0,0 +1,113 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Check file contents"
on:
pull_request:
paths:
- '**.py'
jobs:
check-file-contents:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for logger pattern in all changed Python files
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "Changed Python files to check:"
echo "$CHANGED_FILES"
echo ""
# Check for 'logger = logging.getLogger(__name__)' in changed .py files.
# The grep command will exit with a non-zero status code if the pattern is not found.
# We invert the exit code with ! so the step succeeds if the pattern is NOT found.
set +e
FILES_WITH_FORBIDDEN_LOGGER=$(grep -lE 'logger = logging\.getLogger\(__name__\)' $CHANGED_FILES)
GREP_EXIT_CODE=$?
set -e
# grep exits with 0 if matches are found, 1 if no matches are found.
# A non-zero exit code other than 1 indicates an error.
if [ $GREP_EXIT_CODE -eq 0 ]; then
echo "❌ Found forbidden use of 'logger = logging.getLogger(__name__)'. Please use 'logger = logging.getLogger('google_adk.' + __name__)' instead."
echo "The following files contain the forbidden pattern:"
echo "$FILES_WITH_FORBIDDEN_LOGGER"
exit 1
elif [ $GREP_EXIT_CODE -eq 1 ]; then
echo "✅ No instances of 'logger = logging.getLogger(__name__)' found in changed Python files."
fi
else
echo "✅ No relevant Python files found."
fi
- name: Check for import pattern in certain changed Python files
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' | grep -v -E '__init__.py$|version.py$|tests/.*|contributing/samples/' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "Changed Python files to check:"
echo "$CHANGED_FILES"
echo ""
# Use grep -L to find files that DO NOT contain the pattern.
# This command will output a list of non-compliant files.
FILES_MISSING_IMPORT=$(grep -L 'from __future__ import annotations' $CHANGED_FILES || true)
# Check if the list of non-compliant files is empty
if [ -z "$FILES_MISSING_IMPORT" ]; then
echo "✅ All modified Python files include 'from __future__ import annotations'."
exit 0
else
echo "❌ The following files are missing 'from __future__ import annotations':"
echo "$FILES_MISSING_IMPORT"
echo "This import is required to allow forward references in type annotations without quotes."
exit 1
fi
else
echo "✅ No relevant Python files found."
fi
- name: Check for import from cli package in certain changed Python files
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' | grep -v -E 'cli/.*|tests/.*|contributing/samples/' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "Changed Python files to check:"
echo "$CHANGED_FILES"
echo ""
set +e
FILES_WITH_FORBIDDEN_IMPORT=$(grep -lE '^from.*cli.*import.*$' $CHANGED_FILES)
GREP_EXIT_CODE=$?
set -e
if [[ $GREP_EXIT_CODE -eq 0 ]]; then
echo "❌ Do not import from the cli package outside of the cli package. If you need to reuse the code elsewhere, please move the code outside of the cli package."
echo "The following files contain the forbidden pattern:"
echo "$FILES_WITH_FORBIDDEN_IMPORT"
exit 1
else
echo "✅ No instances of importing from the cli package found in relevant changed Python files."
fi
else
echo "✅ No relevant Python files found."
fi
@@ -0,0 +1,54 @@
name: ADK Answering Agent for Discussions
on:
discussion:
types: [created]
discussion_comment:
types: [created]
jobs:
agent-answer-questions:
if: >-
(github.event_name == 'discussion' && github.event.discussion.category.name == 'Q&A') ||
(github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@adk-bot') && github.event.sender.login != 'adk-bot')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Authenticate to Google Cloud
id: auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ADK_GCP_SA_KEY }}'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install google-adk google-cloud-discoveryengine
- name: Run Answering Script
env:
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
ADK_GCP_SA_KEY: ${{ secrets.ADK_GCP_SA_KEY }}
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
VERTEXAI_DATASTORE_ID: ${{ secrets.VERTEXAI_DATASTORE_ID }}
GEMINI_API_DATASTORE_ID: ${{ secrets.GEMINI_API_DATASTORE_ID }}
GOOGLE_GENAI_USE_VERTEXAI: 1
OWNER: 'google'
REPO: 'adk-python'
INTERACTIVE: 0
PYTHONPATH: contributing/samples
run: |
# Write discussion data to temporary file to avoid secret masking issues
cat > /tmp/discussion.json << 'EOF'
${{ toJson(github.event.discussion) }}
EOF
python -m adk_answering_agent.main --discussion-file /tmp/discussion.json
+69
View File
@@ -0,0 +1,69 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Check sorting of imports
on:
pull_request:
paths:
- '**.py'
- 'pyproject.toml'
jobs:
isort-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install isort
run: |
pip install isort
- name: Run isort on changed files
id: run_isort
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "Changed Python files:"
echo "$CHANGED_FILES"
echo ""
FORMATTED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
# Run isort --check
set +e
isort --check $CHANGED_FILES
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
echo ""
echo "❌ isort check failed!"
echo "👉 To fix import order, run locally:"
echo ""
echo " isort $FORMATTED_FILES"
echo ""
exit $RESULT
fi
else
echo "No Python files changed. Skipping isort check."
fi
+45
View File
@@ -0,0 +1,45 @@
name: ADK Pull Request Triaging Agent
on:
pull_request_target:
types: [opened, reopened, edited]
workflow_dispatch:
inputs:
pr_number:
description: 'The Pull Request number to triage'
required: true
type: 'string'
jobs:
agent-triage-pull-request:
if: github.event_name == 'workflow_dispatch' || !contains(github.event.pull_request.labels.*.name, 'google-contributor')
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests google-adk
- name: Run Triaging Script
env:
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_GENAI_USE_VERTEXAI: 0
OWNER: 'google'
REPO: 'adk-python'
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}
INTERACTIVE: ${{ vars.PR_TRIAGE_INTERACTIVE }}
PYTHONPATH: contributing/samples
run: python -m adk_pr_triaging_agent.main
+69
View File
@@ -0,0 +1,69 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Check Pyink Formatting
on:
pull_request:
paths:
- '**.py'
- 'pyproject.toml'
jobs:
pyink-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pyink
run: |
pip install pyink
- name: Run pyink on changed files
id: run_pyink
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
if [ -n "$CHANGED_FILES" ]; then
echo "Changed Python files:"
echo "$CHANGED_FILES"
echo ""
FORMATTED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
# Run pyink --check
set +e
pyink --check --diff --config pyproject.toml $CHANGED_FILES
RESULT=$?
set -e
if [ $RESULT -ne 0 ]; then
echo ""
echo "❌ Pyink formatting check failed!"
echo "👉 To fix formatting, run locally:"
echo ""
echo " pyink --config pyproject.toml $FORMATTED_FILES"
echo ""
exit $RESULT
fi
else
echo "No Python files changed. Skipping pyink check."
fi
+29 -7
View File
@@ -1,3 +1,17 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Python Unit Tests
on:
@@ -11,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
@@ -22,18 +36,26 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
uv venv .venv
source .venv/bin/activate
uv sync --extra test --extra eval
uv sync --extra test --extra eval --extra a2a
- name: Run unit tests with pytest
run: |
source .venv/bin/activate
pytest tests/unittests \
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py \
--ignore=tests/unittests/artifacts/test_artifact_service.py
if [[ "${{ matrix.python-version }}" == "3.9" ]]; then
pytest tests/unittests \
--ignore=tests/unittests/a2a \
--ignore=tests/unittests/tools/mcp_tool \
--ignore=tests/unittests/artifacts/test_artifact_service.py \
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
else
pytest tests/unittests \
--ignore=tests/unittests/artifacts/test_artifact_service.py \
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
fi
+42
View File
@@ -0,0 +1,42 @@
name: ADK Issue Triaging Agent
on:
issues:
types: [opened, reopened]
jobs:
agent-triage-issues:
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests google-adk
- name: Run Triaging Script
env:
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_GENAI_USE_VERTEXAI: 0
OWNER: 'google'
REPO: 'adk-python'
INTERACTIVE: 0
EVENT_NAME: ${{ github.event_name }} # 'issues', 'schedule', etc.
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_COUNT_TO_PROCESS: '3' # Process 3 issues at a time on schedule
PYTHONPATH: contributing/samples
run: python -m adk_triaging_agent.main
@@ -0,0 +1,51 @@
name: Upload ADK Docs to Vertex AI Search
on:
# Runs once per day at 16:00 UTC
schedule:
- cron: '00 16 * * *'
# Manual trigger for testing and fixing
workflow_dispatch:
jobs:
upload-adk-docs-to-vertex-ai-search:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Clone adk-docs repository
run: git clone https://github.com/google/adk-docs.git /tmp/adk-docs
- name: Clone adk-python repository
run: git clone https://github.com/google/adk-python.git /tmp/adk-python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Authenticate to Google Cloud
id: auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.ADK_GCP_SA_KEY }}'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install google-adk markdown google-cloud-storage google-cloud-discoveryengine
- name: Run Answering Script
env:
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
VERTEXAI_DATASTORE_ID: ${{ secrets.VERTEXAI_DATASTORE_ID }}
GOOGLE_GENAI_USE_VERTEXAI: 1
GCS_BUCKET_NAME: ${{ secrets.GCS_BUCKET_NAME }}
ADK_DOCS_ROOT_PATH: /tmp/adk-docs
ADK_PYTHON_ROOT_PATH: /tmp/adk-python
PYTHONPATH: contributing/samples
run: python -m adk_answering_agent.upload_docs_to_vertex_ai_search
+2 -1
View File
@@ -82,6 +82,7 @@ log/
.env.development.local
.env.test.local
.env.production.local
uv.lock
# Google Cloud specific
.gcloudignore
@@ -96,4 +97,4 @@ site/
Thumbs.db
*.bak
*.tmp
*.temp
*.temp
+221
View File
@@ -0,0 +1,221 @@
# Gemini CLI / Gemini Code Assist Context
This document provides context for the Gemini CLI and Gemini Code Assist to understand the project and assist with development.
## Project Overview
The Agent Development Kit (ADK) is an open-source, code-first Python toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic, deployment-agnostic, and is built for compatibility with other frameworks. ADK was designed to make agent development feel more like software development, to make it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.
## Project Architecture
Please refer to [ADK Project Overview and Architecture](https://github.com/google/adk-python/blob/main/contributing/adk_project_overview_and_architecture.md) for details.
### ADK Live (Bidi-streaming)
- ADK live feature can be accessed from runner.run_live(...) and corresponding FAST api endpoint.
- ADK live feature is built on top of [Gemini Live API](https://cloud.google.com/vertex-ai/generative-ai/docs/live-api). We integrate Gemini Live API through [GenAI SDK](https://github.com/googleapis/python-genai).
- ADK live related configs are in [run_config.py](https://github.com/google/adk-python/blob/main/src/google/adk/agents/run_config.py).
- ADK live under multi-agent scenario: we convert the audio into text. This text will be passed to next agent as context.
- Most logics are in [base_llm_flow.py](https://github.com/google/adk-python/blob/main/src/google/adk/flows/llm_flows/base_llm_flow.py) and [gemini_llm_connection.py](https://github.com/google/adk-python/blob/main/src/google/adk/models/gemini_llm_connection.py).
- Input transcription and output transcription should be added to session as Event.
- User audio or model audio should be saved into artifacts with a reference in Event to it.
- Tests are in [tests/unittests/streaming](https://github.com/google/adk-python/tree/main/tests/unittests/streaming).
## ADK: Style Guides
### Python Style Guide
The project follows the Google Python Style Guide. Key conventions are enforced using `pylint` with the provided `pylintrc` configuration file. Here are some of the key style points:
* **Indentation**: 2 spaces.
* **Line Length**: Maximum 80 characters.
* **Naming Conventions**:
* `function_and_variable_names`: `snake_case`
* `ClassNames`: `CamelCase`
* `CONSTANTS`: `UPPERCASE_SNAKE_CASE`
* **Docstrings**: Required for all public modules, functions, classes, and methods.
* **Imports**: Organized and sorted.
* **Error Handling**: Specific exceptions should be caught, not general ones like `Exception`.
### Autoformat
We have autoformat.sh to help solve import organize and formatting issues.
```bash
# Run in open_source_workspace/
$ ./autoformat.sh
```
### In ADK source
Below styles applies to the ADK source code (under `src/` folder of the Github.
repo).
#### Use relative imports
```python
# DO
from ..agents.llm_agent import LlmAgent
# DON'T
from google.adk.agents.llm_agent import LlmAgent
```
#### Import from module, not from `__init__.py`
```python
# DO
from ..agents.llm_agent import LlmAgent
# DON'T
from ..agents import LlmAgent # import from agents/__init__.py
```
#### Always do `from __future__ import annotations`
```python
# DO THIS, right after the open-source header.
from __future__ import annotations
```
Like below:
```python
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
# ... the rest of the file.
```
This allows us to forward-reference a class without quotes.
Check out go/pep563 for details.
### In ADK tests
#### Use absolute imports
In tests, we use `google.adk` same as how our users uses.
```python
# DO
from google.adk.agents.llm_agent import LlmAgent
# DON'T
from ..agents.llm_agent import LlmAgent
```
## ADK: Local testing
### Unit tests
Run below command:
```bash
$ pytest tests/unittests
```
## Docstring and comments
### Comments - Explaining the Why, Not the What
Philosophy: Well-written code should be largely self-documenting. Comments
serve a different purpose: they should explain the complex algorithms,
non-obvious business logic, or the rationale behind a particular implementation
choice—the things the code cannot express on its own. Avoid comments that
merely restate what the code does (e.g., # increment i above i += 1).
Style: Comments should be written as complete sentences. Block comments must
begin with a # followed by a single space.
## Versioning
ADK adherence to Semantic Versioning 2.0.0
Core Principle: The adk-python project strictly adheres to the Semantic
Versioning 2.0.0 specification. All release versions will follow the
MAJOR.MINOR.PATCH format.
### Breaking Change
A breaking change is any modification that introduces backward-incompatible
changes to the public API. In the context of the ADK, this means a change that
could force a developer using the framework to alter their existing code to
upgrade to the new version. The public API is not limited to just the Python
function and class signatures; it also encompasses data schemas for stored
information (like evaluation datasets), the command-line interface (CLI),
and the data format used for server communications.
### Public API Surface Definition
The "public API" of ADK is a broad contract that extends beyond its Python
function signatures. A breaking change in any of the following areas can
disrupt user workflows and the wider ecosystem of agents and tools built with
ADK. The analysis of the breaking changes introduced in v1.0.0 demonstrates the
expansive nature of this contract. For the purposes of versioning, the ADK
Public API Surface is defined as:
- All public classes, methods, and functions in the google.adk namespace.
- The names, required parameters, and expected behavior of all built-in Tools
(e.g., google_search, BuiltInCodeExecutor).
- The structure and schema of persisted data, including Session data, Memory,
and Evaluation datasets.
- The JSON request/response format of the ADK API server(FastAPI server)
used by adk web, including field casing conventions.
- The command-line interface (CLI) commands, arguments, and flags (e.g., adk deploy).
- The expected file structure for agent definitions that are loaded by the
framework (e.g., the agent.py convention).
#### Checklist for Breaking Changes:
The following changes are considered breaking and necessitate a MAJOR version
bump.
- API Signature Change: Renaming, removing, or altering the required parameters
of any public class, method, or function (e.g., the removal of the list_events
method from BaseSessionService).
- Architectural Shift: A fundamental change to a core component's behavior
(e.g., making all service methods async, which requires consumers to use await).
- Data Schema Change: A non-additive change to a persisted data schema that
renders old data unreadable or invalid (e.g., the redesign of the
MemoryService and evaluation dataset schemas).
- Tool Interface Change: Renaming a built-in tool, changing its required
parameters, or altering its fundamental purpose (e.g., replacing
BuiltInCodeExecutionTool with BuiltInCodeExecutor and moving it from the tools
parameter to the code_executor parameter of an Agent).
- Configuration Change: Altering the required structure of configuration files
or agent definition files that the framework loads (e.g., the simplification
of the agent.py structure for MCPToolset).
- Wire Format Change: Modifying the data format for API server interactions
(e.g., the switch from snake_case to camelCase for all JSON payloads).
- Dependency Removal: Removing support for a previously integrated third-party
library or tool type.
## Commit Message Format
- Please use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
format.
- If it's not a breaking change, please add #non-breaking tag. If it's a
breaking change, please add #breaking.
+930 -3
View File
File diff suppressed because it is too large Load Diff
+207 -3
View File
@@ -2,6 +2,21 @@
We'd love to accept your patches and contributions to this project.
- [How to contribute](#how-to-contribute)
- [Before you begin](#before-you-begin)
- [Sign our Contributor License Agreement](#sign-our-contributor-license-agreement)
- [Review our community guidelines](#review-our-community-guidelines)
- [Contribution workflow](#contribution-workflow)
- [Finding Issues to Work On](#finding-issues-to-work-on)
- [Requirement for PRs](#requirement-for-prs)
- [Large or Complex Changes](#large-or-complex-changes)
- [Testing Requirements](#testing-requirements)
- [Unit Tests](#unit-tests)
- [Manual End-to-End (E2E) Tests](#manual-end-to-end-e2e-tests)
- [Documentation](#documentation)
- [Development Setup](#development-setup)
- [Code reviews](#code-reviews)
## Before you begin
### Sign our Contributor License Agreement
@@ -23,11 +38,200 @@ sign a new one.
This project follows
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
## Contribution process
### Code reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
information on using pull requests.
## Contribution workflow
### Finding Issues to Work On
- Browse issues labeled **`good first issue`** (newcomer-friendly) or **`help
wanted`** (general contributions).
- For other issues, please kindly ask before contributing to avoid
duplication.
### Requirement for PRs
- All PRs, other than small documentation or typo fixes, should have a Issue
associated. If not, please create one.
- Small, focused PRs. Keep changes minimal—one concern per PR.
- For bug fixes or features, please provide logs or screenshot after the fix
is applied to help reviewers better understand the fix.
- Please include a `testing plan` section in your PR to talk about how you
will test. This will save time for PR review. See `Testing Requirements`
section for more details.
### Large or Complex Changes
For substantial features or architectural revisions:
- Open an Issue First: Outline your proposal, including design considerations
and impact.
- Gather Feedback: Discuss with maintainers and the community to ensure
alignment and avoid duplicate work
### Testing Requirements
To maintain code quality and prevent regressions, all code changes must include
comprehensive tests and verifiable end-to-end (E2E) evidence.
#### Unit Tests
Please add or update unit tests for your change. Please include a summary of
passed `pytest` results.
Requirements for unit tests:
- **Coverage:** Cover new features, edge cases, error conditions, and typical
use cases.
- **Location:** Add or update tests under `tests/unittests/`, following
existing naming conventions (e.g., `test_<module>_<feature>.py`).
- **Framework:** Use `pytest`. Tests should be:
- Fast and isolated.
- Written clearly with descriptive names.
- Free of external dependencies (use mocks or fixtures as needed).
- **Quality:** Aim for high readability and maintainability; include
docstrings or comments for complex scenarios.
#### Manual End-to-End (E2E) Tests
Manual E2E tests ensure integrated flows work as intended. Your tests should
cover all scenarios. Sometimes, it's also good to ensure relevant functionality
is not impacted.
Depending on your change:
- **ADK Web:**
- Use the `adk web` to verify functionality.
- Capture and attach relevant screenshots demonstrating the UI/UX changes
or outputs.
- Label screenshots clearly in your PR description.
- **Runner:**
- Provide the testing setup. For example, the agent definition, and the
runner setup.
- Execute the `runner` tool to reproduce workflows.
- Include the command used and console output showing test results.
- Highlight sections of the log that directly relate to your change.
### Documentation
For any changes that impact user-facing documentation (guides, API reference,
tutorials), please open a PR in the
[adk-docs](https://github.com/google/adk-docs) repository to update relevant
part before or alongside your code PR.
## Development Setup
1. **Clone the repository:**
```shell
gh repo clone google/adk-python
cd adk-python
```
2. **Install uv:**
Check out
[uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
3. **Create and activate a virtual environment:**
**NOTE**: ADK supports Python 3.9+. Python 3.11 and above is strongly
recommended.
Create a workspace venv using uv.
```shell
uv venv --python "python3.11" ".venv"
```
Activate the workspace venv.
```shell
source .venv/bin/activate
```
**windows** `shell source .\.venv\Scripts\activate`
4. **Install dependencies:**
```shell
uv sync --all-extras
```
**NOTE**: for convenience, installing all extra deps as a starting point.
5. **Run unit tests:**
```shell
pytest ./tests/unittests
```
NOTE: for accurate repro of test failure, only include `test`, `eval` and
`a2a` as extra dependencies.
```shell
uv sync --extra test --extra eval --extra a2a
pytest ./tests/unittests
```
6. **Auto-format the code:**
**NOTE**: We use `isort` and `pyink` for styles. Use the included
autoformat.sh to auto-format.
```shell
./autoformat.sh
```
7. **Build the wheel file:**
```shell
uv build
```
8. **Test the locally built wheel file:** Have a simple testing folder setup as
mentioned in the
[quickstart](https://google.github.io/adk-docs/get-started/quickstart/).
Then following below steps to test your changes:
Create a clean venv and activate it:
```shell
VENV_PATH=~/venvs/adk-quickstart
```
```shell
command -v deactivate >/dev/null 2>&1 && deactivate
```
```shell
rm -rf $VENV_PATH \
&& python3 -m venv $VENV_PATH \
&& source $VENV_PATH/bin/activate
```
Install the locally built wheel file:
```shell
pip install dist/google_adk-<version>-py3-none-any.whl
```
## Contributing Resources
[Contributing folder](https://github.com/google/adk-python/tree/main/contributing)
has resources that is helpful for contributors.
## Vibe Coding
If you want to contribute by leveraging viber coding, the AGENTS.md
(https://github.com/google/adk-python/tree/main/AGENTS.md) could be used as
context to your LLM.
+82 -18
View File
@@ -1,8 +1,10 @@
# Agent Development Kit (ADK)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![PyPI](https://img.shields.io/pypi/v/google-adk)](https://pypi.org/project/google-adk/)
[![Python Unit Tests](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml/badge.svg)](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml)
[![r/agentdevelopmentkit](https://img.shields.io/badge/Reddit-r%2Fagentdevelopmentkit-FF4500?style=flat&logo=reddit&logoColor=white)](https://www.reddit.com/r/agentdevelopmentkit/)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/google/adk-python)
<html>
<h2 align="center">
@@ -13,19 +15,54 @@
</h3>
<h3 align="center">
Important Links:
<a href="https://google.github.io/adk-docs/">Docs</a> &
<a href="https://github.com/google/adk-samples">Samples</a>.
<a href="https://google.github.io/adk-docs/">Docs</a>,
<a href="https://github.com/google/adk-samples">Samples</a>,
<a href="https://github.com/google/adk-java">Java ADK</a> &
<a href="https://github.com/google/adk-web">ADK Web</a>.
</h3>
</html>
Agent Development Kit (ADK) is designed for developers seeking fine-grained
control and flexibility when building advanced AI agents that are tightly
integrated with services in Google Cloud. It allows you to define agent
behavior, orchestration, and tool use directly in code, enabling robust
debugging, versioning, and deployment anywhere from your laptop to the cloud.
Agent Development Kit (ADK) is a flexible and modular framework for developing and deploying AI agents. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic, deployment-agnostic, and is built for compatibility with other frameworks. ADK was designed to make agent development feel more like software development, to make it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.
---
## 🔥 ADK's very first community call on Oct 15
Join our ADK Community Call! Our first virtual community call is on Oct 15!
Meet our team, and talk with us about our roadmap and how to contribute.
First Call Details:
Topic: ADK Roadmap
Date: October 15, 2025
Time: 9:30-10:30am PST
Meeting link:
[Join the call](http://meet.google.com/gjm-gfim-ctz)
Add to your calendar
[Event calendar invite](https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MDUydWo1dHV1dHFtNzJuM3E0bmEyMW12ZnZfMjAyNTEwMTVUMTYzMDAwWiBjXzljNWVjODhhMmQyYWU5YjY5Mzk4ODU1MGZkNDA5MjVmYjgxYjM4MTI1NGNjYTgzNmRkMjMwNzRiMjNmYzcyZDVAZw&tmsrc=c_9c5ec88a2d2ae9b693988550fd40925fb81b381254cca836dd23074b23fc72d5%40group.calendar.google.com), [.ics file](https://calendar.google.com/calendar/ical/c_9c5ec88a2d2ae9b693988550fd40925fb81b381254cca836dd23074b23fc72d5%40group.calendar.google.com/public/basic.ics), [ADK community calendar](https://calendar.google.com/calendar/embed?src=c_9c5ec88a2d2ae9b693988550fd40925fb81b381254cca836dd23074b23fc72d5%40group.calendar.google.com&ctz=America%2FLos_Angeles), [ADK Community Call RSVP](https://google.qualtrics.com/jfe/form/SV_3K0RJZ64H1BexqS)
Agenda:
[Julia] ADK Roadmap
[ Bo & Hangfei] Eng Deep Dive: Context Caching
[Kris] How to Contribute
[Shubham] Upcoming Events
---
## 🔥 What's new
- **Context compaction**: Supports context compaction to reduce context length. Here is a [sample](https://github.com/google/adk-python/blob/main/contributing/samples/hello_world_app/agent.py#L156) and [compaction config](https://github.com/google/adk-python/blob/main/src/google/adk/apps/app.py#L51).
- **Resumability**: Support pause and resume an invocation in ADK.
- **ReflectRetryToolPlugin**: Add [`ReflectRetryToolPlugin`](https://github.com/google/adk-python/blob/main/src/google/adk/plugins/reflect_retry_tool_plugin.py) to reflect from errors and retry with different arguments when tool errors.
- **Search tool**: Support using Google built-in search and built-in `VertexAiSearchTool` with other tools in the same agent.
## ✨ Key Features
@@ -36,21 +73,47 @@ debugging, versioning, and deployment anywhere from your laptop to the cloud
- **Code-First Development**: Define agent logic, tools, and orchestration
directly in Python for ultimate flexibility, testability, and versioning.
- **Agent Config**: Build agents without code. Check out the
[Agent Config](https://google.github.io/adk-docs/agents/config/) feature.
- **Tool Confirmation**: A [tool confirmation flow(HITL)](https://google.github.io/adk-docs/tools/confirmation/) that can guard tool execution with explicit confirmation and custom input.
- **Modular Multi-Agent Systems**: Design scalable applications by composing
multiple specialized agents into flexible hierarchies.
- **Deploy Anywhere**: Easily containerize and deploy agents on Cloud Run or
scale seamlessly with Vertex AI Agent Engine.
## 🤖 Agent2Agent (A2A) Protocol and ADK Integration
For remote agent-to-agent communication, ADK integrates with the
[A2A protocol](https://github.com/google-a2a/A2A/).
See this [example](https://github.com/a2aproject/a2a-samples/tree/main/samples/python/agents)
for how they can work together.
## 🚀 Installation
You can install the ADK using `pip`:
### Stable Release (Recommended)
You can install the latest stable version of ADK using `pip`:
```bash
pip install google-adk
```
The release cadence is roughly bi-weekly.
This version is recommended for most users as it represents the most recent official release.
### Development Version
Bug fixes and new features are merged into the main branch on GitHub first. If you need access to changes that haven't been included in an official PyPI release yet, you can install directly from the main branch:
```bash
pip install git+https://github.com/google/adk-python.git@main
```
Note: The development version is built directly from the latest code commits. While it includes the newest fixes and features, it may also contain experimental changes or bugs not present in the stable release. Use it primarily for testing upcoming changes or accessing critical fixes before they are officially released.
## 📚 Documentation
Explore the full documentation for detailed guides on building, evaluating, and
@@ -68,7 +131,7 @@ from google.adk.tools import google_search
root_agent = Agent(
name="search_assistant",
model="gemini-2.0-flash", # Or your preferred Gemini model
model="gemini-2.5-flash", # Or your preferred Gemini model
instruction="You are a helpful assistant. Answer user questions using Google Search when needed.",
description="An assistant that can search the web.",
tools=[google_search]
@@ -83,13 +146,13 @@ Define a multi-agent system with coordinator agent, greeter agent, and task exec
from google.adk.agents import LlmAgent, BaseAgent
# Define individual agents
greeter = LlmAgent(name="greeter", model="gemini-2.0-flash", ...)
task_executor = LlmAgent(name="task_executor", model="gemini-2.0-flash", ...)
greeter = LlmAgent(name="greeter", model="gemini-2.5-flash", ...)
task_executor = LlmAgent(name="task_executor", model="gemini-2.5-flash", ...)
# Create parent agent and assign children via sub_agents
coordinator = LlmAgent(
name="Coordinator",
model="gemini-2.0-flash",
model="gemini-2.5-flash",
description="I coordinate greetings and tasks.",
sub_agents=[ # Assign sub_agents here
greeter,
@@ -112,19 +175,20 @@ adk eval \
samples_for_testing/hello_world/hello_world_eval_set_001.evalset.json
```
## 🤝 Contributing
We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our [**Contributing Guidelines**](./CONTRIBUTING.md) to get started.
We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
- [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide/).
- Then if you want to contribute code, please read [Code Contributing Guidelines](./CONTRIBUTING.md) to get started.
## Vibe Coding
If you are to develop agent via vibe coding the [llms.txt](./llms.txt) and the [llms-full.txt](./llms-full.txt) can be used as context to LLM. While the former one is a summarized one and the later one has the full information in case your LLM has big enough context window.
## 📄 License
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
## Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the [Service Specific Terms](https://cloud.google.com/terms/service-terms#1). Pre-GA features are available "as is" and might have limited support. For more information, see the [launch stage descriptions](https://cloud.google.com/products?hl=en#product-launch-stages).
---
*Happy Agent Building!*
Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 KiB

After

Width:  |  Height:  |  Size: 413 KiB

Some files were not shown because too many files have changed in this diff Show More