5757from google .adk .agents .loop_agent import LoopAgent
5858from google .adk .agents .readonly_context import ReadonlyContext
5959from google .adk .agents .sequential_agent import SequentialAgent
60+ from google .adk .models import Gemini
6061from google .adk .tools .exit_loop_tool import exit_loop
6162from google .adk .tools .tool_context import ToolContext
63+ from google .genai import types
64+
65+ # Retry configuration for handling API rate limits and overload
66+ _RETRY_OPTIONS = types .HttpRetryOptions (
67+ initial_delay = 10 ,
68+ attempts = 8 ,
69+ exp_base = 2 ,
70+ max_delay = 300 ,
71+ http_status_codes = [429 , 503 ],
72+ )
73+
74+ # Use gemini-3-pro-preview for planning and summary (better quality)
75+ GEMINI_PRO_WITH_RETRY = Gemini (
76+ model = "gemini-3-pro-preview" ,
77+ retry_options = _RETRY_OPTIONS ,
78+ )
6279
6380# Maximum number of files per analysis group to avoid context overflow
6481MAX_FILES_PER_GROUP = 5
@@ -249,7 +266,7 @@ def get_release_context(tool_context: ToolContext) -> dict[str, Any]:
249266# =============================================================================
250267
251268planner_agent = Agent (
252- model = "gemini-2.5-pro" ,
269+ model = GEMINI_PRO_WITH_RETRY ,
253270 name = "release_planner" ,
254271 description = (
255272 "Plans the analysis by fetching release info and organizing files into"
@@ -272,12 +289,12 @@ def get_release_context(tool_context: ToolContext) -> dict[str, Any]:
272289
2732903. Call `get_changed_files_summary` to get the list of changed files WITHOUT
274291 the full patches (to save context space).
275- - **IMPORTANT**: Pass `local_repo_path="{ LOCAL_REPOS_DIR_PATH } /{ CODE_REPO } "`
276- to use local git and avoid GitHub API's 300-file limit.
292+ - **IMPORTANT**: Pass these parameters:
293+ - `local_repo_path="{ LOCAL_REPOS_DIR_PATH } /{ CODE_REPO } "` to avoid 300-file limit
294+ - `path_filter="src/google/adk/"` to only get ADK source files (reduces token usage)
277295
278- 4. Filter and organize the files:
279- - **INCLUDE** only files in `src/google/adk/` directory
280- - **EXCLUDE** test files, `__init__.py`, and files outside src/
296+ 4. Further filter the returned files:
297+ - **EXCLUDE** test files and `__init__.py` files
281298 - **IMPORTANT**: Do NOT exclude any file just because it has few changes.
282299 Even single-line changes to public APIs need documentation updates.
283300 - **PRIORITIZE** by importance:
@@ -423,7 +440,7 @@ def file_analyzer_instruction(readonly_context: ReadonlyContext) -> str:
423440
424441
425442file_group_analyzer = Agent (
426- model = "gemini-2.5-pro" ,
443+ model = GEMINI_PRO_WITH_RETRY ,
427444 name = "file_group_analyzer" ,
428445 description = (
429446 "Analyzes a group of changed files and generates recommendations."
@@ -507,7 +524,7 @@ def summary_instruction(readonly_context: ReadonlyContext) -> str:
507524
508525
509526summary_agent = Agent (
510- model = "gemini-2.5-pro" ,
527+ model = GEMINI_PRO_WITH_RETRY ,
511528 name = "summary_agent" ,
512529 description = "Compiles recommendations and creates the GitHub issue." ,
513530 instruction = summary_instruction ,
@@ -542,7 +559,7 @@ def summary_instruction(readonly_context: ReadonlyContext) -> str:
542559# =============================================================================
543560
544561root_agent = Agent (
545- model = "gemini-2.5-pro" ,
562+ model = GEMINI_PRO_WITH_RETRY ,
546563 name = "adk_release_analyzer" ,
547564 description = (
548565 "Analyzes ADK Python releases and generates documentation update"
0 commit comments