{"meta":{"title":"Use hooks","intro":"Detailed API reference for each session hook in the GitHub Copilot SDK.","product":"GitHub Copilot","breadcrumbs":[{"href":"/en/copilot","title":"GitHub Copilot"},{"href":"/en/copilot/how-tos","title":"How-tos"},{"href":"/en/copilot/how-tos/copilot-sdk","title":"Copilot SDK"},{"href":"/en/copilot/how-tos/copilot-sdk/hooks","title":"Use hooks"}],"documentType":"subcategory"},"body":"# Use hooks\n\nDetailed API reference for each session hook in the GitHub Copilot SDK.\n\n## Links\n\n* [Error handling hook](/en/copilot/how-tos/copilot-sdk/hooks/error-handling)\n\n  The onErrorOccurred hook is called when errors occur during session execution. Use it to:\n\n* [Session hooks](/en/copilot/how-tos/copilot-sdk/hooks/hooks-overview)\n\n  Hooks allow you to intercept and customize the behavior of Copilot sessions at key points in the conversation lifecycle. Use hooks to:\n\n* [Post-tool use hook](/en/copilot/how-tos/copilot-sdk/hooks/post-tool-use)\n\n  The onPostToolUse hook is called after a tool executes successfully. Use it to:\n\n* [Pre-tool use hook](/en/copilot/how-tos/copilot-sdk/hooks/pre-tool-use)\n\n  The onPreToolUse hook is called before a tool executes. Use it to:\n\n* [Session lifecycle hooks](/en/copilot/how-tos/copilot-sdk/hooks/session-lifecycle)\n\n  Session lifecycle hooks let you respond to session start and end events. Use them to:\n\n* [User prompt submitted hook](/en/copilot/how-tos/copilot-sdk/hooks/user-prompt-submitted)\n\n  The onUserPromptSubmitted hook is called when a user submits a message. Use it to:\n\n* [User prompt transformed hook](/en/copilot/how-tos/copilot-sdk/hooks/user-prompt-transformed)\n\n  The userPromptTransformed hook runs after the runtime adds generated context to a submitted prompt, but before the resulting content is persisted to session history or sent to the model."}