Skip to content

[AAASM-1677] ✨ (adapters/google_adk): Add GoogleADKAdapter + GoogleADKPatch with unit tests#46

Merged
Chisanan232 merged 5 commits into
masterfrom
v0.0.1/AAASM-1677/feat/google_adk_adapter
May 21, 2026
Merged

[AAASM-1677] ✨ (adapters/google_adk): Add GoogleADKAdapter + GoogleADKPatch with unit tests#46
Chisanan232 merged 5 commits into
masterfrom
v0.0.1/AAASM-1677/feat/google_adk_adapter

Conversation

@Chisanan232
Copy link
Copy Markdown
Contributor

Description

Adds the Google ADK framework adapter to the Python SDK so that init_assembly() automatically intercepts tool calls made by Google ADK agents.

GoogleADKPatch patches google.adk.tools.BaseTool.run_async (async, kwargs-only signature) with the same allow / deny / pending governance flow used by PydanticAIPatch. GoogleADKAdapter registers the patch behind the FrameworkAdapter contract and is wired into the registry at priority 5 (between openai=4 and mcp=99). Adapter degrades gracefully when google-adk is not installed.

This is sub-task 1 of AAASM-1550 — implementation only. Integration test ships in AAASM-1678.

Type of Change

  • ✨ New feature
  • 🔧 Bug fix
  • ♻️ Refactoring
  • 🍀 Performance improvement
  • 📚 Documentation update
  • 🚀 Release

Breaking Changes

Does this PR introduce any breaking changes?

  • No
  • Yes (please describe below)

Related Issues

  • Related JIRA ticket: AAASM-1677 (parent story: AAASM-1550, epic: AAASM-5)
  • Related GitHub issues: —

Testing

Describe the testing performed for this PR:

  • Unit tests added/updated
  • Integration tests added/updated (covered in AAASM-1678)
  • Manual testing performed
  • No tests required (explain why)

Nine new unit tests in test/unit/adapters/google_adk/test_google_adk_patch.py cover allow / deny / pending governance flows, idempotent apply, clean revert, loader edge cases, agent-id resolution, and _serialize_tool_args branches. All hermetic — no google-adk install 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

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated if needed
  • All tests passing

🤖 Generated with Claude Code

…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
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
29.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 89.00524% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agent_assembly/adapters/google_adk/patch.py 91.71% 13 Missing ⚠️
agent_assembly/adapters/google_adk/adapter.py 73.33% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Chisanan232 Chisanan232 merged commit f628812 into master May 21, 2026
23 of 24 checks passed
@Chisanan232 Chisanan232 deleted the v0.0.1/AAASM-1677/feat/google_adk_adapter branch May 21, 2026 01:36
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