Skip to content

Commit 01bac62

Browse files
hangfeicopybara-github
authored andcommitted
chore: Update agent instructions and retry limit in plugin_reflect_tool_retry sample
The agent's instructions are updated to guide it to guess a positive integer, starting from 50 and decreasing, using the `guess_number_tool` until the target is found. The maximum number of retries for the `CustomRetryPlugin` is increased from 6 to 10. Co-authored-by: Hangfei Lin <hangfei@google.com> PiperOrigin-RevId: 830984481
1 parent 01a0309 commit 01bac62

File tree

1 file changed

+9
-2
lines changed
  • contributing/samples/plugin_reflect_tool_retry/basic

1 file changed

+9
-2
lines changed

contributing/samples/plugin_reflect_tool_retry/basic/agent.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,17 @@ async def extract_error_from_result(
5656
return result if result.get("status") == "error" else None
5757

5858

59+
# Sample query: "guess a number between 1 and 50"
5960
root_agent = LlmAgent(
6061
name="hello_world",
6162
description="Helpful agent",
62-
instruction="""Use guess_number_tool to guess a number.""",
63+
instruction="""Your goal is to guess a secret positive integer by using the
64+
`guess_number_tool`.
65+
The tool will provide feedback on each guess.
66+
Your objective is to keep guessing until guess_number_tool returns
67+
'status: success'.
68+
Start by guessing 50, and use the tool's feedback to adjust your guesses
69+
and find the target number.""",
6370
model="gemini-2.5-flash",
6471
tools=[guess_number_tool],
6572
)
@@ -70,7 +77,7 @@ async def extract_error_from_result(
7077
root_agent=root_agent,
7178
plugins=[
7279
CustomRetryPlugin(
73-
max_retries=6, throw_exception_if_retry_exceeded=False
80+
max_retries=20, throw_exception_if_retry_exceeded=False
7481
),
7582
LoggingPlugin(),
7683
],

0 commit comments

Comments
 (0)