Repository navigation
feat(plugins): let applications customize tool retry guidance - #7607
Open
reddynitish wants to merge 1 commit into
Open
reddynitish wants to merge 1 commit into
reddynitish wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and change
Closes #7564.
Applications currently need to override private methods to customize the retry instructions sent to a model. Add the maintainer-approved
reflection_guidanceandretry_exceeded_guidanceoptions, accepting text or synchronous/asynchronous providers, plus public asyncbuild_reflection_guidanceandbuild_retry_exceeded_guidancehooks.Providers receive a frozen
ToolReflectionContextwith tool arguments, the error and its formatted details, retry count/limit andToolContext. Empty guidance is supported; invalid provider results raiseTypeErrorand provider exceptions propagate. Providers run outside the failure-tracker lock. Existing defaults andToolFailureResponsefields remain unchanged, including the capped retry count on the exhausted path.Companion documentation: google/adk-docs#2443 (draft until this implementation lands).
Testing plan and results
git diff --check: passed.lookuptool twice withmax_retries=1. The first FunctionResponse carried custom async guidance; the second carried custom exhausted guidance. Both retainedValueError,ticket unavailable, retry count 1 and the plugin-owned response type:The Runner check used the actual
LlmAgent, tool and plugin flow with the existingMockModel/TestInMemoryRunnertest helpers; no live model requests.tox -p autocompleted:The full suites are not green: every version fails only
tests/unittests/integrations/vmaas/test_agent_engine_environment.py::test_reading_directory_raises(DID NOT RAISE OSError). The same test fails on all four versions in a separate, clean checkout of unchanged base commite2dbc0f, using the same dependencies. That unrelated directory-read test is left outside this focused plugin change.Code/tests were drafted with Gemini CLI assistance, then reviewed, simplified and independently validated with Codex assistance.