# Use hooks

Detailed API reference for each session hook in the GitHub Copilot SDK.

## Links

* [Error handling hook](/en/copilot/how-tos/copilot-sdk/hooks/error-handling)

  The onErrorOccurred hook is called when errors occur during session execution. Use it to:

* [Session hooks](/en/copilot/how-tos/copilot-sdk/hooks/hooks-overview)

  Hooks allow you to intercept and customize the behavior of Copilot sessions at key points in the conversation lifecycle. Use hooks to:

* [Post-tool use hook](/en/copilot/how-tos/copilot-sdk/hooks/post-tool-use)

  The onPostToolUse hook is called after a tool executes successfully. Use it to:

* [Pre-tool use hook](/en/copilot/how-tos/copilot-sdk/hooks/pre-tool-use)

  The onPreToolUse hook is called before a tool executes. Use it to:

* [Session lifecycle hooks](/en/copilot/how-tos/copilot-sdk/hooks/session-lifecycle)

  Session lifecycle hooks let you respond to session start and end events. Use them to:

* [User prompt submitted hook](/en/copilot/how-tos/copilot-sdk/hooks/user-prompt-submitted)

  The onUserPromptSubmitted hook is called when a user submits a message. Use it to: