Commit Graph
943 Commits
Author SHA1 Message Date
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
Lusha WangandCopybara-Service dab80e4a8f 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.

Co-authored-by: Lusha Wang <lusha@google.com>
PiperOrigin-RevId: 874415933
2026-02-23 23:52:09 -08:00
Google Team MemberandCopybara-Service 1dbceccf36 fix: update Spanner query tools to async functions
PiperOrigin-RevId: 874318392
2026-02-23 18:46:37 -08:00
Kathy WuandCopybara-Service c33d614004 feat: Update Agent Registry to create AgentCard from info in get agents endpoint
Get agents API design is being updated to return full AgentCard instead of agent card url - while it's being rolled out, update get agents method to instantiate agent card from existing fields.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 874285065
2026-02-23 16:44:48 -08:00
Sasha SobranandCopybara-Service 445dc189e9 fix: remove duplicate session GET when using API server, unbreak auto_session_create when using API server
Co-authored-by: Sasha Sobran <asobran@google.com>
PiperOrigin-RevId: 874188082
2026-02-23 12:01:24 -08:00
George WealeandCopybara-Service 2dbd1f25bd fix: Add OpenAI strict JSON schema enforcement in LiteLLM
This change introduces a recursive function to transform JSON schemas to meet OpenAI's strict mode requirements, including adding "additionalProperties: false" to all object schemas, making all properties required, and stripping sibling keywords from $ref nodes. The schema conversion uses deep copies to not mutating the original input

Close #4573

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 874174994
2026-02-23 11:35:35 -08:00
Google Team MemberandCopybara-Service b1e33a90b4 fix: use correct msg_out/msg_err keys for Agent Engine sandbox output
PiperOrigin-RevId: 874126181
2026-02-23 09:56:49 -08:00
George WealeandCopybara-Service 4ca904f111 fix: Add push notification config store to agent_to_a2a
This change allows users to provide a custom PushNotificationConfigStore when converting an ADK agent to an A2A Starlette application. If no custom store is provided, an InMemoryPushNotificationConfigStore is used by default, thios now lets A2A push notification configuration RPCs

Close #4126

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 874118109
2026-02-23 09:41:16 -08:00
George WealeandCopybara-Service ffbcc0a626 fix: Keep query params embedded in OpenAPI paths when using httpx
The migration from requests to httpx in v1.24.0 broke ApplicationIntegrationToolset because httpx replaces the URL query string when a `params` dict is passed, even if empty. The requests library merged them instead. This extracts any query parameters embedded in the URL path into the explicit params dict before passing to httpx.

Close #4555

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 874112143
2026-02-23 09:29:22 -08:00
Google Team MemberandCopybara-Service 87fcd77caa feat: Add interceptor framework to A2aAgentExecutor
This change introduces an interceptor mechanism allowing custom logic to be executed before agent runs, after each event, and after the agent run completes. New dependencies are added to support these features.

PiperOrigin-RevId: 873952199
2026-02-23 02:15:41 -08:00
Haiyuan CaoandCopybara-Service 223d9a7ff5 feat: Agent Skills spec compliance — validation, aliases, scripts, and auto-injection
Close gaps between ADK's Agent Skills implementation and the public
Agent Skills spec (agentskills.io/specification):

- Frontmatter: add field validators for name (kebab-case, max 64),
  description (non-empty, max 1024), compatibility (max 500);
  add allowed-tools alias; add extra='allow'; add populate_by_name
- utils: extract _parse_skill_md helper; use model_validate() for
  alias support; enforce name-dir matching; add validate_skill_dir()
  and read_skill_properties()
- prompt: accept Union[Frontmatter, Skill];
- skill_toolset: add scripts/ resource loading; auto-inject system
  instruction (with inject_instruction opt-out); duplicate name check;
  _list_skills() returns Skill objects
- sample agent: remove manual instruction (auto-injected now)

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 873177060
2026-02-20 19:56:43 -08:00
Haiyuan CaoandCopybara-Service 4260ef0c7c feat: Add schema auto-upgrade, tool provenance, HITL tracing, and span hierarchy fix to BigQuery Agent Analytics plugin
This CL adds four enhancements to the BigQuery Agent Analytics plugin and fixes a span hierarchy corruption bug.

- **Schema Auto-Upgrade:** Additive-only schema migration that automatically adds missing columns to existing BQ tables on startup. A `adk_schema_version` label on the table (starting at `"1"`, bumped with each schema change) makes the check idempotent — the diff runs at most once per version. Enabled by default (`auto_schema_upgrade=True`) because upgrades are additive-only and fail-safe. Pre-versioning tables (no label) are treated as outdated, diffed, and stamped. No previous schema versions need to be stored; the logic diffs actual columns against the current canonical schema.

- **Tool Provenance:** Adds `tool_origin` to TOOL_* event content, distinguishing six origin types — `LOCAL` (FunctionTool), `MCP` (McpTool), `A2A` (AgentTool wrapping RemoteA2aAgent), `SUB_AGENT` (AgentTool), `TRANSFER_AGENT` (TransferToAgentTool), and `UNKNOWN` (fallback) — via `isinstance()` checks with lazy imports to avoid circular dependencies.

