Skip to content

Commit 0a1573a

Browse files
amabitoamabito
authored andcommitted
fix: address review feedback from gemini-code-assist
- 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
1 parent 831f30c commit 0a1573a

4 files changed

Lines changed: 8 additions & 15 deletions

File tree

contributing/samples/governance/main.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,22 @@
2929
from google.adk import Runner
3030
from google.adk.agents import Agent
3131
from google.adk.sessions import InMemorySessionService
32+
from google.genai import types
3233

33-
from google.adk_community.governance import (
34-
GovernanceConfig,
35-
VeronicaGovernancePlugin,
36-
)
34+
from google.adk_community.governance import GovernanceConfig
35+
from google.adk_community.governance import VeronicaGovernancePlugin
3736

3837
logging.basicConfig(level=logging.INFO, format="%(message)s")
3938

4039

4140
def main():
4241
# Configure governance limits
4342
config = GovernanceConfig(
44-
max_cost_usd=0.50, # org-level: 50 cents
45-
agent_max_cost_usd=0.25, # per-agent: 25 cents
46-
failure_threshold=3, # circuit breaker after 3 failures
43+
max_cost_usd=0.50, # org-level: 50 cents
44+
agent_max_cost_usd=0.25, # per-agent: 25 cents
45+
failure_threshold=3, # circuit breaker after 3 failures
4746
recovery_timeout_s=30.0,
48-
degradation_threshold=0.7, # degrade at 70% budget
47+
degradation_threshold=0.7, # degrade at 70% budget
4948
fallback_model="gemini-2.0-flash-lite",
5049
blocked_tools=["shell_exec"],
5150
disable_tools_on_degrade=["web_search"],
@@ -67,8 +66,7 @@ def main():
6766
model="gemini-2.5-flash",
6867
name="summarizer",
6968
instruction=(
70-
"You summarize text provided to you. Keep summaries to 2-3"
71-
" sentences."
69+
"You summarize text provided to you. Keep summaries to 2-3 sentences."
7270
),
7371
)
7472

@@ -98,8 +96,6 @@ async def run():
9896
user_id="demo_user",
9997
)
10098

101-
from google.genai import types
102-
10399
user_message = types.Content(
104100
role="user",
105101
parts=[types.Part(text="What is agent governance?")],

src/google/adk_community/governance/_budget.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from __future__ import annotations
1818

1919
from dataclasses import dataclass
20-
from dataclasses import field
2120
import threading
2221

2322

src/google/adk_community/governance/_degradation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from __future__ import annotations
1818

1919
from dataclasses import dataclass
20-
from dataclasses import field
2120
import threading
2221

2322

src/google/adk_community/governance/veronica_governance_plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from typing import Any
2929
from typing import Optional
3030

31-
from google.adk.agents.base_agent import BaseAgent
3231
from google.adk.agents.callback_context import CallbackContext
3332
from google.adk.agents.invocation_context import InvocationContext
3433
from google.adk.models.llm_request import LlmRequest

0 commit comments

Comments
 (0)