[AAASM-1677] ✨ (adapters/google_adk): Add GoogleADKAdapter + GoogleADKPatch with unit tests#46
Merged
Conversation
…eTool.run_async Patches `google.adk.tools.BaseTool.run_async` (kwargs-only `(self, *, args, tool_context)` signature) to route every tool invocation through the governance callback's `check_tool_start` / `record_result` hooks. Mirrors `PydanticAIPatch`: same allow / deny / pending decision flow, idempotent apply, clean revert. Loader falls back to None when `google.adk.tools` is not importable so `apply()` returns False gracefully. Refs: AAASM-1677
…dapter
Wraps `GoogleADKPatch` behind the `FrameworkAdapter` contract.
`get_framework_name()` returns `google_adk`; `is_available()` is overridden
to call `importlib.util.find_spec("google.adk")` (with a guard for the
`ModuleNotFoundError` raised when the parent `google` namespace package is
not installed). `register_hooks()` / `unregister_hooks()` delegate to
`apply()` / `revert()`.
Refs: AAASM-1677
Public-API surface for the adapter package now matches the convention used by the sibling adapter packages (`pydantic_ai`, `openai_agents`): both the adapter class and its underlying patch class are importable from the package root. Refs: AAASM-1677
Adds GoogleADKAdapter to the builtin_adapters list and assigns it priority slot 5 in the global ordering (between openai=4 and mcp=99). Auto-detect now activates Google ADK whenever the optional `google-adk` package is installed. Refs: AAASM-1677
Nine tests:
* idempotent apply leaves the wrapper in place,
* revert restores the original method and clears process agent id,
* loader returns None and `apply()` is False without `google-adk`,
* loader returns None when `google.adk.tools.BaseTool` is not a class,
* allow flow returns original result,
* deny flow raises PolicyViolationError ("blocked by governance policy"),
* pending flow routes through `wait_for_tool_approval` and surfaces a
rejection error ("rejected during approval"),
* agent-id resolution falls back to the process default,
* `_serialize_tool_args` handles pydantic-style, mapping, and scalar inputs.
All tests run hermetically with a `monkeypatch` on `importlib.import_module`
so they do not require `google-adk` to be installed.
Refs: AAASM-1677
17 tasks
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.


Description
Adds the Google ADK framework adapter to the Python SDK so that
init_assembly()automatically intercepts tool calls made by Google ADK agents.GoogleADKPatchpatchesgoogle.adk.tools.BaseTool.run_async(async, kwargs-only signature) with the same allow / deny / pending governance flow used byPydanticAIPatch.GoogleADKAdapterregisters the patch behind theFrameworkAdaptercontract and is wired into the registry at priority 5 (betweenopenai=4andmcp=99). Adapter degrades gracefully whengoogle-adkis not installed.This is sub-task 1 of AAASM-1550 — implementation only. Integration test ships in AAASM-1678.
Type of Change
Breaking Changes
Does this PR introduce any breaking changes?
Related Issues
Testing
Describe the testing performed for this PR:
Nine new unit tests in
test/unit/adapters/google_adk/test_google_adk_patch.pycover allow / deny / pending governance flows, idempotent apply, clean revert, loader edge cases, agent-id resolution, and_serialize_tool_argsbranches. All hermetic — nogoogle-adkinstall required. Local run:```text
test/unit/adapters/google_adk/test_google_adk_patch.py ........... 9 passed
test/unit/adapters/test_registry.py ............................. 8 passed
Full suite: 351 passed, 9 skipped (1 perf-sensitive bench flake; passed on rerun)
```
mypy agent_assembly/adapters/google_adk agent_assembly/adapters/registry.py→ no issues.isort --check --profile=black→ pass.Checklist
🤖 Generated with Claude Code