Commit Graph
2221 Commits
Author SHA1 Message Date
Keyur JoshiandCopybara-Service 7b7ddda46c feat: Add interface between optimization infra and LocalEvalService
details:
* Enables the use of ADK evaluations via LocalEvalService for optimizing agents.
* Provides flexibility in choosing eval sets and eval cases for training and validation.
* Converts ADK eval results into a compact format useful for whitebox agent optimization.

Co-authored-by: Keyur Joshi <keyurj@google.com>
PiperOrigin-RevId: 875818012
2026-02-26 11:40:37 -08:00
Carlos Chinchilla CorbachoandCopybara-Service 65d9a726c5 chore: add @override decorators to LoggingPlugin callback methods
Merge https://github.com/google/adk-python/pull/4572

### Link to Issue or Description of Change
**1. Link to an existing issue (if applicable):**
- Closes: #4496

**2. Or, if no issue exists, describe the change:**

**Problem:**

`LoggingPlugin` overrides 12 callback methods from `BasePlugin` but none use the `@override` decorator. Every other plugin in the package (`DebugLoggingPlugin`, `ReplayPlugin`, `RecordingsPlugin`, `EnsureRetryOptionsPlugin`, `_RequestIntercepterPlugin`) already follows this practice. With `mypy --strict` enabled in `pyproject.toml`, missing `@override` means renamed or removed base-class methods would be silently missed in `LoggingPlugin` while being caught everywhere else.

**Solution:**

Import `override` from `typing_extensions` and decorate all 12 overridden callbacks. Purely additive: one import line and 12 decorators. No behavioral, API, or runtime change.

### Testing Plan

**Unit Tests:**
- [ ] I have added or updated unit tests for my change.
- [x] All unit tests pass locally.

No new tests are required — `@override` is a static-analysis-only decorator with no runtime effect. Ran `mypy` on the file before and after the change: same preexisting warnings, no new errors introduced. CI will validate via the existing test suite and linting checks.

**Manual End-to-End (E2E) Tests:**

Not applicable. This change adds only decorators with no runtime behavior. Verified by comparing `mypy` output before and after — no new errors.

### Checklist

- [x] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document.
- [x] I have performed a self-review of my own code.
- [x] I have commented my code, particularly in hard-to-understand areas.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [x] New and existing unit tests pass locally with my changes.
- [ ] I have manually tested my changes end-to-end.
- [ ] Any dependent changes have been merged and published in downstream modules.

### Additional context

