One change
Intercept and control agent behavior with hooks
agent-sdk/hooks
agent-sdk/hooks Changed · +6 / -8 lines
from line 645
### Forward notifications to Slack -Use `Notification` hooks to receive system notifications from the agent and forward them to external services. Notifications fire for event types such as: +Use `Notification` hooks to receive system notifications from the agent and forward them to external services. In SDK sessions, Claude Code runs this hook for the following notification types: -* `permission_prompt` when Claude needs permission -* `idle_prompt` when Claude is waiting for input -* `auth_success` when authentication completes -* `elicitation_dialog`, `elicitation_complete`, and `elicitation_response` for user-prompt elicitation flows +* [`permission_prompt`](/docs/en/hooks#notification) once a permission request has waited about six seconds on your [`canUseTool` callback](/docs/en/agent-sdk/user-input). Requires TypeScript Agent SDK v0.3.233 or later, or Python Agent SDK v0.2.139 or later +* `elicitation_complete` and `elicitation_response` for user-prompt elicitation flows -In headless SDK sessions, only the elicitation events `elicitation_complete` and `elicitation_response` fire this hook; the other types are emitted by interactive UI that SDK sessions don't run. Permission requests, for example, go to the `canUseTool` callback instead. +Claude Code emits the other types, such as `idle_prompt`, `auth_success`, and `elicitation_dialog`, from interactive UI that SDK sessions don't run. Each notification includes a `message` field with a human-readable description and optionally a `title`.