Compare commits

..

482 Commits

Author SHA1 Message Date
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
Hangfei Lin aabfde56e4 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-30 11:33:24 -07:00
Jeffrey Mak f2b9e72f82 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-17 16:57:00 -04:00
Jeffrey Mak 3263a97999 Merge branch 'main' into fix/missing-path-level-parameters 2025-05-14 10:57:06 -04: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
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
599 changed files with 106776 additions and 4772 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"contextFileName": "AGENTS.md"
}
+3
View File
@@ -31,5 +31,8 @@ If applicable, add screenshots to help explain your problem.
- Python version(python -V):
- ADK version(pip show google-adk):
**Model Information:**
For example, which model is being used.
**Additional context**
Add any other context about the problem here.
+1 -1
View File
@@ -70,7 +70,7 @@ jobs:
# 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)
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
@@ -0,0 +1,46 @@
name: ADK Answering Agent for Discussions
on:
discussion:
types: [created]
jobs:
agent-answer-questions:
if: github.event.discussion.category.name == 'Q&A'
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
DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
PYTHONPATH: contributing/samples
run: python -m adk_answering_agent.main
+38
View File
@@ -0,0 +1,38 @@
name: ADK Pull Request Triaging Agent
on:
pull_request_target:
types: [opened, reopened, edited]
jobs:
agent-triage-pull-request:
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 }}
INTERACTIVE: ${{ vars.PR_TRIAGE_INTERACTIVE }}
PYTHONPATH: contributing/samples
run: python -m adk_pr_triaging_agent.main
+15 -7
View File
@@ -25,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
@@ -36,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/artifacts/test_artifact_service.py \
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.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
+44
View File
@@ -0,0 +1,44 @@
name: ADK Issue Triaging Agent
on:
issues:
types: [opened, reopened]
schedule:
- cron: '0 */6 * * *' # every 6h
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
+1
View File
@@ -82,6 +82,7 @@ log/
.env.development.local
.env.test.local
.env.production.local
uv.lock
# Google Cloud specific
.gcloudignore
+219
View File
@@ -0,0 +1,219 @@
# 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).
- 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.
+338
View File
@@ -1,5 +1,343 @@
# Changelog
## [1.11.0](https://github.com/google/adk-python/compare/v1.10.0...v1.11.0) (2025-08-14)
### Features
* [Tools] Support adding prefix to tool names returned by toolset ([ebd726f](https://github.com/google/adk-python/commit/ebd726f1f5e0a76f383192cace4a80a83204325b))
* [Eval] Expose `print_detailed_results` param to `AgentEvaluator.evaluate` ([7e08808](https://github.com/google/adk-python/commit/7e0880869b340e9a5e0d68d6936219e64ab41212))
* [Tools] Add Spanner toolset (breaking change to BigQueryTool, consolidating into generic GoogleTool) ([1fc8d20](https://github.com/google/adk-python/commit/1fc8d20ae88451b7ed764aa86c17c3cdfaffa1cf))
* [Core] Support both output_schema and tools at the same time in LlmAgent([sample](https://github.com/google/adk-python/tree/main/contributing/samples/output_schema_with_tools)) ([af63567](https://github.com/google/adk-python/commit/af635674b5d3c128cf21737056e091646283aeb7))
### Bug Fixes
* A2A RPC URL got overriden by host and port param of adk api server ([52284b1](https://github.com/google/adk-python/commit/52284b1bae561e0d6c93c9d3240a09f210551b97))
* Aclose all async generators to fix OTel tracing context ([a30c63c](https://github.com/google/adk-python/commit/a30c63c5933a770b960b08a6e2f8bf13eece8a22))
* Use PreciseTimestamp for create and update time in database session service to improve precision ([585141e](https://github.com/google/adk-python/commit/585141e0b7dda20abb024c7164073862c8eea7ae))
* Ignore AsyncGenerator return types in function declarations ([e2518dc](https://github.com/google/adk-python/commit/e2518dc371fe77d7b30328d8d6f5f864176edeac))
* Make all subclass of BaseToolset to call parent constructor ([8c65967](https://github.com/google/adk-python/commit/8c65967cdc2dc79fa925ff49a2a8d67c2a248fa9))
* Path parameter extraction for complex Google API endpoints ([54680ed](https://github.com/google/adk-python/commit/54680edf3cac7477c281680ec988c0a207c0915d))
* Docstring concatenation in 3.13 ([88f759a](https://github.com/google/adk-python/commit/88f759a941c95beef0571f36f8e7a34f27971ba8))
* Lazy load retrieval tools and prompt users to install extensions if import failed ([9478a31](https://github.com/google/adk-python/commit/9478a31bf2257f0b668ae7eb91a10863e87c7bed))
* Incorrect logic in LlmRequest.append_tools and make BaseTool to call it ([b4ce3b1](https://github.com/google/adk-python/commit/b4ce3b12d109dd0386f4985fc4b27d5b93787532))
* Creates an InMemoryMemoryService within the EvaluationGenerator ([e4d54b6](https://github.com/google/adk-python/commit/e4d54b66b38ed334ca92c3bb1a83aca01b19e490))
* Uncomment OTel tracing in base_llm_flow.py ([9cfe433](https://github.com/google/adk-python/commit/9cfe43334ae50f814fed663cca7cbe330e663b8c))
### Improvements
* Added upper version bounds to dependencies in "pyproject.toml" ([a74d334](https://github.com/google/adk-python/commit/a74d3344bc19e587c5e9f55f3c90fa9d22c478d8))
* Update python-version in .github/workflows/python-unit-tests.yml to \["3.9", "3.10", "3.11", "3.12", "3.13"] ([ddf2e21](https://github.com/google/adk-python/commit/ddf2e2194b49667c8e91b4a6afde694474674250))
* Update comment to reference "Streamable HTTP Client" ([c52f956](https://github.com/google/adk-python/commit/c52f9564330f0c00d82338cc58df28cb22400b6f))
* Remove logging that contains full event data from DatabaseSessionService ([bb3735c](https://github.com/google/adk-python/commit/bb3735c9cab1baa1af2cc22981af3b3984ddfe15))
* Add the missing env variables in discussion_answering.yml ([a09a5e6](https://github.com/google/adk-python/commit/a09a5e67aa95cf71b51732ab445232dc4815d83d))
* Add Gemini API docs as a new datastore for the ADK Answering Agent ([5fba196](https://github.com/google/adk-python/commit/5fba1963c31eec512558325c480812ccb919a7bb))
* Add the missing license header for some sample agents' files ([7d2cb65](https://github.com/google/adk-python/commit/7d2cb654f0d64728741b5de733e572c44c8a5b04))
* Add docstring to clarify the behavior of preload memory tool ([88114d7](https://github.com/google/adk-python/commit/88114d7c739ca6a1b9bd19d40ed7160e53054a89))
* Add experimental messages for a2a related API ([d0b3b5d](https://github.com/google/adk-python/commit/d0b3b5d857d8105c689bd64204e367102a67eded))
* Fixes generate_image sample ([d674178](https://github.com/google/adk-python/commit/d674178a0535be3769edbf6af5a3d8cd3d47fcd2))
* Make all FastAPI endpoints async ([7f12387](https://github.com/google/adk-python/commit/7f12387eb19b9335a64b80df00609c3c765480e7))
* Group FastAPI endpoints with tags ([c323de5](https://github.com/google/adk-python/commit/c323de5c692223e55372c3797e62d4752835774d))
* Allow implementations to skip defining a close method on Toolset ([944e39e](https://github.com/google/adk-python/commit/944e39ec2a7c9ad7f20c08fd66bf544de94a23d7))
* Add sample agent to test support of output_schema and tools at the same time for gemini model ([f2005a2](https://github.com/google/adk-python/commit/f2005a20267e1ee8581cb79c37aa55dc8e18c0ea))
* Add Github workflow config for uploading ADK docs to knowledge store ([5900273](https://github.com/google/adk-python/commit/59002734559d49a46940db9822b9c5f490220a8c))
* Update ADK Answering agent to reference doc site instead of adk-docs repo ([b5a8bad](https://github.com/google/adk-python/commit/b5a8bad170e271b475385dac440c7983ed207df8))
### Documentation
* Fixes tool_functions, which is a config-based sample for using tools ([c5af44c](https://github.com/google/adk-python/commit/c5af44cfc0224e2f07ddc7a649a8561e7141fcdc))
* Add workflow_triage sample for multi-agent request orchestration ([e295feb](https://github.com/google/adk-python/commit/e295feb4c67cbe8ac4425d9ae230210840378b2e))
* Add examples for config agents ([d87feb8](https://github.com/google/adk-python/commit/d87feb8ddb6a5e402c63bd3c35625160eb94e132))
* Adds pypi badge to README.md ([dc26aad](https://github.com/google/adk-python/commit/dc26aad663b6ae72223cfec9b91eaf73a636402d))
* Update StreamableHTTPConnectionParams docstring to remove SSE references ([8f937b5](https://github.com/google/adk-python/commit/8f937b517548a1ce0569f9698ea55c0a130ef221))
## [1.10.0](https://github.com/google/adk-python/compare/v1.9.0...v1.10.0) (2025-08-07)
### Features
* [Live] Implement Live Session Resumption ([71fbc92](https://github.com/google/adk-python/commit/71fbc9275b3d74700ec410cb4155ba0cb18580b7))
* [Tool] Support parallel execution of parallel function calls ([57cd41f](https://github.com/google/adk-python/commit/57cd41f424b469fb834bb8f2777b5f7be9aa6cdf))
* [Models] Allow max tokens to be customizable in Claude ([7556ebc](https://github.com/google/adk-python/commit/7556ebc76abd3c776922c2803aed831661cf7f82))
* [Tool] Create enterprise_web_search_tool as a tool instance ([0e28d64](https://github.com/google/adk-python/commit/0e28d64712e481cfd3b964be0166f529657024f6))
### Bug Fixes
* Fix shared default plugin manager and cost manager instances among multiple invocations ([423542a](https://github.com/google/adk-python/commit/423542a43fb8316195e9f79d97f87593751bebd3))
* Correct the type annotation in anthropic_llm implementation ([97318bc](https://github.com/google/adk-python/commit/97318bcd199acdacadfe8664da3fbfc3c806cdd2))
* Fix adk deploy cloud_run cli, which was broken in v1.9.0 ([e41dbcc](https://github.com/google/adk-python/commit/e41dbccf7f610e249108f9321f60f71fe2cc10f4))
* Remove thoughts from contents in llm requests from history contents ([d620bcb](https://github.com/google/adk-python/commit/d620bcb384d3068228ea2059fb70274e68e69682))
* Annotate response type as None for transfer_to_agent tool ([86a4487](https://github.com/google/adk-python/commit/86a44873e9b2dfc7e62fa31a9ac3be57c0bbff7b))
* Fix incompatible a2a sdk changes ([faadef1](https://github.com/google/adk-python/commit/faadef167ee8e4dd1faf4da5685a577c3155556e))
* Fix adk cli options and method parameters mismatching ([8ef2177](https://github.com/google/adk-python/commit/8ef2177658fbfc74b1a74b0c3ea8150bae866796))
### Improvements
* Add Github workflow config for the ADK Answering agent ([8dc0c94](https://github.com/google/adk-python/commit/8dc0c949afb9024738ff7ac1b2c19282175c3200))
* Import AGENT_CARD_WELL_KNOWN_PATH from adk instead of from a2a directly ([37dae9b](https://github.com/google/adk-python/commit/37dae9b631db5060770b66fce0e25cf0ffb56948))
* Make `LlmRequest.LiveConnectConfig` field default to a factory ([74589a1](https://github.com/google/adk-python/commit/74589a1db7df65e319d1ad2f0676ee0cf5d6ec1d))
* Update the prompt to make the ADK Answering Agent more objective ([2833030](https://github.com/google/adk-python/commit/283303032a174d51b8d72f14df83c794d66cb605))
* Add sample agent for testing parallel functions execution ([90b9193](https://github.com/google/adk-python/commit/90b9193a20499b8dd7f57d119cda4c534fcfda10))
* Hide the ask_data_insights tool until the API is publicly available ([bead607](https://github.com/google/adk-python/commit/bead607364be7ac8109357c9d3076d9b345e9e8a))
* Change `LlmRequest.config`'s default value to be `types.GenerateContentConfig()` ([041f04e](https://github.com/google/adk-python/commit/041f04e89cee30532facccce4900d10f1b8c69ce))
* Prevent triggering of _load_from_yaml_config in AgentLoader ([db975df](https://github.com/google/adk-python/commit/db975dfe2a09a6d056d02bc03c1247ac10f6da7d))
### Documentation
* Fix typos ([16a15c8](https://github.com/google/adk-python/commit/16a15c8709b47c9bebe7cffe888e8e7e48ec605a))
## [1.9.0](https://github.com/google/adk-python/compare/v1.8.0...v1.9.0) (2025-07-31)
### Features
* [CLI] Add `-v`, `--verbose` flag to enable DEBUG logging as a shortcut for `--log_level DEBUG` ([3be0882](https://github.com/google/adk-python/commit/3be0882c63bf9b185c34bcd17e03769b39f0e1c5))
* [CLI] Add a CLI option to update an agent engine instance ([206a132](https://github.com/google/adk-python/commit/206a13271e5f1bb0bb8114b3bb82f6ec3f030cd7))
* [CLI] Modularize fast_api.py to allow simpler construction of API Server ([bfc203a](https://github.com/google/adk-python/commit/bfc203a92fdfbc4abaf776e76dca50e7ca59127b), [dfc25c1](https://github.com/google/adk-python/commit/dfc25c17a98aaad81e1e2f140db83d17cd78f393), [e176f03](https://github.com/google/adk-python/commit/e176f03e8fe13049187abd0f14e63afca9ccff01))
* [CLI] Refactor AgentLoader into base class and add InMemory impl alongside existing filesystem impl ([bda3df2](https://github.com/google/adk-python/commit/bda3df24802d0456711a5cd05544aea54a13398d))
* [CLI] Respect the .ae_ignore file when deploying to agent engine ([f29ab5d](https://github.com/google/adk-python/commit/f29ab5db0563a343d6b8b437a12557c89b7fc98b))
* [Core] Add new callbacks to handle tool and model errors ([00afaaf](https://github.com/google/adk-python/commit/00afaaf2fc18fba85709754fb1037bb47f647243))
* [Core] Add sample plugin for logging ([20537e8](https://github.com/google/adk-python/commit/20537e8bfa31220d07662dad731b4432799e1802))
* [Core] Expose Gemini RetryOptions to client ([1639298](https://github.com/google/adk-python/commit/16392984c51b02999200bd4f1d6781d5ec9054de))
* [Evals] Added an Fast API new endpoint to serve eval metric info ([c69dcf8](https://github.com/google/adk-python/commit/c69dcf87795c4fa2ad280b804c9b0bd3fa9bf06f))
* [Evals] Refactored AgentEvaluator and updated it to use LocalEvalService ([1355bd6](https://github.com/google/adk-python/commit/1355bd643ba8f7fd63bcd6a7284cc48e325d138e))
### Bug Fixes
* Add absolutize_imports option when deploying to agent engine ([fbe6a7b](https://github.com/google/adk-python/commit/fbe6a7b8d3a431a1d1400702fa534c3180741eb3))
* Add space to allow adk deploy cloud_run --a2a ([70c4616](https://github.com/google/adk-python/commit/70c461686ec2c60fcbaa384a3f1ea2528646abba))
* Copy the original function call args before passing it to callback or tools to avoid being modified ([3432b22](https://github.com/google/adk-python/commit/3432b221727b52af2682d5bf3534d533a50325ef))
* Eval module not found exception string ([7206e0a](https://github.com/google/adk-python/commit/7206e0a0eb546a66d47fb411f3fa813301c56f42))
* Fix incorrect token count mapping in telemetry ([c8f8b4a](https://github.com/google/adk-python/commit/c8f8b4a20a886a17ce29abd1cfac2858858f907d))
* Import cli's artifact dependencies directly ([282d67f](https://github.com/google/adk-python/commit/282d67f253935af56fae32428124a385f812c67d))
* Keep existing header values while merging tracking headers for `llm_request.config.http_options` in `Gemini.generate_content_async` ([6191412](https://github.com/google/adk-python/commit/6191412b07c3b5b5a58cf7714e475f63e89be847))
* Merge tracking headers even when `llm_request.config.http_options` is not set in `Gemini.generate_content_async` ([ec8dd57](https://github.com/google/adk-python/commit/ec8dd5721aa151cfc033cc3aad4733df002ae9cb))
* Restore bigquery sample agent to runnable form ([16e8419](https://github.com/google/adk-python/commit/16e8419e32b54298f782ba56827e5139effd8780))
* Return session state in list_session API endpoint ([314d6a4](https://github.com/google/adk-python/commit/314d6a4f95c6d37c7da3afbc7253570564623322))
* Runner was expecting Event object instead of Content object when using early exist feature ([bf72426](https://github.com/google/adk-python/commit/bf72426af2bfd5c2e21c410005842e48b773deb3))
* Unable to acquire impersonated credentials ([9db5d9a](https://github.com/google/adk-python/commit/9db5d9a3e87d363c1bac0f3d8e45e42bd5380d3e))
* Update `agent_card_builder` to follow grammar rules ([9c0721b](https://github.com/google/adk-python/commit/9c0721beaa526a4437671e6cc70915073be835e3)), closes [#2223](https://github.com/google/adk-python/issues/2223)
* Use correct type for actions parameter in ApplicationIntegrationToolset ([ce7253f](https://github.com/google/adk-python/commit/ce7253f63ff8e78bccc7805bd84831f08990b881))
### Documentation
* Update documents about the information of vibe coding ([0c85587](https://github.com/google/adk-python/commit/0c855877c57775ad5dad930594f9f071164676da))
## [1.8.0](https://github.com/google/adk-python/compare/v1.7.0...v1.8.0) (2025-07-23)
### Features
* [Core]Add agent card builder ([18f5bea](https://github.com/google/adk-python/commit/18f5bea411b3b76474ff31bfb2f62742825b45e5))
* [Core]Add an to_a2a util to convert adk agent to A2A ASGI application ([a77d689](https://github.com/google/adk-python/commit/a77d68964a1c6b7659d6117d57fa59e43399e0c2))
* [Core]Add camel case converter for agents ([0e173d7](https://github.com/google/adk-python/commit/0e173d736334f8c6c171b3144ac6ee5b7125c846))
* [Evals]Use LocalEvalService to run all evals in cli and web ([d1f182e](https://github.com/google/adk-python/commit/d1f182e8e68c4a5a4141592f3f6d2ceeada78887))
* [Evals]Enable FinalResponseMatchV2 metric as an experiment ([36e45cd](https://github.com/google/adk-python/commit/36e45cdab3bbfb653eee3f9ed875b59bcd525ea1))
* [Models]Add support for `model-optimizer-*` family of models in vertex ([ffe2bdb](https://github.com/google/adk-python/commit/ffe2bdbe4c2ea86cc7924eb36e8e3bb5528c0016))
* [Services]Added a sample for History Management ([67284fc](https://github.com/google/adk-python/commit/67284fc46667b8c2946762bc9234a8453d48a43c))
* [Services]Support passing fully qualified agent engine resource name when constructing session service and memory service ([2e77804](https://github.com/google/adk-python/commit/2e778049d0a675e458f4e
35fe4104ca1298dbfcf))
* [Tools]Add ComputerUseToolset ([083dcb4](https://github.com/google/adk-python/commit/083dcb44650eb0e6b70219ede731f2fa78ea7d28))
* [Tools]Allow toolset to process llm_request before tools returned by it ([3643b4a](https://github.com/google/adk-python/commit/3643b4ae196fd9e38e52d5dc9d1cd43ea0733d36))
* [Tools]Support input/output schema by fully-qualified code reference ([dfee06a](https://github.com/google/adk-python/commit/dfee06ac067ea909251d6fb016f8331065d430e9))
* [Tools]Enhance LangchainTool to accept more forms of functions ([0ec69d0](https://github.com/google/adk-python/commit/0ec69d05a4016adb72abf9c94f2e9ff4bdd1848c))
### Bug Fixes
* **Attention**: Logging level for some API requests and responses was moved from `INFO` to `DEBUG` ([ff31f57](https://github.com/google/adk-python/commit/ff31f57dc95149f8f309f83f2ec983ef40f1122c))
* Please set `--log_level=DEBUG`, if you are interested in having those API request and responses in logs.
* Add buffer to the write file option ([f2caf2e](https://github.com/google/adk-python/commit/f2caf2eecaf0336495fb42a2166b1b79e57d82d8))
* Allow current sub-agent to finish execution before exiting the loop agent due to a sub-agent's escalation. ([2aab1cf](https://github.com/google/adk-python/commit/2aab1cf98e1d0e8454764b549fac21475a633409))
* Check that `mean_score` is a valid float value ([65cb6d6](https://github.com/google/adk-python/commit/65cb6d6bf3278e6c3529938a7b932e3ef6d6c2ae))
* Handle non-json-serializable values in the `execute_sql` tool ([13ff009](https://github.com/google/adk-python/commit/13ff009d34836a80f107cb43a632df15f7c215e4))
* Raise `NotFoundError` in `list_eval_sets` function when app_name doesn't exist ([b17d8b6](https://github.com/google/adk-python/commit/b17d8b6e362a5b2a1b6a2dd0cff5e27a71c27925))
* Fixed serialization of tools with nested schema ([53df35e](https://github.com/google/adk-python/commit/53df35ee58599e9816bd4b9c42ff48457505e599))
* Set response schema for function tools that returns `None` ([33ac838](https://github.com/google/adk-python/commit/33ac8380adfff46ed8a7d518ae6f27345027c074))
* Support path level parameters for open_api_spec_parser ([6f01660](https://github.com/google/adk-python/commit/6f016609e889bb0947877f478de0c5729cfcd0c3))
* Use correct type for actions parameter in ApplicationIntegrationToolset ([ce7253f](https://github.com/google/adk-python/commit/ce7253f63ff8e78bccc7805bd84831f08990b881))
* Use the same word extractor for query and event contents in InMemoryMemoryService ([1c4c887](https://github.com/google/adk-python/commit/1c4c887bec9326aad2593f016540160d95d03f33))
### Documentation
* Fix missing toolbox-core dependency and improve installation guide ([2486349](https://github.com/google/adk-python/commit/24863492689f36e3c7370be40486555801858bac))
## 1.7.0 (2025-07-16)
### Features
* Add ability to send state change with message [3f9f773](https://github.com/google/adk-python/commit/3f9f773d9b5fcca343e32f76f6d5677b7cf4c327)
* [Eval] Support for persisting eval run results [bab3be2](https://github.com/google/adk-python/commit/bab3be2cf31dc9afd00bcce70103bdaa5460f1a3)
* Introduce [Plugin]: Plugin is simply a class that packages these individual callback functions together for a broader purpose[162228d](https://github.com/google/adk-python/commit/162228d208dca39550a75221030edf9876bf8e3a)
### Bug Fixes
* Create correct object for image and video content in litellm [bf7745f](https://github.com/google/adk-python/commit/bf7745f42811de3c9c80ec0998001ae50960dafc)
* Support project-based gemini model path for BuiltInCodeExecutor and all built-in tools [a5d6f1e](https://github.com/google/adk-python/commit/a5d6f1e52ee36d84f94693086f74e4ca2d0bed65)
* Add instruction in long running tool description to avoid being invoked again by model [62a6119](https://github.com/google/adk-python/commit/62a611956f8907e0580955adb23dfb6d7799bf4f)
* [A2A] Import A2A well known path from A2A sdk [a6716a5](https://github.com/google/adk-python/commit/a6716a55140f63834ae4e3507b38786da9fdbee2)
* Fix the long running function response event merge logic [134ec0d](https://github.com/google/adk-python/commit/134ec0d71e8de4cf9bcbe370c7e739e7ada123f3)
* [A2A] Return final task result in task artifact instead of status message [a8fcc1b](https://github.com/google/adk-python/commit/a8fcc1b8ab0d47eccf6612a6eb8be021bff5ed3a)
* Make InMemoryMemoryService thread-safe [10197db](https://github.com/google/adk-python/commit/10197db0d752defc5976d1f276c7b5405a94c75b)
### Improvements
* Improve partial event handling and streaming aggregation [584c8c6](https://github.com/google/adk-python/commit/584c8c6d91308e62285c94629f020f2746e88f6f)
### Documentation
* Update agent transfer related doc string and comments [b1fa383](https://github.com/google/adk-python/commit/b1fa383e739d923399b3a23ca10435c0fba3460b)
* Update doc string for GcsArtifactService [498ce90](https://github.com/google/adk-python/commit/498ce906dd9b323b6277bc8118e1bcc68c38c1b5)
## [1.6.1](https://github.com/google/adk-python/compare/v1.5.0...v1.6.1) (2025-07-09)
### Features
* Add A2A support as experimental features [f0183a9](https://github.com/google/adk-python/commit/f0183a9b98b0bcf8aab4f948f467cef204ddc9d6)
* Install google-adk with a2a extra: pip install google-adk[a2a]
* Users can serve agents as A2A agent with `--a2a` option for `adk web` and
`adk api_server`
* Users can run a remote A2A agent with `RemoteA2AAgent` class
* Three A2A agent samples are added:
* contributing/samples/a2a_basic
* contributing/samples/a2a_auth
* contributing/samples/a2a_human_in_loop
* Support agent hot reload.[e545e5a](https://github.com/google/adk-python/commit/e545e5a570c1331d2ed8fda31c7244b5e0f71584)
Users can add `--reload_agents` flag to `adk web` and `adk api_server` command
to reload agents automatically when new changes are detected.
* Eval features
* Implement auto rater-based evaluator for responses [75699fb](https://github.com/google/adk-python/commit/75699fbeca06f99c6f2415938da73bb423ec9b9b)
* Add Safety evaluator metric [0bd05df](https://github.com/google/adk-python/commit/0bd05df471a440159a44b5864be4740b0f1565f9)
* Add BaseEvalService declaration and surrounding data models [b0d88bf](https://github.com/google/adk-python/commit/b0d88bf17242e738bcd409b3d106deed8ce4d407)
* Minor features
* Add `custom_metadata` to VertexAiSessionService when adding events [a021222](https://github.com/google/adk-python/commit/a02122207734cabb26f7c23e84d2336c4b8b0375)
* Support protected write in BigQuery `execute_sql` tool [dc43d51](https://github.com/google/adk-python/commit/dc43d518c90b44932b3fdedd33fca9e6c87704e2)
* Added clone() method to BaseAgent to allow users to create copies of an agent [d263afd] (https://github.com/google/adk-python/commit/d263afd91ba4a3444e5321c0e1801c499dec4c68)
### Bug Fixes
* Support project-based gemini model path to use enterprise_web_search_tool [e33161b](https://github.com/google/adk-python/commit/e33161b4f8650e8bcb36c650c4e2d1fe79ae2526)
* Use inspect.signature() instead of typing.get_type_hints for examining function signatures[4ca77bc](https://github.com/google/adk-python/commit/4ca77bc056daa575621a80d3c8d5014b78209233)
* Replace Event ID generation with UUID4 to prevent SQLite integrity constraint failures [e437c7a](https://github.com/google/adk-python/commit/e437c7aac650ac6a53fcfa71bd740e3e5ec0f230)
* Remove duplicate options from `adk deploy` [3fa2ea7](https://github.com/google/adk-python/commit/3fa2ea7cb923c9f8606d98b45a23bd58a7027436)
* Fix scenario where a user can access another users events given the same session id [362fb3f](https://github.com/google/adk-python/commit/362fb3f2b7ac4ad15852d00ce4f3935249d097f6)
* Handle unexpected 'parameters' argument in FunctionTool.run_async [0959b06](https://github.com/google/adk-python/commit/0959b06dbdf3037fe4121f12b6d25edca8fb9afc)
* Make sure each partial event has different timestamp [17d6042](https://github.com/google/adk-python/commit/17d604299505c448fcb55268f0cbaeb6c4fa314a)
* Avoid pydantic.ValidationError when the model stream returns empty final chunk [9b75e24](https://github.com/google/adk-python/commit/9b75e24d8c01878c153fec26ccfea4490417d23b)
* Fix google_search_tool.py to support updated Gemini LIVE model naming [77b869f](https://github.com/google/adk-python/commit/77b869f5e35a66682cba35563824fd23a9028d7c)
* Adding detailed information on each metric evaluation [04de3e1](https://github.com/google/adk-python/commit/04de3e197d7a57935488eb7bfa647c7ab62cd9d9)
* Converts litellm generate config err [3901fad](https://github.com/google/adk-python/commit/3901fade71486a1e9677fe74a120c3f08efe9d9e)
* Save output in state via output_key only when the event is authored by current agent [20279d9](https://github.com/google/adk-python/commit/20279d9a50ac051359d791dea77865c17c0bbf9e)
* Treat SQLite database update time as UTC for session's last update time [3f621ae](https://github.com/google/adk-python/commit/3f621ae6f2a5fac7f992d3d833a5311b4d4e7091)
* Raise ValueError when sessionId and userId are incorrect combination(#1653) [4e765ae](https://github.com/google/adk-python/commit/4e765ae2f3821318e581c26a52e11d392aaf72a4)
* Support API-Key for MCP Tool authentication [045aea9](https://github.com/google/adk-python/commit/045aea9b15ad0190a960f064d6e1e1fc7f964c69)
* Lock LangGraph version to <= 0.4.10 [9029b8a](https://github.com/google/adk-python/commit/9029b8a66e9d5e0d29d9a6df0e5590cc7c0e9038)
* Update the retry logic of create session polling [3d2f13c](https://github.com/google/adk-python/commit/3d2f13cecd3fef5adfa1c98bf23d7b68ff355f4d)
### Chores
* Extract mcp client creation logic to a separate method [45d60a1](https://github.com/google/adk-python/commit/45d60a1906bfe7c43df376a829377e2112ea3d17)
* Add tests for live streaming configs [bf39c00](https://github.com/google/adk-python/commit/bf39c006102ef3f01e762e7bb744596a4589f171)
* Update ResponseEvaluator to use newer version of Eval SDK [62c4a85](https://github.com/google/adk-python/commit/62c4a8591780a9a3fdb03a0de11092d84118a1b9)
* Add util to build our llms.txt and llms-full.txt files [a903c54](https://github.com/google/adk-python/commit/a903c54bacfcb150dc315bec9c67bf7ce9551c07)
* Create an example for multi agent live streaming [a58cc3d](https://github.com/google/adk-python/commit/a58cc3d882e59358553e8ea16d166b1ab6d3aa71)
* Refactor the ADK Triaging Agent to make the code easier to read [b6c7b5b](https://github.com/google/adk-python/commit/b6c7b5b64fcd2e83ed43f7b96ea43791733955d8)
### Documentation
* Update the a2a exmaple link in README.md [d0fdfb8](https://github.com/google/adk-python/commit/d0fdfb8c8e2e32801999c81de8d8ed0be3f88e76)
* Adds AGENTS.md to provide relevant project context for the Gemini CLI [37108be](https://github.com/google/adk-python/commit/37108be8557e011f321de76683835448213f8515)
* Update CONTRIBUTING.md [ffa9b36](https://github.com/google/adk-python/commit/ffa9b361db615ae365ba62c09a8f4226fb761551)
* Add adk project overview and architecture [28d0ea8](https://github.com/google/adk-python/commit/28d0ea876f2f8de952f1eccbc788e98e39f50cf5)
* Add docstring to clarify that inmemory service are not suitable for production [dc414cb](https://github.com/google/adk-python/commit/dc414cb5078326b8c582b3b9072cbda748766286)
* Update agents.md to include versioning strategy [6a39c85](https://github.com/google/adk-python/commit/6a39c854e032bda3bc15f0e4fe159b41cf2f474b)
* Add tenacity into project.toml [df141db](https://github.com/google/adk-python/commit/df141db60c1137a6bcddd6d46aad3dc506868543)
* Updating CONTRIBUTING.md with missing extra [e153d07](https://github.com/google/adk-python/commit/e153d075939fb628a7dc42b12e1b3461842db541)
## [1.5.0](https://github.com/google/adk-python/compare/v1.4.2...v1.5.0) (2025-06-25)
### Features
* Add a new option `eval_storage_uri` in adk web & adk eval to specify GCS bucket to store eval data ([fa025d7](https://github.com/google/adk-python/commit/fa025d755978e1506fa0da1fecc49775bebc1045))
* Add ADK examples for litellm with add_function_to_prompt ([f33e090](https://github.com/google/adk-python/commit/f33e0903b21b752168db3006dd034d7d43f7e84d))
* Add implementation of VertexAiMemoryBankService and support in FastAPI endpoint ([abc89d2](https://github.com/google/adk-python/commit/abc89d2c811ba00805f81b27a3a07d56bdf55a0b))
* Add rouge_score library to ADK eval dependencies, and implement RougeEvaluator that is computes ROUGE-1 for "response_match_score" metric ([9597a44](https://github.com/google/adk-python/commit/9597a446fdec63ad9e4c2692d6966b14f80ff8e2))
* Add usage span attributes to telemetry ([#356](https://github.com/google/adk-python/issues/356)) ([ea69c90](https://github.com/google/adk-python/commit/ea69c9093a16489afdf72657136c96f61c69cafd))
* Add Vertex Express mode compatibility for VertexAiSessionService ([00cc8cd](https://github.com/google/adk-python/commit/00cc8cd6433fc45ecfc2dbaa04dbbc1a81213b4d))
### Bug Fixes
* Include current turn context when include_contents='none' ([9e473e0](https://github.com/google/adk-python/commit/9e473e0abdded24e710fd857782356c15d04b515))
* Make LiteLLM streaming truly asynchronous ([bd67e84](https://github.com/google/adk-python/commit/bd67e8480f6e8b4b0f8c22b94f15a8cda1336339))
* Make raw_auth_credential and exchanged_auth_credential optional given their default value is None ([acbdca0](https://github.com/google/adk-python/commit/acbdca0d8400e292ba5525931175e0d6feab15f1))
* Minor typo fix in the agent instruction ([ef3c745](https://github.com/google/adk-python/commit/ef3c745d655538ebd1ed735671be615f842341a8))
* Typo fix in sample agent instruction ([ef3c745](https://github.com/google/adk-python/commit/ef3c745d655538ebd1ed735671be615f842341a8))
* Update contributing links ([a1e1441](https://github.com/google/adk-python/commit/a1e14411159fd9f3e114e15b39b4949d0fd6ecb1))
* Use starred tuple unpacking on GCS artifact blob names ([3b1d9a8](https://github.com/google/adk-python/commit/3b1d9a8a3e631ca2d86d30f09640497f1728986c))
### Chore
* Do not send api request when session does not have events ([88a4402](https://github.com/google/adk-python/commit/88a4402d142672171d0a8ceae74671f47fa14289))
* Leverage official uv action for install([09f1269](https://github.com/google/adk-python/commit/09f1269bf7fa46ab4b9324e7f92b4f70ffc923e5))
* Update google-genai package and related deps to latest([ed7a21e](https://github.com/google/adk-python/commit/ed7a21e1890466fcdf04f7025775305dc71f603d))
* Add credential service backed by session state([29cd183](https://github.com/google/adk-python/commit/29cd183aa1b47dc4f5d8afe22f410f8546634abc))
* Clarify the behavior of Event.invocation_id([f033e40](https://github.com/google/adk-python/commit/f033e405c10ff8d86550d1419a9d63c0099182f9))
* Send user message to the agent that returned a corresponding function call if user message is a function response([7c670f6](https://github.com/google/adk-python/commit/7c670f638bc17374ceb08740bdd057e55c9c2e12))
* Add request converter to convert a2a request to ADK request([fb13963](https://github.com/google/adk-python/commit/fb13963deda0ff0650ac27771711ea0411474bf5))
* Support allow_origins in cloud_run deployment ([2fd8feb](https://github.com/google/adk-python/commit/2fd8feb65d6ae59732fb3ec0652d5650f47132cc))
## [1.4.2](https://github.com/google/adk-python/compare/v1.4.1...v1.4.2) (2025-06-20)
### Bug Fixes
* Add type checking to handle different response type of genai API client ([4d72d31](https://github.com/google/adk-python/commit/4d72d31b13f352245baa72b78502206dcbe25406))
* This fixes the broken VertexAiSessionService
* Allow more credentials types for BigQuery tools ([2f716ad](https://github.com/google/adk-python/commit/2f716ada7fbcf8e03ff5ae16ce26a80ca6fd7bf6))
## [1.4.1](https://github.com/google/adk-python/compare/v1.3.0...v1.4.1) (2025-06-18)
### Features
* Add Authenticated Tool (Experimental) ([dcea776](https://github.com/google/adk-python/commit/dcea7767c67c7edfb694304df32dca10b74c9a71))
* Add enable_affective_dialog and proactivity to run_config and llm_request ([fe1d5aa](https://github.com/google/adk-python/commit/fe1d5aa439cc56b89d248a52556c0a9b4cbd15e4))
* Add import session API in the fast API ([233fd20](https://github.com/google/adk-python/commit/233fd2024346abd7f89a16c444de0cf26da5c1a1))
* Add integration tests for litellm with and without turning on add_function_to_prompt ([8e28587](https://github.com/google/adk-python/commit/8e285874da7f5188ea228eb4d7262dbb33b1ae6f))
* Allow data_store_specs pass into ADK VAIS built-in tool ([675faef](https://github.com/google/adk-python/commit/675faefc670b5cd41991939fe0fc604df331111a))
* Enable MCP Tool Auth (Experimental) ([157d9be](https://github.com/google/adk-python/commit/157d9be88d92f22320604832e5a334a6eb81e4af))
* Implement GcsEvalSetResultsManager to handle storage of eval sets on GCS, and refactor eval set results manager ([0a5cf45](https://github.com/google/adk-python/commit/0a5cf45a75aca7b0322136b65ca5504a0c3c7362))
* Re-factor some eval sets manager logic, and implement GcsEvalSetsManager to handle storage of eval sets on GCS ([1551bd4](https://github.com/google/adk-python/commit/1551bd4f4d7042fffb497d9308b05f92d45d818f))
* Support real time input config ([d22920b](https://github.com/google/adk-python/commit/d22920bd7f827461afd649601326b0c58aea6716))
* Support refresh access token automatically for rest_api_tool ([1779801](https://github.com/google/adk-python/commit/177980106b2f7be9a8c0a02f395ff0f85faa0c5a))
### Bug Fixes
* Fix Agent generate config err ([#1305](https://github.com/google/adk-python/issues/1305)) ([badbcbd](https://github.com/google/adk-python/commit/badbcbd7a464e6b323cf3164d2bcd4e27cbc057f))
* Fix Agent generate config error ([#1450](https://github.com/google/adk-python/issues/1450)) ([694b712](https://github.com/google/adk-python/commit/694b71256c631d44bb4c4488279ea91d82f43e26))
* Fix liteLLM test failures ([fef8778](https://github.com/google/adk-python/commit/fef87784297b806914de307f48c51d83f977298f))
* Fix tracing for live ([58e07ca](https://github.com/google/adk-python/commit/58e07cae83048d5213d822be5197a96be9ce2950))
* Merge custom http options with adk specific http options in model api request ([4ccda99](https://github.com/google/adk-python/commit/4ccda99e8ec7aa715399b4b83c3f101c299a95e8))
* Remove unnecessary double quote on Claude docstring ([bbceb4f](https://github.com/google/adk-python/commit/bbceb4f2e89f720533b99cf356c532024a120dc4))
* Set explicit project in the BigQuery client ([6d174eb](https://github.com/google/adk-python/commit/6d174eba305a51fcf2122c0fd481378752d690ef))
* Support streaming in litellm + adk and add corresponding integration tests ([aafa80b](https://github.com/google/adk-python/commit/aafa80bd85a49fb1c1a255ac797587cffd3fa567))
* Support project-based gemini model path to use google_search_tool ([b2fc774](https://github.com/google/adk-python/commit/b2fc7740b363a4e33ec99c7377f396f5cee40b5a))
* Update conversion between Celsius and Fahrenheit ([1ae176a](https://github.com/google/adk-python/commit/1ae176ad2fa2b691714ac979aec21f1cf7d35e45))
### Chores
* Set `agent_engine_id` in the VertexAiSessionService constructor, also use the `agent_engine_id` field instead of overriding `app_name` in FastAPI endpoint ([fc65873](https://github.com/google/adk-python/commit/fc65873d7c31be607f6cd6690f142a031631582a))
## [1.3.0](https://github.com/google/adk-python/compare/v1.2.1...v1.3.0) (2025-06-11)
+9 -5
View File
@@ -49,7 +49,7 @@ This project follows
## Requirement for PRs
- All PRs, other than small documentation or typo fixes, should have a Issue assoicated. If not, please create one.
- 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.
@@ -147,11 +147,11 @@ For any changes that impact user-facing documentation (guides, API reference, tu
pytest ./tests/unittests
```
NOTE: for accurately repro test failure, only include `test` and `eval` as
extra dependencies.
NOTE: for accurate repro of test failure, only include `test`, `eval` and
`a2a` as extra dependencies.
```shell
uv sync --extra test --extra eval
uv sync --extra test --extra eval --extra a2a
pytest ./tests/unittests
```
@@ -200,7 +200,7 @@ For any changes that impact user-facing documentation (guides, API reference, tu
## Contributing Resources
[Contributing folder](https://github.com/google/adk-python/tree/main/contributing/samples) has resources that is helpful for contributors.
[Contributing folder](https://github.com/google/adk-python/tree/main/contributing) has resources that is helpful for contributors.
## Code reviews
@@ -209,3 +209,7 @@ 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.
# 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.
+8 -3
View File
@@ -1,6 +1,7 @@
# 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)
@@ -14,7 +15,7 @@
</h3>
<h3 align="center">
Important Links:
<a href="https://google.github.io/adk-docs/">Docs</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>.
@@ -45,7 +46,7 @@ Agent Development Kit (ADK) is a flexible and modular framework for developing a
For remote agent-to-agent communication, ADK integrates with the
[A2A protocol](https://github.com/google-a2a/A2A/).
See this [example](https://github.com/google-a2a/a2a-samples/tree/main/samples/python/agents/google_adk)
See this [example](https://github.com/a2aproject/a2a-samples/tree/main/samples/python/agents)
for how they can work together.
## 🚀 Installation
@@ -135,9 +136,13 @@ adk eval \
## 🤝 Contributing
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/#questions).
- [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.
+7
View File
@@ -7,3 +7,10 @@ This folder host resources for ADK contributors, for example, testing samples et
Samples folder host samples to test different features. The samples are usually minimal and simplistic to test one or a few scenarios.
**Note**: This is different from the [google/adk-samples](https://github.com/google/adk-samples) repo, which hosts more complex e2e samples for customers to use or modify directly.
## ADK project and architecture overview
The [adk_project_overview_and_architecture.md](adk_project_overview_and_architecture.md) describes the ADK project overview and its technical architecture from high-level.
This is helpful for contributors to understand the project and design philosophy.
It can also be feed into LLMs for vibe-coding.
@@ -0,0 +1,112 @@
# ADK Project Overview and Architecture
Google Agent Development Kit (ADK) for Python
## Core Philosophy & Architecture
- Code-First: Everything is defined in Python code for versioning, testing, and IDE support. Avoid GUI-based logic.
- Modularity & Composition: We build complex multi-agent systems by composing multiple, smaller, specialized agents.
- Deployment-Agnostic: The agent's core logic is separate from its deployment environment. The same agent.py can be run locally for testing, served via an API, or deployed to the cloud.
## Foundational Abstractions (Our Vocabulary)
- Agent: The blueprint. It defines an agent's identity, instructions, and tools. It's a declarative configuration object.
- Tool: A capability. A Python function an agent can call to interact with the world (e.g., search, API call).
- Runner: The engine. It orchestrates the "Reason-Act" loop, manages LLM calls, and executes tools.
- Session: The conversation state. It holds the history for a single, continuous dialogue.
- Memory: Long-term recall across different sessions.
- Artifact Service: Manages non-textual data like files.
## Canonical Project Structure
Adhere to this structure for compatibility with ADK tooling.
```
my_adk_project/
└── src/
└── my_app/
├── agents/
│ ├── my_agent/
│ │ ├── __init__.py # Must contain: from. import agent \
│ │ └── agent.py # Must contain: root_agent = Agent(...) \
│ └── another_agent/
│ ├── __init__.py
│ └── agent.py\
```
agent.py: Must define the agent and assign it to a variable named root_agent. This is how ADK's tools find it.
`__init__.py`: In each agent directory, it must contain from. import agent to make the agent discoverable.
## Local Development & Debugging
Interactive UI (adk web): This is our primary debugging tool. It's a decoupled system:
Backend: A FastAPI server started with adk api_server.
Frontend: An Angular app that connects to the backend.
Use the "Events" tab to inspect the full execution trace (prompts, tool calls, responses).
CLI (adk run): For quick, stateless functional checks in the terminal.
Programmatic (pytest): For writing automated unit and integration tests.
## The API Layer (FastAPI)
We expose agents as production APIs using FastAPI.
- get_fast_api_app: This is the key helper function from google.adk.cli.fast_api that creates a FastAPI app from our agent directory.
- Standard Endpoints: The generated app includes standard routes like /list-apps and /run_sse for streaming responses. The wire format is camelCase.
- Custom Endpoints: We can add our own routes (e.g., /health) to the app object returned by the helper.
Python
from google.adk.cli.fast_api import get_fast_api_app
app = get_fast_api_app(agent_dir="./agents")
@app.get("/health")
async def health_check():
return {"status": "ok"}
## Deployment to Production
The adk cli provides the "adk deploy" command to deploy to Google Vertex Agent Engine, Google CloudRun, Google GKE.
## Testing & Evaluation Strategy
Testing is layered, like a pyramid.
### Layer 1: Unit Tests (Base)
What: Test individual Tool functions in isolation.
How: Use pytest in tests/test_tools.py. Verify deterministic logic.
### Layer 2: Integration Tests (Middle)
What: Test the agent's internal logic and interaction with tools.
How: Use pytest in tests/test_agent.py, often with mocked LLMs or services.
### Layer 3: Evaluation Tests (Top)
What: Assess end-to-end performance with a live LLM. This is about quality, not just pass/fail.
How: Use the ADK Evaluation Framework.
Test Cases: Create JSON files with input and a reference (expected tool calls and final response).
Metrics: tool_trajectory_avg_score (does it use tools correctly?) and response_match_score (is the final answer good?).
Run via: adk web (UI), pytest (for CI/CD), or adk eval (CLI).
+338
View File
@@ -0,0 +1,338 @@
#!/usr/bin/env python3
"""
build_llms_txt.py produce llms.txt and llms-full.txt
skips ```java``` blocks
README can be next to docs/ or inside docs/
includes Python API reference from HTML files
includes adk-python repository README
"""
from __future__ import annotations
import argparse
from pathlib import Path
import re
import sys
import textwrap
from typing import List
from typing import Tuple
import urllib.error
import urllib.request
RE_JAVA = re.compile(r"```java[ \t\r\n][\s\S]*?```", re.I | re.M)
RE_SNIPPET = re.compile(r"^(\s*)--8<--\s+\"([^\"]+?)(?::([^\"]+))?\"$", re.M)
def fetch_adk_python_readme() -> str:
"""Fetch README content from adk-python repository"""
try:
url = "https://raw.githubusercontent.com/google/adk-python/main/README.md"
with urllib.request.urlopen(url) as response:
return response.read().decode("utf-8")
except (urllib.error.URLError, urllib.error.HTTPError) as e:
print(f"Warning: Could not fetch adk-python README: {e}")
return ""
def strip_java(md: str) -> str:
return RE_JAVA.sub("", md)
def first_heading(md: str) -> str | None:
for line in md.splitlines():
if line.startswith("#"):
return line.lstrip("#").strip()
return None
def md_to_text(md: str) -> str:
import bs4
import markdown
html = markdown.markdown(
md, extensions=["fenced_code", "tables", "attr_list"]
)
return bs4.BeautifulSoup(html, "html.parser").get_text("\n")
def html_to_text(html_file: Path) -> str:
"""Extract text content from HTML files (for Python API reference)"""
import bs4
try:
html_content = html_file.read_text(encoding="utf-8")
soup = bs4.BeautifulSoup(html_content, "html.parser")
# Remove script and style elements
for script in soup(["script", "style"]):
script.decompose()
# Get text and clean it up
text = soup.get_text()
lines = (line.strip() for line in text.splitlines())
chunks = (phrase.strip() for line in lines for phrase in line.split(" "))
text = "\n".join(chunk for chunk in chunks if chunk)
return text
except Exception as e:
print(f"Warning: Could not process {html_file}: {e}")
return ""
def count_tokens(text: str, model: str = "cl100k_base") -> int:
try:
import tiktoken
return len(tiktoken.get_encoding(model).encode(text))
except Exception:
return len(text.split())
def expand_code_snippets(content: str, project_root: Path) -> str:
"""
Expands code snippets marked with --8<-- "path/to/file.py" or
--8<-- "path/to/file.py:section_name" into the content.
"""
def replace_snippet(match):
indent = match.group(1) # Capture leading spaces
snippet_path_str = match.group(
2
) # Capture the file path (e.g., "examples/python/snippets/file.py")
section_name = match.group(
3
) # Capture the section name if present (e.g., "init")
snippet_full_path = (
project_root / snippet_path_str
) # Changed from base_path to project_root
# If not found in project root, try adk-docs directory
if not snippet_full_path.exists():
script_dir = Path(__file__).resolve().parent
adk_docs_path = script_dir / "adk-docs" / snippet_path_str
if adk_docs_path.exists():
snippet_full_path = adk_docs_path
if snippet_full_path.exists():
try:
file_content = snippet_full_path.read_text(encoding="utf-8")
if section_name:
# Extract content based on section markers
# Handle both single and double hash markers with optional spacing
start_marker_patterns = [
f"# --8<-- [start:{section_name.strip()}]",
f"## --8<-- [start:{section_name.strip()}]",
]
end_marker_patterns = [
f"# --8<-- [end:{section_name.strip()}]",
f"## --8<-- [end:{section_name.strip()}]",
f"## --8<-- [end:{section_name.strip()}]", # Handle extra space
]
start_index = -1
end_index = -1
# Find start marker
for pattern in start_marker_patterns:
start_index = file_content.find(pattern)
if start_index != -1:
start_marker = pattern
break
# Find end marker
for pattern in end_marker_patterns:
end_index = file_content.find(pattern)
if end_index != -1:
break
if start_index != -1 and end_index != -1 and start_index < end_index:
# Adjust start_index to begin immediately after the start_marker
start_of_code = start_index + len(start_marker)
temp_content = file_content[start_of_code:end_index]
lines = temp_content.splitlines(keepends=True)
extracted_lines = []
for line in lines:
if (
not line.strip().startswith("# --8<--")
and not line.strip().startswith("## --8<--")
and line.strip() != ""
):
extracted_lines.append(line)
extracted_content = "".join(extracted_lines).strip("\n")
return textwrap.indent(extracted_content, indent)
else:
print(
f"Warning: Section '{section_name}' not found or markers"
f" malformed in {snippet_full_path}"
)
return match.group(0)
else:
# Read entire file if no section name
return textwrap.indent(file_content, indent)
except Exception as e:
print(f"Warning: Could not read snippet file {snippet_full_path}: {e}")
return match.group(0)
else:
print(f"Warning: Snippet file not found: {snippet_full_path}")
return match.group(0)
expanded_content = RE_SNIPPET.sub(replace_snippet, content)
return expanded_content
# ---------- index (llms.txt) ----------
def build_index(docs: Path) -> str:
# Locate README
for cand in (docs / "README.md", docs.parent / "README.md"):
if cand.exists():
readme = cand.read_text(encoding="utf-8")
break
else:
sys.exit("README.md not found in docs/ or its parent")
title = first_heading(readme) or "Documentation"
summary = md_to_text(readme).split("\n\n")[0]
lines = [f"# {title}", "", f"> {summary}", ""]
# Add adk-python repository README content
adk_readme = fetch_adk_python_readme()
if adk_readme:
lines.append("## ADK Python Repository")
lines.append("")
# Include the full README content, properly formatted
adk_text = md_to_text(strip_java(adk_readme))
lines.append(adk_text)
lines.append("")
lines.append(
f"**Source:** [adk-python"
f" repository](https://github.com/google/adk-python)"
)
lines.append("")
primary: List[Tuple[str, str]] = []
secondary: List[Tuple[str, str]] = []
# Process Markdown files
for md in sorted(docs.rglob("*.md")):
# Skip Java API reference files
if "api-reference" in md.parts and "java" in md.parts:
continue
rel = md.relative_to(docs)
# Construct the correct GitHub URL for the Markdown file
url = f"https://github.com/google/adk-docs/blob/main/docs/{rel}".replace(
" ", "%20"
)
h = first_heading(strip_java(md.read_text(encoding="utf-8"))) or rel.stem
(
secondary
if "sample" in rel.parts or "tutorial" in rel.parts
else primary
).append((h, url))
# Add Python API reference
python_api_dir = docs / "api-reference" / "python"
if python_api_dir.exists():
primary.append((
"Python API Reference",
"https://github.com/google/adk-docs/blob/main/docs/api-reference/python/",
))
def emit(name: str, items: List[Tuple[str, str]]):
nonlocal lines
if items:
lines.append(f"## {name}")
lines += [f"- [{h}]({u})" for h, u in items]
lines.append("")
emit("Documentation", primary)
emit("Optional", secondary)
return "\n".join(lines)
# ---------- full corpus ----------
def build_full(docs: Path) -> str:
out = []
script_dir = Path(__file__).resolve().parent
project_root = script_dir.parents[2] # Correct project root
print(f"DEBUG: Project Root: {project_root}")
print(f"DEBUG: Docs Dir: {docs}")
# Add adk-python repository README content at the beginning
adk_readme = fetch_adk_python_readme()
if adk_readme:
# Expand snippets in README if any
expanded_adk_readme = expand_code_snippets(
strip_java(adk_readme), project_root
) # Pass project_root
out.append("# ADK Python Repository")
out.append("")
out.append(expanded_adk_readme) # Use expanded content
out.append("")
out.append("---")
out.append("")
# Process Markdown files
for md in sorted(docs.rglob("*.md")):
# Skip Java API reference files
if "api-reference" in md.parts and "java" in md.parts:
continue
md_content = md.read_text(encoding="utf-8")
print(f"DEBUG: Processing markdown file: {md.relative_to(docs)}")
expanded_md_content = expand_code_snippets(
strip_java(md_content), project_root
) # Changed back to project_root
out.append(expanded_md_content) # Use expanded content
# Process Python API reference HTML files
python_api_dir = docs / "api-reference" / "python"
if python_api_dir.exists():
# Add a separator and header for Python API reference
out.append("\n\n# Python API Reference\n")
# Process main HTML files (skip static assets and generated files)
html_files = [
python_api_dir / "index.html",
python_api_dir / "google-adk.html",
python_api_dir / "genindex.html",
python_api_dir / "py-modindex.html",
]
for html_file in html_files:
if html_file.exists():
text = html_to_text(html_file)
if text.strip():
out.append(f"\n## {html_file.stem}\n")
out.append(text)
return "\n\n".join(out)
def main() -> None:
ap = argparse.ArgumentParser(
description="Generate llms.txt / llms-full.txt",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
ap.add_argument("--docs-dir", required=True, type=Path)
ap.add_argument("--out-root", default=Path("."), type=Path)
ap.add_argument("--index-limit", type=int, default=50_000)
ap.add_argument("--full-limit", type=int, default=500_000)
args = ap.parse_args()
idx, full = build_index(args.docs_dir), build_full(args.docs_dir)
if (tok := count_tokens(idx)) > args.index_limit:
sys.exit(f"Index too big: {tok:,}")
if (tok := count_tokens(full)) > args.full_limit:
sys.exit(f"Full text too big: {tok:,}")
(args.out_root / "llms.txt").write_text(idx, encoding="utf-8")
(args.out_root / "llms-full.txt").write_text(full, encoding="utf-8")
print("✅ Generated llms.txt and llms-full.txt successfully")
print(f"llms.txt tokens: {count_tokens(idx)}")
print(f"llms-full.txt tokens: {count_tokens(full)}")
if __name__ == "__main__":
main()
+216
View File
@@ -0,0 +1,216 @@
# A2A OAuth Authentication Sample Agent
This sample demonstrates the **Agent-to-Agent (A2A)** architecture with **OAuth Authentication** workflows in the Agent Development Kit (ADK). The sample implements a multi-agent system where a remote agent can surface OAuth authentication requests to the local agent, which then guides the end user through the OAuth flow before returning the authentication credentials to the remote agent for API access.
## Overview
The A2A OAuth Authentication sample consists of:
- **Root Agent** (`root_agent`): The main orchestrator that handles user requests and delegates tasks to specialized agents
- **YouTube Search Agent** (`youtube_search_agent`): A local agent that handles YouTube video searches using LangChain tools
- **BigQuery Agent** (`bigquery_agent`): A remote A2A agent that manages BigQuery operations and requires OAuth authentication for Google Cloud access
## Architecture
```
┌─────────────────┐ ┌────────────────────┐ ┌──────────────────┐
│ End User │───▶│ Root Agent │───▶│ BigQuery Agent │
│ (OAuth Flow) │ │ (Local) │ │ (Remote A2A) │
│ │ │ │ │ (localhost:8001) │
│ OAuth UI │◀───│ │◀───│ OAuth Request │
└─────────────────┘ └────────────────────┘ └──────────────────┘
```
## Key Features
### 1. **Multi-Agent Architecture**
- Root agent coordinates between local YouTube search and remote BigQuery operations
- Demonstrates hybrid local/remote agent workflows
- Seamless task delegation based on user request types
### 2. **OAuth Authentication Workflow**
- Remote BigQuery agent surfaces OAuth authentication requests to the root agent
- Root agent guides end users through Google OAuth flow for BigQuery access
- Secure token exchange between agents for authenticated API calls
### 3. **Google Cloud Integration**
- BigQuery toolset with comprehensive dataset and table management capabilities
- OAuth-protected access to user's Google Cloud BigQuery resources
- Support for listing, creating, and managing datasets and tables
### 4. **LangChain Tool Integration**
- YouTube search functionality using LangChain community tools
- Demonstrates integration of third-party tools in agent workflows
## Setup and Usage
### Prerequisites
1. **Set up OAuth Credentials**:
```bash
export OAUTH_CLIENT_ID=your_google_oauth_client_id
export OAUTH_CLIENT_SECRET=your_google_oauth_client_secret
```
2. **Start the Remote BigQuery Agent server**:
```bash
# Start the remote a2a server that serves the BigQuery agent on port 8001
adk api_server --a2a --port 8001 contributing/samples/a2a_auth/remote_a2a
```
3. **Run the Main Agent**:
```bash
# In a separate terminal, run the adk web server
adk web contributing/samples/
```
### Example Interactions
Once both services are running, you can interact with the root agent:
**YouTube Search (No Authentication Required):**
```
User: Search for 3 Taylor Swift music videos
Agent: I'll help you search for Taylor Swift music videos on YouTube.
[Agent delegates to YouTube Search Agent]
Agent: I found 3 Taylor Swift music videos:
1. "Anti-Hero" - Official Music Video
2. "Shake It Off" - Official Music Video
3. "Blank Space" - Official Music Video
```
**BigQuery Operations (OAuth Required):**
```
User: List my BigQuery datasets
Agent: I'll help you access your BigQuery datasets. This requires authentication with your Google account.
[Agent delegates to BigQuery Agent]
Agent: To access your BigQuery data, please complete the OAuth authentication.
[OAuth flow initiated - user redirected to Google authentication]
User: [Completes OAuth flow in browser]
Agent: Authentication successful! Here are your BigQuery datasets:
- dataset_1: Customer Analytics
- dataset_2: Sales Data
- dataset_3: Marketing Metrics
```
**Dataset Management:**
```
User: Show me details for my Customer Analytics dataset
Agent: I'll get the details for your Customer Analytics dataset.
[Using existing OAuth token]
Agent: Customer Analytics Dataset Details:
- Created: 2024-01-15
- Location: US
- Tables: 5
- Description: Customer behavior and analytics data
```
## Code Structure
### Main Agent (`agent.py`)
- **`youtube_search_agent`**: Local agent with LangChain YouTube search tool
- **`bigquery_agent`**: Remote A2A agent configuration for BigQuery operations
- **`root_agent`**: Main orchestrator with task delegation logic
### Remote BigQuery Agent (`remote_a2a/bigquery_agent/`)
- **`agent.py`**: Implementation of the BigQuery agent with OAuth toolset
- **`agent.json`**: Agent card of the A2A agent
- **`BigQueryToolset`**: OAuth-enabled tools for BigQuery dataset and table management
## OAuth Authentication Workflow
The OAuth authentication process follows this pattern:
1. **Initial Request**: User requests BigQuery operation through root agent
2. **Delegation**: Root agent delegates to remote BigQuery agent
3. **Auth Check**: BigQuery agent checks for valid OAuth token
4. **Auth Request**: If no token, agent surfaces OAuth request to root agent
5. **User OAuth**: Root agent guides user through Google OAuth flow
6. **Token Exchange**: Root agent sends OAuth token to BigQuery agent
7. **API Call**: BigQuery agent uses token to make authenticated API calls
8. **Result Return**: BigQuery agent returns results through root agent to user
## Supported BigQuery Operations
The BigQuery agent supports the following operations:
### Dataset Operations:
- **List Datasets**: `bigquery_datasets_list` - Get all user's datasets
- **Get Dataset**: `bigquery_datasets_get` - Get specific dataset details
- **Create Dataset**: `bigquery_datasets_insert` - Create new dataset
### Table Operations:
- **List Tables**: `bigquery_tables_list` - Get tables in a dataset
- **Get Table**: `bigquery_tables_get` - Get specific table details
- **Create Table**: `bigquery_tables_insert` - Create new table in dataset
## Extending the Sample
You can extend this sample by:
- Adding more Google Cloud services (Cloud Storage, Compute Engine, etc.)
- Implementing token refresh and expiration handling
- Adding role-based access control for different BigQuery operations
- Creating OAuth flows for other providers (Microsoft, Facebook, etc.)
- Adding audit logging for authentication events
- Implementing multi-tenant OAuth token management
## Deployment to Other Environments
When deploying the remote BigQuery A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:
### Local Development
```json
{
"url": "http://localhost:8001/a2a/bigquery_agent",
...
}
```
### Cloud Run Example
```json
{
"url": "https://your-bigquery-service-abc123-uc.a.run.app/a2a/bigquery_agent",
...
}
```
### Custom Host/Port Example
```json
{
"url": "https://your-domain.com:9000/a2a/bigquery_agent",
...
}
```
**Important:** The `url` field in `remote_a2a/bigquery_agent/agent.json` must point to the actual RPC endpoint where your remote BigQuery A2A agent is deployed and accessible.
## Troubleshooting
**Connection Issues:**
- Ensure the local ADK web server is running on port 8000
- Ensure the remote A2A server is running on port 8001
- Check that no firewall is blocking localhost connections
- **Verify the `url` field in `remote_a2a/bigquery_agent/agent.json` matches the actual deployed location of your remote A2A server**
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server
**OAuth Issues:**
- Verify OAuth client ID and secret are correctly set in .env file
- Ensure OAuth redirect URIs are properly configured in Google Cloud Console
- Check that the OAuth scopes include BigQuery access permissions
- Verify the user has access to the BigQuery projects/datasets
**BigQuery Access Issues:**
- Ensure the authenticated user has BigQuery permissions
- Check that the Google Cloud project has BigQuery API enabled
- Verify dataset and table names are correct and accessible
- Check for quota limits on BigQuery API calls
**Agent Communication Issues:**
- Check the logs for both the local ADK web server and remote A2A server
- Verify OAuth tokens are properly passed between agents
- Ensure agent instructions are clear about authentication requirements
- **Double-check that the RPC URL in the agent.json file is correct and accessible**
+63
View File
@@ -0,0 +1,63 @@
# 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 google.adk.agents.llm_agent import Agent
from google.adk.agents.remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent
from google.adk.tools.langchain_tool import LangchainTool
from langchain_community.tools.youtube.search import YouTubeSearchTool
# Instantiate the tool
langchain_yt_tool = YouTubeSearchTool()
# Wrap the tool in the LangchainTool class from ADK
adk_yt_tool = LangchainTool(
tool=langchain_yt_tool,
)
youtube_search_agent = Agent(
name="youtube_search_agent",
model="gemini-2.0-flash", # Replace with the actual model name
instruction="""
Ask customer to provide singer name, and the number of videos to search.
""",
description="Help customer to search for a video on Youtube.",
tools=[adk_yt_tool],
output_key="youtube_search_output",
)
bigquery_agent = RemoteA2aAgent(
name="bigquery_agent",
description="Help customer to manage notion workspace.",
agent_card=(
f"http://localhost:8001/a2a/bigquery_agent{AGENT_CARD_WELL_KNOWN_PATH}"
),
)
root_agent = Agent(
model="gemini-2.0-flash",
name="root_agent",
instruction="""
You are a helpful assistant that can help search youtube videos, look up BigQuery datasets and tables.
You delegate youtube search tasks to the youtube_search_agent.
You delegate BigQuery tasks to the bigquery_agent.
Always clarify the results before proceeding.
""",
global_instruction=(
"You are a helpful assistant that can help search youtube videos, look"
" up BigQuery datasets and tables."
),
sub_agents=[youtube_search_agent, bigquery_agent],
)
@@ -0,0 +1,15 @@
# 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 . import agent

Some files were not shown because too many files have changed in this diff Show More