Return this from a PostToolUse hook to stop the run or to change what the
agent's tool_end event reports. The model always sees the tool's real
result.
Usage
HookResultPostToolUse(
continue = TRUE,
suppress_output = FALSE,
updated_tool_output = NULL,
additional_context = NULL,
stop_reason = NULL
)Arguments
- continue
TRUEorFALSE.FALSEstops the run after this tool call.- suppress_output
If
TRUE, leave the result out of thetool_endevent.- updated_tool_output
Optional value to report in the
tool_endevent instead of the tool's result.- additional_context
Optional text to add to the agent's system prompt. It stays there for later turns; the same text is only added once.
- stop_reason
Optional stop reason used when
continue = FALSE. Defaults to"hook_requested_stop".
See also
CallbackResult for reading result fields.
Examples
# Continue execution
HookResultPostToolUse()
#> <deputy::HookResultPostToolUse>
#> @ continue : logi TRUE
#> @ suppress_output : logi FALSE
#> @ updated_tool_output: NULL
#> @ additional_context : NULL
#> @ stop_reason : NULL
# Stop after this tool
HookResultPostToolUse(continue = FALSE)
#> <deputy::HookResultPostToolUse>
#> @ continue : logi FALSE
#> @ suppress_output : logi FALSE
#> @ updated_tool_output: NULL
#> @ additional_context : NULL
#> @ stop_reason : NULL