feat: add governance plugin (budget, circuit breaker, degradation)#100
feat: add governance plugin (budget, circuit breaker, degradation)#100amabito wants to merge 2 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the ADK's capabilities by introducing a comprehensive governance plugin. This plugin addresses critical needs in multi-agent systems, such as cost control, fault tolerance, and resource optimization. By providing configurable budget limits, a circuit breaker for agent stability, tool usage policies, and intelligent model degradation, it empowers developers to build more resilient and cost-effective AI applications. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive governance plugin with features for budget control, circuit breaking, tool policies, and service degradation. The implementation is well-structured across several modules and includes a thorough set of unit tests, which is excellent. My review focuses on minor code cleanup and style consistency. I've identified a few unused imports and one import that could be moved to follow PEP 8 guidelines. Overall, this is a high-quality contribution.
| user_id="demo_user", | ||
| ) | ||
|
|
||
| from google.genai import types |
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
| from dataclasses import field |
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass | ||
| from dataclasses import field |
| from typing import Any | ||
| from typing import Optional | ||
|
|
||
| from google.adk.agents.base_agent import BaseAgent |
Adds src/google/adk_community/governance/ with VeronicaGovernancePlugin, a BasePlugin that enforces per-agent and org-level budget limits, isolates failing agents via circuit breaker, blocks disallowed tools, and degrades to cheaper models when budget runs low. 56 tests, isort + pyink formatted, no extra dependencies.
- Move google.genai types import to top of main.py (PEP 8) - Remove unused import: dataclasses.field in _budget.py, _degradation.py - Remove unused import: BaseAgent in veronica_governance_plugin.py
f0788a1 to
0a1573a
Compare
|
Addressed all 4 review comments in 0a1573a: moved import to top-level, removed unused |
|
Hey @Jacksunwei @hangfei -- noticed there are ~20 open community PRs with no reviews. Is this repo still actively maintained? Happy to help with reviews if that's useful. Just want to know if it's worth iterating on this PR or if the process has moved somewhere else. |
PR Title
feat: add governance plugin (budget, circuit breaker, degradation)
PR Description
Why are these changes needed?
ADK has
max_llm_callsin RunConfig and callback hooks for custom logic, but nothing for budget limits or failure isolation. In multi-agent workflows there's no way to cap spending per agent, isolate one that keeps failing, or switch to a cheaper model when budget runs low.This adds a
governancemodule underadk_communitywith aVeronicaGovernancePluginthat covers these cases.What this adds
src/google/adk_community/governance/-- a BasePlugin implementation with:before_model_callback/after_model_callback. Blocks calls that would exceed limits.Config is a single
GovernanceConfigPydantic model, registered on the Runner viaplugins=[...].Related issue number
N/A (new contribution)
Design decisions
google-adk.governance/(alongsidememory/andsessions/) rather thanplugins/veronica/-- leaves room for other impls.Files
Checks
pytest ./tests/unittests/governancepasses (56/56).