Skip to content

Feat/google adk polish - #26

Merged
nagasatish007 merged 8 commits into
agentguard-ai:mainfrom
amanishimwe:feat/google-adk-polish
Aug 17, 2026
Merged

Feat/google adk polish#26
nagasatish007 merged 8 commits into
agentguard-ai:mainfrom
amanishimwe:feat/google-adk-polish

Conversation

@amanishimwe

@amanishimwe amanishimwe commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

Polishes the Google ADK integration for TealTiger: exports TealTigerCallback, adds Gemini pricing entries, wires model-based tool cost estimates (with fallback), and adds unit tests plus a runnable example.

Fixes #324

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • [x ] Test improvements

Changes Made

  • Export TealTigerCallback from tealtiger. integrations
  • Add Gemini model pricing (gemini-2.5-flash, gemini-2.5-pro, gemini-3.5-flash, gemini-3.6-flash)
  • Estimate ADK tool cost from get_model_pricing (fixed 500/500 token estimate); fall back to cost_per_tool_call when pricing is missing
  • Add examples/google_adk_governance.py (mock before_tool / after_tool demo, no API key required)
  • Add/extend tests in tests/test_google_adk_integration.py and Gemini pricing coverage in tests/cost/test_pricing.py

Testing

Describe the tests you ran to verify your changes:

  • Unit tests pass (pytest)
  • Type checking passes (mypy src)
  • Linting passes (ruff check src tests)
  • Manual testing performed
  • Added new tests for new functionality

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Breaking Changes

None

Screenshots (if applicable)

N/A

Additional Notes

  • Tool cost is an estimate (500 input + 500 output tokens) when the model exists in the pricing table; it is not live token usage from ADK.
  • A follow-up contribution to Google ADK contributing is planned separately (CLA required).
  • before_tool retains # noqa: C901 for pre-existing complexity.

@amanishimwe

Copy link
Copy Markdown
Contributor Author

@nagasatish007 , when you get time, please look at this one as well. A follow-up contribution to Google ADK contributing is planned separately (CLA required)

@nagasatish007

Copy link
Copy Markdown
Contributor

Thanks @amanishimwe — good work on this. The scope is clear and the PR description is thorough.

Looks good:

  • Export wiring for TealTigerCallback from integrations ✅
  • Gemini pricing entries (2.5-flash, 2.5-pro, 3.5-flash, 3.6-flash) ✅
  • Runnable example with no API key dependency ✅
  • Test coverage for both integration and pricing ✅

Questions/suggestions before merge:

  1. Fixed 500/500 token estimate for tool cost — is there a way to pull actual token counts from the ADK callback context (before_tool/after_tool)? Even an approximate count from len(str(args)) would be more accurate than a static 500. If ADK doesn't expose this, the fixed estimate is fine for now but let's add a # TODO: use actual token counts when ADK exposes them comment.

  2. CI status — showing 5/21 checks passing. Are the failures pre-existing (like the TypeScript repo's CostStorage issue) or related to this PR? If pre-existing, note that in a comment so we can track separately.

  3. # noqa: C901 in before_tool — understood it's pre-existing complexity. If you have bandwidth in a follow-up, would be good to refactor that method (extract helper functions for policy evaluation vs. cost tracking). Not blocking this PR though.

  4. Gemini model naming — are gemini-3.5-flash and gemini-3.6-flash confirmed production model names from Google? Want to make sure we're not adding pricing for beta/unreleased model IDs that might change.

Overall this is ready to merge once CI is clarified. Nice contribution 👍

@nagasatish007

Copy link
Copy Markdown
Contributor

@amanishimwe Also please join our Discore server : https://discord.gg/ZnCEd5Mk2

@amanishimwe

amanishimwe commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@nagasatish007 Thanks for the review — I have addressed your comments as follows:
Token estimate
Updated cost estimation to use an approximate count from len(str(payload)) // 4 when args/result are available, with 500 kept only as a fallback when they’re not. Added # TODO: use actual token counts when ADK exposes them.
# noqa: C901 in before_tool
Refactored policy evaluation into helpers (_check_freeze, _check_tool_allowlist, _check_pii, _check_secrets, _check_cost_limit) and removed the noqa.
Gemini model naming
Confirmed gemini-3.5-flash and gemini-3.6-flash are production/stable model IDs in Google’s Gemini API docs
CI
These are pre-existing and not related to my changes

@amanishimwe

Copy link
Copy Markdown
Contributor Author

@nagasatish007 if you get time, look at this PR.

Keep ruff/isort happy on the ADK polish branch without changing behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
@nagasatish007
nagasatish007 merged commit eb38752 into agentguard-ai:main Aug 17, 2026
6 of 21 checks passed
@nagasatish007

Copy link
Copy Markdown
Contributor

@amanishimwe — reviewed the latest changes. All four items from my earlier review are addressed:

  1. ✅ Token estimate improved with len(str(payload)) // 4 + TODO comment for when ADK exposes actual counts
  2. before_tool refactored into clean helper functions — much better
  3. ✅ Gemini model names confirmed
  4. ✅ CI failures noted as pre-existing

One note: the import sorting commit (c9deb56) touches 74 files that aren't related to the ADK feature. Not blocking, but in the future it's cleaner to keep style-only changes in a separate PR — makes review easier and git blame cleaner.

Merging this. Nice work 👍

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.

2 participants