37 Commits

Author SHA1 Message Date
George Weale c44c543e93 fix(deps): stop the published constraints from pinning google-adk itself
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 963725078
2026-08-12 16:34:06 -07:00
Xuan Yang 470d59e4a3 fix: prevent update_constraints.sh from rewriting files when dependencies are unchanged
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 963527637
2026-08-12 10:30:29 -07:00
Xuan Yang 566fca3fa9 fix: Update CI workflow to use uv and adjust codespell configuration
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 960912014
2026-08-07 07:12:10 -07:00
George Weale 91773dd3c2 chore: use gemini-3.5-flash for changelog highlights drafting
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 960583408
2026-08-06 17:08:53 -07:00
Xuan Yang 942b38df34 feat: enforce unit guide requirement for new Python files
Update check_new_py_files.sh pre-commit check to enforce that all newly added Python source files require a corresponding unit guide in docs/guides/.

Allows authors to bypass the check when appropriate by adding a NO_UNIT_GUIDE tag to the commit message or changelist description.

Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 960581639
2026-08-06 17:05:02 -07:00
George Weale 656af9306d chore: prune redundant entries from the mTLS exclusion list
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 960529884
2026-08-06 15:15:28 -07:00
George Weale e0b6c9a939 chore: check the release wheel imports no worse than the last release
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 960416330
2026-08-06 11:32:31 -07:00
George Weale 07add3b888 refactor(types): make the agents, sessions, flows and workflow packages pass strict mypy
Not annotations-only. This is one component's slice of a repo-wide typing
cleanup, and the wider change was found to contain behavior changes that have
not all been individually triaged, so please review it as a functional change.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 958554313
2026-08-03 13:42:03 -07:00
Amy Wu 75c773ed9d feat: Publish companion constraints-3.11.txt and constraints-3.12.txt file for transitive dependency protection (4 day buffer to protect from supply chain attack)
For example, use pip install google-adk -c constraints-3.12.txt

PiperOrigin-RevId: 954863904
2026-07-27 15:33:06 -07:00
h-tsuboi918 1478e1aa21 ci: ignore OAuth scopes in endpoint check
Merge https://github.com/google/adk-python/pull/6245

Fixes #6238

PiperOrigin-RevId: 954813339
2026-07-27 13:56:21 -07:00
Xuan Yang 9dd4e7bfb6 chore: Update check_new_py_files.sh to use absolute paths and exclude non-source directories
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 953041397
2026-07-23 17:21:53 -07:00
Haran Rajkumar cc444b6cbf docs(samples): add ManagedAgent remote MCP (Maps Grounding Lite) sample
Add a runnable sample wiring `ManagedAgent` to the Maps Grounding Lite MCP
server via `RemoteMcpServer`, with a `header_provider` callback that reads
`GOOGLE_MAPS_API_KEY` and sends it as the `X-Goog-Api-Key` header. Demonstrates
server-side remote MCP execution with runtime header minting.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 947137422
2026-07-13 11:07:40 -07:00
Shahin Saadati c0fa51b33f feat: add skill to verify markdown code snippets
Merge https://github.com/google/adk-python/pull/6212

The skill extracts Python code blocks from a markdown file, executes each in an isolated environment, and generates a report covering load, run, and coverage status.

Fixes #6211

Also includes fixes for:
- Weakref GC of mock scheduler in test_context.
- check_new_py_files.sh path matching in monorepo environments.

PiperOrigin-RevId: 945889882
2026-07-10 14:21:13 -07:00
Haran Rajkumar 2e2ec09a76 feat(agents): support remote MCP servers for ManagedAgent with runtime header callbacks
Add `RemoteMcpServer`, a server-side remote MCP tool for `ManagedAgent`. The
Managed Agents / Interactions API runs the MCP server itself, so ADK only
forwards the server URL and headers as an `MCPServerParam` and never opens an
MCP session. A `header_provider` callback (the same contract as the `LlmAgent`
`McpToolset.header_provider`) mints auth headers at request time, driven by the
runner, and is merged over any static headers so a fresh token can be generated
per turn.

