From 7c67c3e0c752b3fec519555f48f4959119a75858 Mon Sep 17 00:00:00 2001 From: Ling-Sen Peng Date: Wed, 12 Aug 2026 12:34:55 -0700 Subject: [PATCH] Fix 09c_hitl_streaming: approval pause never fires MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- examples/agents/09c_hitl_streaming.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/agents/09c_hitl_streaming.py b/examples/agents/09c_hitl_streaming.py index b5b77be7..49b18da7 100644 --- a/examples/agents/09c_hitl_streaming.py +++ b/examples/agents/09c_hitl_streaming.py @@ -41,9 +41,14 @@ def delete_service_data(service_name: str, data_type: str) -> dict: model=settings.llm_model, tools=[check_service, restart_service, delete_service_data], instructions=( - "You are an operations assistant. You can check, restart, and manage services. " - "If a service is unhealthy, check it first, then restart it. Only suggest " - "deleting data if explicitly asked." + "You are an operations assistant. Work through the request one tool call at a " + "time, in this order:\n" + "1. Check the service with check_service.\n" + "2. If it is unhealthy, restart it with restart_service.\n" + "3. Last, if the user asked you to clear or delete data, call " + "delete_service_data.\n" + "A human approves the deletion, not you — delete_service_data pauses for that " + "approval by itself, so never ask for approval in your own reply." ), )