- **HITL Tracing:** Emits dedicated HITL event types (`HITL_CONFIRMATION_REQUEST`, `HITL_CREDENTIAL_REQUEST`, `HITL_INPUT_REQUEST` + `_COMPLETED` variants) for human-in-the-loop interactions. Detection lives in `on_event_callback` (for synthetic `adk_request_*` FunctionCall events emitted by the framework) and `on_user_message_callback` (for `adk_request_*` FunctionResponse completions sent by the user), not in tool callbacks — because `adk_request_*` names are synthetic function calls that bypass `before_tool_callback`/`after_tool_callback` entirely.

- **Span Hierarchy Fix (#4561):** Removes `context.attach()`/`context.detach()` calls from `TraceManager.push_span()`, `attach_current_span()`, and `pop_span()`. The plugin was injecting its spans into the shared OTel context, which corrupted the framework's span hierarchy when an external exporter (e.g. `opentelemetry-instrumentation-vertexai`) was active — causing `call_llm` to be re-parented under `llm_request` and parent spans to show shorter durations than children. The plugin now tracks span_id/parent_span_id via its internal contextvar stack without mutating ambient OTel context.

Co-authored-by: Haiyuan Cao <haiyuan@google.com>
PiperOrigin-RevId: 873114688
2026-02-20 16:13:19 -08:00
George WealeandCopybara-Service e8019b1b1b fix: Refactor LiteLLM streaming response parsing for compatibility with LiteLLM 1.81+
Updates _model_response_to_chunk to better handle LiteLLM's streaming delta/message structure, including prioritizing delta when it contains meaningful content and preserving reasoning_content

Close #4225

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 873097502
2026-02-20 15:24:29 -08:00
George WealeandCopybara-Service 485fcb84e3 feat: Add intra-invocation compaction and token compaction pre-request
Compact session events before LLM calls when token threshold is exceeded

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 873095899
2026-02-20 15:19:45 -08:00
Kathy WuandCopybara-Service abaa92944c feat: Agent Registry in ADK
Client library for the Agent Registry API that allows users to discover, look up, and connect to agents and MCP servers cataloged in the registry.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 873073675
2026-02-20 14:25:08 -08:00
Google Team MemberandCopybara-Service 9c4c445369 feat: Add /chat/completions integration to ApigeeLlm
PiperOrigin-RevId: 873049983
2026-02-20 13:27:22 -08:00
Google Team MemberandCopybara-Service 09ee3c3695 ADK changes
PiperOrigin-RevId: 873013637
2026-02-20 11:59:54 -08:00
George WealeandCopybara-Service a7b509763c feat: Use --memory_service_uri in ADK CLI run command
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 873000092
2026-02-20 11:29:02 -08:00
George WealeandCopybara-Service e6b601a2ab fix: Invoke on_tool_error_callback for missing tools in live mode
In live mode, when the model calls an unregistered tool, ADK now runs on_tool_error_callback before failing. If the callback returns a response, ADK emits
that function response and continues; otherwise it keeps the old ValueError

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 872996178
2026-02-20 11:20:51 -08:00
Kathy WuandCopybara-Service 7478bdaa98 fix: Parallelize tool resolution in LlmAgent.canonical_tools()
Previously we resolved tools sequentially by awaiting _convert_tool_union_to_tools() in a loop -- reduce the latency by resolving tools concurrently.

Co-authored-by: Kathy Wu <wukathy@google.com>
PiperOrigin-RevId: 872979105
2026-02-20 10:45:18 -08:00
Sahaja Reddy Pabbathi ReddyandCopybara-Service bef3f117b4 feat: Bigquery ADK support for search catalog tool
Merge https://github.com/google/adk-python/pull/4171

**Problem:**
The BigQuery ADK tools currently lack the ability to search for and discover BigQuery assets using the Dataplex Catalog. Users cannot leverage Dataplex's search capabilities within the ADK to find relevant data assets before querying them.

**Solution:**
This PR integrates a new search_catalog_tool into the BigQuery ADK. This tool utilizes the dataplex catalog client library to interact with the Dataplex API, allowing users to search the catalog.

**Unit Tests:**

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

Added the screenshots of the manual adk web UI tests - https://docs.google.com/document/d/1c_lMW7NYGKuLAvPFmSkLehbqySeNyXQIhzQlvo3ixmQ/edit?usp=sharing

### 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=https://github.com/google/adk-python/pull/4171 from sahaajaaa:sahaajaaa-bq-adk 3dbbaa4f909cb25259e8e7d73a00a58fbe9c2f09
PiperOrigin-RevId: 872951141
2026-02-20 09:55:29 -08:00
George WealeandCopybara-Service a39ca946d6 chore: Add sqlite_span_exporter for .adk folder traces
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 872948208
2026-02-20 09:49:38 -08:00
George WealeandCopybara-Service 4a88804ec7 feat: Add support for memory consolidation via Vertex AI Memory Bank
This change allows `add_memory` to use the `memories.generate` API with `direct_memories_source` when `custom_metadata["enable_consolidation"]` is set to True. This enables server-side consolidation of the provided memories

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 872554004
2026-02-19 13:59:31 -08:00
George WealeandCopybara-Service eaf50ce37e chore: provide a way to disable model check for builtin tools
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 872503435
2026-02-19 12:02:27 -08:00
George WealeandCopybara-Service f27a9cfb87 fix: Expand add_memory to accept MemoryEntry
The `add_memory` methods in `Context` and `BaseMemoryService` now accept `MemoryEntry` objects in addition to strings. The Vertex AI Memory Bank service implementation is updated to handle these new types

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 872108561
2026-02-18 17:06:17 -08:00