Skip to content

Commit 69f37a7

Browse files
test: fix agent instruction to demonstrate full on_stop hook cycle
Updated the example to: - Allow agent to fix errors when hook denies (instead of preventing fixes) - Increased max_runs from 5 to 10 to give agent time to fix issues The example now demonstrates the complete cycle: 1. Agent creates broken file 2. Stop hook denies with feedback 3. Agent fixes the issue 4. Agent finishes successfully Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 071702b commit 69f37a7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/02_remote_agent_server/01_convo_with_local_agent_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ def hook_event_tracker(event):
227227
"Create a Python file called 'test_broken.py' in the current directory "
228228
"with an obvious syntax error (like 'def broken(:\n pass' - missing "
229229
"closing parenthesis). After creating the file, immediately use the "
230-
"finish action. Do NOT fix the syntax error yourself - I want to test "
231-
"the validation hook."
230+
"finish action. If you receive any feedback about errors, fix them and "
231+
"try to finish again."
232232
)
233233

234234
# Generate title using a specific LLM
@@ -246,7 +246,7 @@ def hook_event_tracker(event):
246246
# When a stop hook denies, the state goes: running -> finished -> running
247247
# The client's run() may return when it sees 'finished', so we need to
248248
# check if the agent is still running and continue
249-
max_runs = 5 # Prevent infinite loops
249+
max_runs = 10 # Allow enough retries for agent to fix issues
250250
run_count = 0
251251
while run_count < max_runs:
252252
run_count += 1

0 commit comments

Comments
 (0)