Only remote (HTTP/streamable) MCP servers are supported; raw
`types.Tool.mcp_servers` remains rejected. Includes a live integration test
against Maps Grounding Lite, scoped to the Gemini Developer API backend; the
Vertex Interactions endpoint does not yet accept the `mcp_server` tool param
(consistent with google-genai documenting `types.Tool.mcp_servers` as
unsupported on Vertex AI).

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 945306712
2026-07-09 14:07:52 -07:00
George Weale 2de8a53525 chore: clean, fold, and sync the release changelog PR
Expands the release-cut changelog curation so the release PR looks good
by default. curate_changelog.py now normalizes the newest section
(unescape HTML entities, de-link stray @mentions, drop duplicate
entries from the same change, lowercase each entry's leading word),
folds large releases under a <details> block (sized by
--fold-threshold / CHANGELOG_FOLD_THRESHOLD, default 12), and can emit
the curated section via --section-out. The release-cut workflow now
mirrors that section into the PR description, and its curation steps run
whenever a release PR exists (not only when newly created), so
regenerate runs stay curated too.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 944860270
2026-07-08 20:35:56 -07:00
Haran Rajkumar 63561ce719 feat(scripts): add check for private-by-default new Python files
Add scripts/check_new_py_files.py, which enforces ADK's private-by-default
policy: a newly-added Python file under src/google/adk/ must have a '_'-prefixed
basename (expose public API via __init__.py / __all__ instead). Newly-added
files are detected by comparing the checked-out tree against a baseline source
tree, so the check needs no git history.

Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 943513793
2026-07-06 15:04:25 -07:00
Xuan Yang 48e6e504eb chore: Update check_new_py_files.sh to run in multiple VCS environments
Co-authored-by: Xuan Yang <xygoogle@google.com>
PiperOrigin-RevId: 941262556
2026-07-01 13:22:23 -07:00
George Weale c91fc752a5 fix: exclude scripts/ from pre-commit compliance checks
scripts/compliance_checks.py documents and matches the very patterns it
forbids, so the compliance-checks hook (which scanned every .py file)
flagged itself and failed on every PR running pre-commit on all files.
Skip the dev-only scripts/ directory. Also clears pre-existing pyink and
end-of-file drift surfaced by the same all-files run.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 940618068
2026-06-30 13:10:51 -07:00
George Weale 4d8fbf7136 chore: auto-draft changelog highlights during release cut
After release-please opens the release PR, draft a Highlights section at the top
of the new CHANGELOG.md version and commit it to the PR branch, so releases lead
with what matters instead of the raw commit list. Drafting uses Gemini and falls
back to an empty Highlights template when unavailable, so it never blocks the
release.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 940206960
2026-06-29 21:36:21 -07:00
Shangjie Chen 8a7656b857 refactor(ci): Consolidate compliance checks into pre-commit hook
Move custom file compliance checks (logger pattern, future annotations,
cli imports, mTLS endpoints) from GHA inline bash scripts to a unified
python script (compliance_checks.py) and expose it as a local pre-commit hook.
Remove the compliance-check job from CI workflow.

Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 940081615
2026-06-29 15:59:28 -07:00
George Weale 21512ea13c fix: add trailing newline to check_new_py_files.sh
PR #6155 added the Apache license header to this script but dropped its
trailing newline, so the end-of-file-fixer pre-commit hook now fails on
every PR. Restore the newline.

Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 936246147
2026-06-22 14:15:48 -07:00
Milen Kovachev 3cbcefce9f chore: add missing Apache 2.0 license headers
Merge https://github.com/google/adk-python/pull/6155

**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

**1. Link to an existing issue (if applicable):**
N/A

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

**Problem:**
The repository is missing Apache 2.0 license headers across 155 files. This is required by Google OSPO.

**Solution:**
Prepended the standard Apache 2.0 open-source license header to all flagged files. The copyright year was dynamically assigned based on each file's first commit year in git history.

### Testing Plan

_Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes._

**Unit Tests:**

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

_Please include a summary of passed `pytest` results._
N/A - This PR only adds comments (license headers) to the top of files and contains zero functional code changes. No new tests are needed, and existing tests should pass as-is.

**Manual End-to-End (E2E) Tests:**
N/A - No functional code was changed.

### 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.
- [ ] 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

Co-authored-by: Shangjie Chen <deanchen@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6155 from milenvk:fix-missing-licenses d2a264b9a812fd997daf975ec37996e6b4b7a042
PiperOrigin-RevId: 936165783
2026-06-22 11:37:57 -07:00
Wei Sun (Jack) 5054784b67 chore: remove internal helper scripts and clean up unused imports
Co-authored-by: Wei Sun (Jack) <weisun@google.com>
PiperOrigin-RevId: 931538760
2026-06-13 00:24:06 -07:00
Wei (Jack) Sun 7cae06e001 chore: Adopt ruff for unused-import enforcement
Merge https://github.com/google/adk-python/pull/6097

## Summary

Adopts **ruff** to enforce unused-import (F401) hygiene going forward, so dead imports are caught automatically instead of relying on IDE highlights. (The bulk one-time cleanup already landed in #6095; this is just the tooling.)

- `[tool.ruff]` in `pyproject.toml`: select `F401`, exempt `__init__.py` (intentional public re-exports), and exclude four files that hardcode `googleapis.com` URLs so cleanup doesn't trip the `check-file-contents` mTLS policy.
- ruff pre-commit hook scoped to `src/`.
- `scripts/run_precommit_checks.py` (the no-git standalone runner) learns the ruff hook, passing `--force-exclude` so excludes are honored on explicit file args.
- Pin `ruff` in the dev extra to match the hook version.

## Test plan

- [x] `ruff check src/` passes (excludes honored)
- [x] pre-commit ruff hook runs green
- [x] standalone runner check/fix modes verified

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6097 from google:chore/adopt-ruff-f401 b0636523926d02f12af4b86cff2b1a1bb94af150
PiperOrigin-RevId: 931304052
2026-06-12 13:28:02 -07:00
Wei (Jack) Sun b170f7bdf5 chore(dev): add standalone pre-commit check script
Merge https://github.com/google/adk-python/pull/6084

## Summary

Adds `scripts/run_precommit_checks.py` to run the `.pre-commit-config.yaml` checks **without** the `pre-commit` framework, which requires a git repository and so cannot run in environments such as a piper checkout that has no `.git`.

- Parses `.pre-commit-config.yaml` so the file lists, global/per-hook `exclude` and `files` patterns, and `args` all come from the config — only the hook-id → CLI command mapping (and each hook's implicit file-type/text filter) is maintained in the script.
- Defaults to fixing in place; pass `--check` to verify only (CI behavior).
- Limits the walk to `src`/`tests`/`contributing`/`pyproject.toml` and never follows symlinks, so `.venv`, build artifacts, and out-of-repo code (e.g. a symlinked `a2a`) are never touched.
- Skips binary files for text fixers, and batches arguments to stay under the OS arg limit.
- `scripts/run_precommit.sh` is a thin wrapper that prefers an already-synced interpreter (`.venv` / active venv) before falling back to `uv run`.
- Adds the standalone lint tools to the `dev` extra (capped at the next major) so `uv sync --extra dev` provides everything the script needs.

## Test plan

- [ ] `scripts/run_precommit.sh --check` passes on a clean tree
- [ ] `scripts/run_precommit.sh` (default fix mode) does not modify binaries (images/PDFs) or `.venv`
- [ ] Runs from any directory; PATH args are repo-root-relative
- [ ] `addlicense` / `check-new-py-prefix` degrade gracefully when unavailable / git-only

Co-authored-by: Wei Sun (Jack) <weisun@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6084 from google:chore/dev-precommit-script fa3863332f9acf824df2a3ad3b923141d7838f5d
PiperOrigin-RevId: 930799785
2026-06-11 16:27:47 -07:00
George Weale 9127febfd5 fix: remove the issue/PR analyze and fix agent workflows
Co-authored-by: George Weale <gweale@google.com>
PiperOrigin-RevId: 929277910
2026-06-09 10:37:02 -07:00
Bo Yang 04924bfb44 ci(workflows): Support running analysis on pull request comments
Enables issue analysis workflow to trigger on comments posted to pull requests. This is done by removing the `!github.event.issue.pull_request` check from the GHA issue analysis workflow definition, since GitHub models PR comments under the `issue_comment` event. The fix implementation workflow remains restricted to issues to prevent PR-on-PR loops and permission issues.

- Update scripts/run_antigravity.py to include comments and review comments in JSON payloads fetched by helper tools.
- Update adk-issue and adk-issue-analyze skills to prevent routing conflicts when /adk-issue-analyze is explicitly requested.
- Update branch validation in issue-fix workflow to fail if the agent does not successfully create and checkout fix/issue-<number>.
- Update adk-issue-fix skill branch template to match expected GHA workflow fallback pattern.

Change-Id: I34405266bb6b11cc4ad18878ef932bb46677c89d
2026-06-04 13:27:26 -07:00
Bo Yang ded6dbb55a ci(workflow): Support intermediate steps output in Antigravity runner
- Adds secure command policy to the LocalAgentConfig in scripts/run_antigravity.py
  that denies unsafe command executions and checks for shell injection.
- Allows both `gh` and `git` commands to be executed by the agent runner.
- Adds custom `fetch_github_issue` and `fetch_github_pr` Python tools to the
  Antigravity agent runner configuration, using `curl` to enable direct JSON
  metadata fetches from GitHub without requiring a configured `gh` CLI environment.
- Introduces the --show-steps CLI flag to scripts/run_antigravity.py
  to output intermediate thoughts, tool calls, and tool results (default off).
- Updates .github/workflows/issue-analyze.yml to capture stdout from the
  runner script, run automatic triage for any user's opened issues, and post
  the report to the triggering GitHub issue as a comment via the `gh` CLI tool.
- Updates the adk-issue-analyze and adk-pr-triage skills to prefer using the
  custom `fetch_github_issue` Python tool over raw `gh` command lines, and
  strictly enforces that the issue-analyze skill is read-only and must not edit files.

Change-Id: I58a9c64f0680a56d07b9877cbcb9ffe027afeee2
2026-06-03 16:10:34 -07:00
Bo Yang b0f4b917be ci(workflow): Run issue analysis using Antigravity Python SDK
Installs the public google-antigravity SDK via pip and executes a runner
python script scripts/run_antigravity.py to run any antigravity prompts.
This replaces the Node-based @google/antigravity CLI tool, and allows general
executions via Python.

Change-Id: Iade60816b4613567e261934a46285d7933adfc00
2026-06-03 14:54:47 -07:00
Sasha Sobran 162279358c chore: switch main to v2.0.0 GA (transition to v2)
Co-authored-by: Bo Yang <ybo@google.com>
Co-authored-by: Wei Sun (Jack) <weisun@google.com>
Co-authored-by: George Weale <gweale@google.com>
Co-authored-by: Swapnil Agarwal <swapnilag@google.com>
Co-authored-by: Xuan Yang <xygoogle@google.com>
Co-authored-by: Shangjie Chen <deanchen@google.com>
Co-authored-by: Yifan Wang <wanyif@google.com>
Co-authored-by: Kathy Wu <wukathy@google.com>
2026-05-19 02:01:33 +00:00
Shangjie Chen c6d02c8198 chore: Format contributing folder using pre-commit
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 904672556
2026-04-23 15:44:03 -07:00
Divyansh Shukla b3fcd8a21f feat: Add ability to run individual unit tests to unittests.sh
PiperOrigin-RevId: 888314229
2026-03-23 15:38:23 -07:00
Divyansh Shukla e6476c9790 fix: Prevent uv.lock modifications in unittests.sh
PiperOrigin-RevId: 884597343
2026-03-16 13:01:15 -07:00
Divyansh Shukla 6f6fd955f6 fix: Fix IDE hangs by moving test venv and cache to /tmp
PiperOrigin-RevId: 882270600
2026-03-11 17:04:24 -07:00
Liang Wu 845818be44 ci: only use --extra test for unit tests
This can fix unit test github action error by removing `--extra eval`. `--extra a2a` is not needed because it's included in `test`. All tests are still passing.

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 869014318
2026-02-11 21:39:48 -08:00
Liang Wu 025b42c836 chore: Add unittests.sh script and update CONTRIBUTING.md
This change introduces a new `unittests.sh` script to simplify running unit tests. The script automatically sets up a minimal test environment, runs `pytest`, and then restores the previous development environment. The CONTRIBUTING.md has been updated to include instructions on using this new script.

Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 860222798
2026-01-23 13:01:06 -08:00
Dongyu Jia 338c3c89c6 fix: Add example and fix for loading and upgrading old ADK session databases
This change introduces a sample (`migration_session_db`) demonstrating how to load a session database created with an older version of ADK (e.g., 1.15.0) and make it compatible with the current version. It includes a script (`db_migration.sh`) to alter the SQLite schema automatically. to_event is updated to handle potential discrepancies in pickled `EventActions` by using `model_copy` to ensure compatibility with the latest `EventActions` model definition.

Related to #3272 #3197, Closes #3197 #3272

Co-authored-by: Dongyu Jia <dongyuj@google.com>
PiperOrigin-RevId: 826524368
2025-10-31 09:47:53 -07:00