Stop Hook

Agent SDK

Definition

An Agent SDK lifecycle hook that runs when the agent reaches an end_turn stop condition. Can inspect the final response and decide whether to allow the stop or inject additional instructions to continue the loop. Used for output validation and quality gates.

Example Usage

Use a Stop hook to verify the agent produced a complete response before allowing end_turn, injecting a prompt to continue if the response is incomplete.