Expand description
The stop tool: ends the agent loop gracefully.
The tool calls the agent’s cancel with after_current_tools, so the rest of the tool batch
still runs, then the loop ends with StopReason::Cancelled and
the message as the final assistant message. The model sees the same message as the result.
Structs§
- Make
Stop Options - Options for
make_stop(MakeStopOptions). - Make
Stop Options Builder - Use builder syntax to set the inputs and finish with
build().
Constants§
- DEFAULT_
MAX_ STOP_ MESSAGE_ LENGTH - The default cap on
message, in characters (DEFAULT_MAX_STOP_MESSAGE_LENGTH). - DEFAULT_
STOP_ DESCRIPTION - The description of the
stoptool shown to the model (DEFAULT_STOP_DESCRIPTION). - DEFAULT_
STOP_ MESSAGE - The final assistant message when the model gives none (
DEFAULT_STOP_MESSAGE).
Functions§
- make_
stop - Creates a stop tool. An absent,
nullor emptymessagebecomesDEFAULT_STOP_MESSAGE, so the loop always ends with a final message. - stop
- The default
stoptool (stop).