I am the author of the original issue (#4496). A previous PR (#4544) was opened but is pending clarification, so I'm
submitting this complete PR as the original issue author.

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4572 from cchinchilla-dev:feat/add_override_decorators_to_loggingplugin_4496 142ed872bee39db782c1dccb84f40906ee849bb8
PiperOrigin-RevId: 875811966
2026-02-26 11:29:52 -08:00
Wiktoria WalczakandCopybara-Service 4dd4d5ecb6 feat(otel): add gen_ai.tool.definitions to experimental semconv
Co-authored-by: Wiktoria Walczak <wwalczak@google.com>
PiperOrigin-RevId: 875741416
2026-02-26 08:42:50 -08:00
Google AdminandCopybara-Service 7a813b0987 chore: refactor Github Action
Co-authored-by: Sasha Sobran <asobran@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4535 from google:lsc-1771431513.0644026 200d04544fafa4c555f2031f66ef6a3c2ff8a774
PiperOrigin-RevId: 875727295
2026-02-26 08:06:59 -08:00
Sasha SobranandCopybara-Service b38b708e23 chore: Update release-please to always bump minor
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 875727292
2026-02-26 08:06:15 -08:00
Wiktoria WalczakandCopybara-Service 19718e9c17 feat(otel): add experimental semantic convention and emit gen_ai.client.inference.operation.details event
Co-authored-by: Wiktoria Walczak <wwalczak@google.com>
PiperOrigin-RevId: 875709959
2026-02-26 07:19:15 -08:00
Google Team MemberandCopybara-Service 6f772d2b08 feat: Introduce A2A request interceptors in RemoteA2aAgent
This change adds a new `a2a` subpackage with configuration and utility functions for intercepting requests and responses in `RemoteA2aAgent`. The `RemoteA2aAgent` now accepts an `A2aRemoteAgentConfig` to register `RequestInterceptor` instances, allowing custom logic to be executed before and after the A2A message send.

PiperOrigin-RevId: 875559286
2026-02-26 00:23:01 -08:00
Shangjie ChenandCopybara-Service 5f806ed73a chore: Refactor runner to infer invocation_id from FunctionResponse Event for HITL resuming
invocation_id is no longer required in resuming case, unless no new_message is provided.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 875432024
2026-02-25 18:27:16 -08:00
Kathy WuandCopybara-Service de4dee899c fix: Re-export DEFAULT_SKILL_SYSTEM_INSTRUCTION to skills and skill/prompt.py to avoid breaking current users
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 875407169
2026-02-25 17:18:29 -08:00
Google Team MemberandCopybara-Service 5702a4b1f5 feat: Add param support to Bigtable execute_sql
PiperOrigin-RevId: 875382675
2026-02-25 16:11:44 -08:00
9730bc34d7 Refactor Github Action per b/485167538 (#4535)
Co-authored-by: Ben Knutson <benknutson@google.com>
2026-02-25 17:09:43 -05:00
Yifan WangandCopybara-Service 4460f4fada chore: add /dev/build_graph/{app_name} to build the graph serialization for apps, and
make it dev only with `with_ui` flag

Co-authored-by: Yifan Wang <wanyif@google.com>
PiperOrigin-RevId: 875319398
2026-02-25 13:47:41 -08:00
Google Team MemberandCopybara-Service d7cfd8fe4d fix: Decode image data from ComputerUse tool response into image blobs
PiperOrigin-RevId: 875292001
2026-02-25 12:46:19 -08:00
Haiyuan CaoandCopybara-Service 35366f4e2a feat: Warn when accessing DEFAULT_SKILL_SYSTEM_INSTRUCTION
This change makes DEFAULT_SKILL_SYSTEM_INSTRUCTION raise a UserWarning when accessed, indicating that its content is experimental and subject to change in minor/patch releases. The constant is also made "private" internally.

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 875288217
2026-02-25 12:37:30 -08:00
Brian FoxandCopybara-Service 3256a679da fix(tools): Handle JSON Schema boolean schemas in Gemini schema conversion
Merge https://github.com/google/adk-python/pull/4531

**Problem:**
JSON Schema allows `true` and `false` as valid boolean schemas, where `true` accepts any value and `false` rejects all values. Some MCP servers  use this pattern for unconstrained fields. E.g. [mcp-grafana](https://github.com/grafana/mcp-grafana) - see [grafana-mcp-list-tools.json](https://github.com/user-attachments/files/25392430/grafana-mcp-list-tools.json) which was obtained from `tools/list`

The schema sanitizer previously passed booleans through unchanged, causing a Pydantic ValidationError when `_ExtendedJSONSchema` tried to validate them as schema objects.

```
1 validation error for _ExtendedJSONSchema
properties.data.items.properties.model
  Input should be a valid dictionary or object to extract fields from [type=model_attributes_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.12/v/model_attributes_type
Traceback (most recent call last):
  ...
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 561, in run_async
    async for event in agen:
      yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 549, in _run_with_trace
    async for event in agen:
      yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 778, in _exec_with_plugin
    async for event in agen:
    ...<64 lines>...
        yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 538, in execute
    async for event in agen:
      yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 294, in run_async
    async for event in agen:
      yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/agents/llm_agent.py", line 468, in _run_async_impl
    async for event in agen:
    ...<5 lines>...
        should_pause = True
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 427, in run_async
    async for event in agen:
      last_event = event
      yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 446, in _run_one_step_async
    async for event in agen:
      yield event
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 578, in _preprocess_async
    await tool.process_llm_request(
        tool_context=tool_context, llm_request=llm_request
    )
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/tools/base_tool.py", line 129, in process_llm_request
    llm_request.append_tools([self])
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/models/llm_request.py", line 255, in append_tools
    declaration = tool._get_declaration()
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/tools/mcp_tool/mcp_tool.py", line 200, in _get_declaration
    parameters = _to_gemini_schema(input_schema)
  File "/.foo/.venv/lib/python3.13/site-packages/google/adk/tools/_gemini_schema_util.py", line 218, in _to_gemini_schema
    json_schema=_ExtendedJSONSchema.model_validate(sanitized_schema),
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/.foo/.venv/lib/python3.13/site-packages/pydantic/main.py", line 716, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        obj,
        ^^^^
    ...<5 lines>...
        by_name=by_name,
        ^^^^^^^^^^^^^^^^
    )
    ^
pydantic_core._pydantic_core.ValidationError: 1 validation error for _ExtendedJSONSchema
properties.data.items.properties.model
  Input should be a valid dictionary or object to extract fields from [type=model_attributes_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.12/v/model_attributes_type
```

**Solution:**

Convert boolean schemas to `{"type": "object"}` as the closest approximation available in Gemini's schema model.

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/4531 from onematchfox:fix-gemini-schema-bool 383ac0c0c3ab78d77be4503f5d6b9ad26c41b0db
PiperOrigin-RevId: 875219362
2026-02-25 10:10:41 -08:00
Google Team MemberandCopybara-Service e59929e11a fix: Propagate thought from A2A TextPart metadata to GenAI Part
When converting an A2A TextPart to a GenAI Part, extract the 'thought' field from the TextPart's metadata and include it in the GenAI Part.

PiperOrigin-RevId: 875129430
2026-02-25 06:23:18 -08:00
Haiyuan CaoandCopybara-Service 636f68fbee feat: Add RunSkillScriptTool to SkillToolset
Introduces RunSkillScriptTool to execute scripts located in a skill's scripts/ directory.

The execution logic is isolated within a dedicated SkillScriptCodeExecutor wrapper instantiated by RunSkillScriptTool. This wrapper manages script materialization in a temporary directory and executes Python (via runpy) or Shell scripts (returning standard output or JSON-encoded envelopes).

This isolation eliminates the need to modify the underlying `BaseCodeExecutor` interface or implementations (`unsafe_local_code_executor`, etc.) to support working directories or file paths.

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 875012237
2026-02-25 00:59:01 -08:00
Xuan YangandCopybara-Service e4d9540ce3 chore: Make Release: Please workflow only run via workflow_dispatch
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 874980878
2026-02-24 23:29:40 -08:00
Kathy WuandCopybara-Service 8f5428150d fix: Update sample skills agent to use weather-skill instead of weather_skill
Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 874796345
2026-02-24 14:35:11 -08:00
Google Team MemberandCopybara-Service 121d277416 feat: Add /chat/completions streaming support to Apigee LLM
PiperOrigin-RevId: 874764985
2026-02-24 13:26:43 -08:00
Google Team MemberandCopybara-Service 48105b49c5 fix: Add support for injecting a custom google.genai.Client into Gemini models
This change introduces a new `client` parameter to the `Gemini` model's constructor. When provided, this preconfigured `google.genai.Client` instance is used for all API calls, offering fine-grained control over authentication, project, and location settings

Close #2560

PiperOrigin-RevId: 874752355
2026-02-24 12:58:28 -08:00
Google Team MemberandCopybara-Service ee8d956413 fix: Update agent_engine_sandbox_code_executor in ADK
1. For prototyping and testing purposes, sandbox name can be provided, and it will be used for all requests across the lifecycle of an agent
2. If no sandbox name is provided, agent engine name will be provided, and we will automatically create one sandbox per session, and the sandbox has TTL set for a year.
If the sandbox stored in the session hits the TTL, it will not be in "STATE_RUNNING" so a new sandbox will be created.

PiperOrigin-RevId: 874705260
2026-02-24 11:16:04 -08:00
George WealeandCopybara-Service 7be90db24b feat: Support ID token exchange in ServiceAccountCredentialExchanger
Adds use_id_token and audience fields to ServiceAccount so that
ServiceAccountCredentialExchanger can produce ID tokens instead of
access tokens. This is required for authenticating to Cloud Run, Cloud
Functions, and other Google Cloud services that verify caller identity.
Close #4458

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 874630210
2026-02-24 08:39:03 -08:00
George WealeandCopybara-Service c615757ba1 fix: Add support for injecting a custom google.genai.Client into Gemini models
This change introduces a new `client` parameter to the `Gemini` model's constructor. When provided, this preconfigured `google.genai.Client` instance is used for all API calls, offering fine-grained control over authentication, project, and location settings

Close #2560

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 874628604
2026-02-24 08:34:32 -08:00
Sasha SobranandCopybara-Service 8c0bd2034c chore: SessionNotFoundError only inherits form ValueError
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 874545504
2026-02-24 04:42:24 -08:00