reply.
While paused, reply returns a waiting notice message whose finished_reason is None: the reply is parked, not finished, and no remaining tool calls are executed until the outside result arrives.
User Confirmation
When the permission system determines a tool call needs user approval, the agent emits aRequireUserConfirmEvent and pauses.
1
2
Build the confirmation result
For each pending tool call, create a
ConfirmResult indicating whether to allow or deny it. You can also modify the tool call input or accept suggested permission rules:3
Resume the agent
Pass the
UserConfirmResultEvent back to reply or reply_stream:- Confirmed tool calls execute immediately and the agent continues reasoning
- Denied tool calls produce an error result visible to the LLM, which may retry with a different approach
- Accepted rules are persisted to the permission engine, so matching future calls are auto-allowed without prompting again
External Tool Execution
When the agent calls a tool withis_external_tool = True, it emits a RequireExternalExecutionEvent and pauses. The tool’s logic runs outside the agent, typically by a human operator or an external system.
1
2
Execute externally and build results
Run the operation outside the agent and wrap the results as
ToolResultBlock objects:3
Resume the agent
Pass the The results are injected into the agent’s context and reasoning continues from where it left off.
ExternalExecutionResultEvent back to resume:If multiple tool calls require outside interaction and only partial confirmation or execution results are passed back, the agent won’t re-send the requiring events for the unconfirmed or unexecuted tool calls.