Skip to content

[AAASM-4839] ♻️ (examples): Use public google_adk adapter API, drop private internals#340

Merged
Chisanan232 merged 2 commits into
masterfrom
v0.0.1/AAASM-4839/adk_public_api
Jul 18, 2026
Merged

[AAASM-4839] ♻️ (examples): Use public google_adk adapter API, drop private internals#340
Chisanan232 merged 2 commits into
masterfrom
v0.0.1/AAASM-4839/adk_public_api

Conversation

@Chisanan232

Copy link
Copy Markdown
Contributor

What changed

The google-adk example's governance wiring (python/google-adk/src/governance.py) called underscore-prefixed SDK internals — agent_assembly.adapters.google_adk.patch._apply_tool_run_async_patch / _revert_tool_run_async_patch — which the SDK labels internal, not intended for SDK users and ships unversioned, so the example would break on any point release with no deprecation path. It now uses the SDK's public GoogleADKAdapter.register_hooks() / unregister_hooks() — the same entrypoint init_assembly() uses to install ADK governance in a live deployment. The README's "Adapter / version note" is updated to match.

SDK gap (documented, not worked around): the public adapter only auto-discovers concrete tools exported from google.adk.tools; it has no public entrypoint to govern a single caller-supplied tool class. This example's DemoTool is a local BaseTool subclass, so govern_tool_class registers it into the adapter's public discovery scope before applying the hooks (a production agent exposing real google.adk.tools tools needs no such bridging). A future public per-class governance API — or migrating the demo tool to a real google.adk.tools.FunctionTool (outside this ticket's single-file scope) — would remove even that step.

Only public exports are used: GoogleADKAdapter is in agent_assembly.adapters.google_adk.__all__.

Related ticket

Closes AAASM-4839
Jira: https://lightning-dust-mite.atlassian.net/browse/AAASM-4839

How to verify

cd python/google-adk
uv sync --extra dev
uv run pytest tests/ -v          # 7 passed
uv run python src/main.py        # offline: get_weather ALLOWED, delete_records BLOCKED, send_email BLOCKED (pending→denied)

python -m py_compile src/governance.py passes; grep confirms no underscore-prefixed / .patch internals remain in governance.py.

Checklist

  • PR title follows [AAASM-XXXX] <GitEmoji> (<scope>): <summary>
  • No secrets, API keys, or .env files committed
  • Example sub-projects include their own README.md with prerequisites and run instructions
  • SDK/runtime version dependencies are documented or pinned

🤖 Generated with Claude Code

Rewrite google-adk governance wiring against the SDK's public
GoogleADKAdapter.register_hooks / unregister_hooks — the same entrypoint
init_assembly uses to install ADK governance — instead of the underscore-
prefixed google_adk.patch internals (_apply_tool_run_async_patch /
_revert_tool_run_async_patch), which the SDK labels internal and ships
unversioned.

The public adapter only auto-discovers concrete tools exported from
google.adk.tools, so the example's local DemoTool subclass is registered
into that public discovery scope before the hooks apply. Documented as an
SDK gap: no public per-class governance entrypoint.

Refs AAASM-4839
Refresh the "Adapter / version note" to describe the public GoogleADKAdapter
concrete-tool patching now used by src/governance.py, replacing the stale
description of the removed private-patch mechanism.

Refs AAASM-4839
@sonarqubecloud

Copy link
Copy Markdown

@Chisanan232

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code — PR review

Scope (AAASM-4839, MED): ✅ google-adk example uses the public GoogleADKAdapter.register_hooks() (private _apply_* removed); the 'no public per-class governance API' gap documented; delete stays BLOCKED, 7 smoke pass.

  1. CI ✅ green. 2. Scope ✅ governance.py + note. 3. Side effects none. 4. FE n/a. Verdict: ready to merge pending Pioneer approval.

@Chisanan232
Chisanan232 merged commit 1f99dff into master Jul 18, 2026
26 checks passed
@Chisanan232
Chisanan232 deleted the v0.0.1/AAASM-4839/adk_public_api branch July 18, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant