Open
Conversation
…viderRegistry within CredentialManager The flow for integrating a new auth method will be as follows. The ADK framework contributor will 1. extend the `AuthScheme` to create their own within `adk/auth/auth_scheme.py` 2. implement `BaseAuthProvider` within their dedicated directory in `adk/integrations/auth` 3. do the static registration of the new scheme and provider with AuthProviderRegistry of CredentialManager. PiperOrigin-RevId: 881775983
PiperOrigin-RevId: 881782296
The _update_type_string function now recursively processes "properties" at any level of the schema, ensuring that all "type" fields within nested objects are correctly lowercased. This improves handling of complex Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 882050939
PiperOrigin-RevId: 882138997
Co-authored-by: Yifan Wang <wanyif@google.com> PiperOrigin-RevId: 882192675
This change adds logic to extract and re-embed the `thought_signature` field associated with function calls in Gemini models when converting between LiteLLM's ChatCompletionMessageToolCall and ADK's types.Part Close #4650 Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 882212223
Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 882212923
The `can_use_output_schema_with_tools` function now checks if a model is a LiteLlm instance by inspecting its type's Method Resolution Order, rather than directly importing `LiteLlm` Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 882253446
PiperOrigin-RevId: 882270600
V4 still uses deprecated Node.js 20. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 882275971
Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 882293566
Co-authored-by: Liang Wu <18244712+wuliang229@users.noreply.github.com>
Co-authored-by: Guoyi Lou <guoyilou@google.com> PiperOrigin-RevId: 882787811
This change introduces a new interceptor that adds the 'https://google.github.io/adk-docs/a2a/a2a-extension/' extension to the request headers in the A2A client from the RemoteAgent side. To send this extension along with requests, the RemoteAgent has to be instantiated with the `use_legacy` flag set to False. The AgentExecutor will default to the new implementation when this extension is requested by the client, but this behavior can be disabled via the `use_legacy` flag. The 'force_new' flag on the agent_executor side can be used to bypass the presence of the extension, and always activate the new version of the agent_executor. PiperOrigin-RevId: 883021792
Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 883246168
…creation due to missing version field Co-authored-by: Achuth Narayan Rajagopal <achuthr@google.com> PiperOrigin-RevId: 883336463
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com> PiperOrigin-RevId: 883401159
Merge #4718 ### Link to Issue or Description of Change **1. Link to an existing issue (if applicable):** - Closes: N/A - Related: N/A **2. Or, if no issue exists, describe the change:** **Problem** ADK’s MCP integration currently does not expose the MCP sampling callback capability. This prevents agent-side LLM sampling handlers from being used when interacting with MCP servers that support sampling. The MCP Python SDK supports sampling callbacks, but these parameters are not propagated through the ADK MCP integration layers. **Solution** Add sampling callback support by propagating the parameters through the MCP stack: - Add `sampling_callback` and `sampling_capabilities` parameters to `McpToolset` - Forward them to `MCPSessionManager` - Forward them to `SessionContext` - Pass them into `ClientSession` initialization This enables agent-side sampling handling when interacting with MCP servers. --- ### Testing Plan **Unit Tests** - [x] I have added or updated unit tests for my change. - [x] All unit tests pass locally. Added `test_mcp_sampling_callback.py` to verify that the sampling callback is correctly invoked. Example result: pytest tests/unittests/tools/mcp_tool/test_mcp_sampling_callback.py 1 passed **Manual End-to-End (E2E) Tests** Manual testing was performed using a FastMCP sampling example server where the sampling callback was invoked from the agent side and returned the expected response. --- ### Checklist - [x] I have read the CONTRIBUTING.md document. - [x] I have performed a self-review of my own code. - [x] I have commented my code where necessary. - [x] I have added tests proving the feature works. - [x] Unit tests pass locally. - [x] I have manually tested the change end-to-end. --- ### Additional context This change aligns ADK MCP support with the sampling capabilities available in the MCP Python SDK and enables agent implementations to handle sampling requests via a callback. Co-authored-by: Kathy Wu <wukathy@google.com> COPYBARA_INTEGRATE_REVIEW=#4718 from Piyushmrya:fix-mcp-sampling-callback 18f477f PiperOrigin-RevId: 883401178
Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 883401885
Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 883403479
Closes issue #4805 Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 883403628
…-2-preview The gemini-embedding-2-preview model requires the Vertex AI :embedContent endpoint instead of the legacy :predict endpoint used by older models (text-embedding-004, text-embedding-005). In google-genai <1.64.0, embed_content() unconditionally routed to :predict on Vertex AI, which returns FAILED_PRECONDITION for this model. v1.64.0 (googleapis/python-genai@af40cc6) introduced model-aware dispatch in embed_content(): models with "gemini" in the name are routed to :embedContent via t_is_vertex_embed_content_model(), while older text-embedding-* models continue to use :predict. This version also enforces a single-content-per-call limit for the embedContent API, which is why FilesRetrieval sets embed_batch_size=1. Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com> PiperOrigin-RevId: 883689438
…provision an Agent Engine if neither agent_engine_resource_name nor sandbox_resource_name is provided The AgentEngineSandboxCodeExecutor now has three initialization modes: 1. Create both an Agent Engine and sandbox if neither resource name is provided. 2. Creating a new sandbox within a provided agent_engine_resource_name. 3. Using a provided sandbox_resource_name. PiperOrigin-RevId: 884088248
… execute_sql to support fine grained access controls PiperOrigin-RevId: 884166439
The metric takes into account all the turns of the multi-turn conversation. The class delegates the responsibility to Vertex Gen AI Eval SDK. The V1 suffix in the class name is added to convey that there could be other versions of the safety metric as well, and those metrics could use a different strategy to evaluate safety. Co-authored-by: Ankur Sharma <ankusharma@google.com> PiperOrigin-RevId: 884504910
Tool use: The class delegates the responsibility to Vertex Gen AI Eval SDK. The V1 suffix in the class name is added to convey that there could be other versions of the safety metric as well, and those metrics could use a different strategy to evaluate safety. Task trajectory: this metric is different from `Multi-Turn Overall Task Success`, in the sense that task success only concerns itself with the goal of whether the success was achieved or not. How that was achieved is not its concern. This metric on the other hand does care about the path that agent took to achieve the goal. Co-authored-by: Ankur Sharma <ankusharma@google.com> PiperOrigin-RevId: 884525532
Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 884557773
When using OAuth2Session with `client_secret_post`, Authlib automatically includes the client_id and client_secret in the request body. Explicitly passing `client_id` again results in a duplicate parameter in the token exchange request, which can cause issues with some OAuth providers. Close #4782 Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 884574091
## Overview This PR updates internal tutorials and demonstration guidance following the renaming of the database connectivity tools (`genai-toolbox` -> `mcp-toolbox`) and aligns resource downloads with the newly scoped artifact destinations. ## Changes * Removed references to legacy `googleapis.github.io/genai-toolbox` pages. * Updated download commands to pull binaries directly from the rebranded bucket. * Bumped the embedded curl instruction default payload target to the newly stable `v1.1.0` release tier. PiperOrigin-RevId: 900207615
…tadata Fixes #5073, #5310, and #5311 with three targeted updates to the `BigQueryAgentAnalyticsPlugin` (no changes to ADK core): - Classifies `TransferToAgentTool` transfers to `RemoteA2aAgent` as `TRANSFER_A2A` instead of the generic `TRANSFER_AGENT` by resolving the target agent at the call level. - Ensures a self-consistent BigQuery span tree by preferring the plugin's internal span stack over ambient OTel spans, resolving dangling `parent_span_id` references. - Surfaces remote A2A interaction metadata (`a2a:request`, `a2a:response`, etc.) in BigQuery by detecting them in custom metadata and logging new `A2A_INTERACTION` events. Co-authored-by: Haiyuan Cao <haiyuan@google.com> PiperOrigin-RevId: 900224778
Implement AgentEngineSandboxComputer, a BaseComputer implementation that
uses Vertex AI Agent Engine Computer Use Sandbox as a remote browser
environment. This enables computer-use agents to operate in secure,
isolated cloud-based browser environments.
Key features:
- SandboxClient: Low-level CDP client using vertexai SDK send_command()
- AgentEngineSandboxComputer: BaseComputer implementation with session
state management for sandbox sharing across invocations
- Support for both auto-provisioning and bring-your-own-sandbox (BYOS) modes
- Automatic token refresh and retry logic for transient navigation errors
- Fix wait_5_seconds adapter to properly pass tool_context
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com>
PiperOrigin-RevId: 900292803
Merge #5338 ### Summary After deploying an agent with `adk deploy agent_engine`, the generated Google Cloud Console URL uses the outdated path `agent-platform/runtimes`, which no longer resolves to the correct page. ### Changes **`src/google/adk/cli/cli_deploy.py`** Updated the URL path in `_print_agent_engine_url` from: ``` https://console.cloud.google.com/agent-platform/runtimes/locations/... ``` to: ``` https://console.cloud.google.com/vertex-ai/agents/agent-engines/locations/... ``` Fixes #5336 COPYBARA_INTEGRATE_REVIEW=#5338 from anmolg1997:fix/deploy-console-url 1fb352e PiperOrigin-RevId: 900308294
Co-authored-by: Xiang (Sean) Zhou <seanzhougoogle@google.com> PiperOrigin-RevId: 900322196
This change introduces a `live_session_id` field to the `LlmResponse` dataclass and populates it in all responses generated by the `GeminiLlmConnection` when using a Live session. This allows tracking which Live session each response belongs to. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 900354397
…ager clients Update unit tests to verify the presence and value of the client_info argument during client initialization. PiperOrigin-RevId: 900448054
Co-authored-by: Yifan Wang <wanyif@google.com> PiperOrigin-RevId: 900844698
…params This allows headers to refresh on each request. Also only add auth headers if no auth_scheme or auth_credential is specified Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 900900323
These are not used in the example Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 900902777
…vice This change introduces `_add_events_to_memory_via_ingest` in `VertexAiMemoryBankService` to support adding events to memory using the `memories.ingest_events` API. This allows passing additional configurations such as `stream_id`, `force_flush`, and `generation_trigger_config`. This path is triggered when `custom_metadata` contains `use_ingest` or `generation_trigger_config`. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 900924805
Co-authored-by: Yifan Wang <wanyif@google.com> PiperOrigin-RevId: 900943720
Merge #4705 ### Link to Issue or Description of Change - Closes: #4666 **Problem:** Gemini-2.0-flash model is still used in integration tests, but disabled for new users **Solution:** Replace all occurrences of Gemini-2.0-flash by Gemini-2.5-flash, in integration tests and docstrings. Because gemini-2.0 is still enabled for some users, this PR doesn't clean the model from unit tests. ### Testing Plan Run already existing unittests and integration tests ### 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. - [x] 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. - [x] I have manually tested my changes end-to-end. - [x] Any dependent changes have been merged and published in downstream modules. COPYBARA_INTEGRATE_REVIEW=#4705 from morganroux:fix/issues/4666 3c390a2 PiperOrigin-RevId: 900973552
During agent transfer, the input transcription is represented as user input. Also, the previous implementation is incorrect in that the LlmResponse could never have content.role == 'user'. Modified the docstring to match the behavior. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 900980704
This will allow agent transfer to work smoothly in live workflow. See the comment added for details. Closes issue #5238 Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 900993889
Related: #3716 Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 901000453
Merge #4802 **Please ensure you have read the [contribution guide](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) before creating a pull request.** ### Link to Issue or Description of Change - Closes: #4623 **Problem:** example_util.py was completely missing unit tests. **Solution:** I added unit tests for a variety of situations: - Converting a text-only example to a string - Converting a text-only example _with multiple Parts_ to a string - Converting a text-only example to a string when the output contains a conversation between the user and model - Converting another text-only example with a conversational output, but with clumped messages from each - Converting an empty list to a string - Converting an example including a function call to a string - Converting an example including a function _response_ to a string - Converting an example including both a function call _and_ a function response to a string - Converting an example with text, a function call, and a function response to a string - Building System Information from a list of examples - Building System Information from an example provider ### Testing Plan I ran the tests personally, and they successfully passed. **Unit Tests:** - [✓] I have added or updated unit tests for my change. - [✓] All unit tests pass locally. 33 passed in 2.55s **Manual End-to-End (E2E) Tests:** To test my change, simply run the unit tests and they should pass. If you want to verify the effectiveness of my tests, try modifying the input given to my unit tests and see if they fail. ### Checklist - [✓] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document. - [✓] I have performed a self-review of my own code. - [✓] 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. - [✓] 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 noticed build_example_si takes an argument for query even though it's not used if you pass in a list rather than a BaseExampleProvider. Is this expected behavior that is there for a reason, or should I open an issue for this? - I also noticed that when model is None, it defaults to Gemini 2. This seems like it could cause issues on the user end. Is there a reason for this functionality? COPYBARA_INTEGRATE_REVIEW=#4802 from BowedMars374878:Issue-#4623 efa090e PiperOrigin-RevId: 901025765
…taching reference file parts to the message Default is True to match existing behavior. Setting it to False prevents the model from loading artifact directly from a provided canonical URI, and makes the behavior consistent between InMemoryArtifactService and other services with canonical URIs. PiperOrigin-RevId: 901061080
New metrics added: - gen_ai.agent.invocation.duration - gen_ai.tool.execution.duration - gen_ai.agent.request.size - gen_ai.agent.response.size - gen_ai.agent.workflow.steps New metrics and attributes are in line with OTel semantic conventions where possible, and will be formally to the semconv later. PiperOrigin-RevId: 901156576
Co-authored-by: Kacper Jawoszek <jawoszek@google.com> PiperOrigin-RevId: 901179890
PiperOrigin-RevId: 901187928
New metrics added: - gen_ai.agent.invocation.duration - gen_ai.tool.execution.duration - gen_ai.agent.request.size - gen_ai.agent.response.size - gen_ai.agent.workflow.steps New metrics and attributes are in line with OTel semantic conventions where possible, and will be formally to the semconv later. PiperOrigin-RevId: 901223911
This change introduces a new query parameter `save_live_blob` to the `/run_live` WebSocket endpoint in the ADK web server. When set to true, this parameter enables saving of live blobs during the session. The default value is false. Unit tests are updated to cover this new parameter. Closes issue #4707 Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 901280577
…FUNC_DECL feature flag Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 901366486
…ocalEnvironment Widen the path parameter from Path to str | Path in BaseEnvironment.read_file and BaseEnvironment.write_file so that LocalEnvironment's str override no longer violates Liskov substitution. Update LocalEnvironment to match, normalizing via str() in _resolve_path. PiperOrigin-RevId: 901415944
If content and refusal chunks are interleaved, this will drop the remaining content chunks after the first refusal chunk appears. PiperOrigin-RevId: 901457248
PiperOrigin-RevId: 901509317
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated sync of v1 changes from main into v2. The oncall is responsible for reviewing and merging this PR. Resolve conflicts in favor of the v2 implementation.