Skip to content

Commit eeb95e9

Browse files
Fix 09c_hitl_streaming: approval pause never fires
The agent's instructions said "Only suggest deleting data if explicitly asked", so the model returned the approval question as its final answer (finishReason: STOP) instead of calling the tool. No WAITING event was emitted, so the example's approval handler never ran and the approval_required=True pause it exists to demonstrate never fired. Reworded as ordered steps that name the tool and leave approval to the gate. Verified 4/4 on openai/gpt-4o-mini and anthropic/claude-sonnet-4-5: check -> restart -> approval pause -> delete. A one-word suggest->delete change is not enough: any prose phrasing states the deletion as a permission, and gpt-4o-mini treats a permission as optional — it restarts, reports success, and skips the tool (0/5 across two prose variants). Numbered imperative steps get it executed.
1 parent a24c4da commit eeb95e9

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

examples/agents/09c_hitl_streaming.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ def delete_service_data(service_name: str, data_type: str) -> dict:
4141
model=settings.llm_model,
4242
tools=[check_service, restart_service, delete_service_data],
4343
instructions=(
44-
"You are an operations assistant. You can check, restart, and manage services. "
45-
"If a service is unhealthy, check it first, then restart it. Only suggest "
46-
"deleting data if explicitly asked."
44+
"You are an operations assistant. Work through the request one tool call at a "
45+
"time, in this order:\n"
46+
"1. Check the service with check_service.\n"
47+
"2. If it is unhealthy, restart it with restart_service.\n"
48+
"3. Last, if the user asked you to clear or delete data, call "
49+
"delete_service_data.\n"
50+
"A human approves the deletion, not you — delete_service_data pauses for that "
51+
"approval by itself, so never ask for approval in your own reply."
4752
),
4853
)
4954

0 commit comments

Comments
 (0)