An agent hook is an automatic handler attached to a specific event in an AI agent's lifecycle. It can run when a session starts, before a tool is used, after a file changes, when a task finishes, or when the agent needs approval. Depending on the system, the handler may be a script, an HTTP request, a rules check, or another tightly scoped AI step.

Hooks matter because they add predictable control around a probabilistic model. You can ask an agent to remember to format every edited file, but a post-edit hook can run the formatter every time the event matches. A pre-tool hook can block access to protected files; a completion hook can send a notification; a session-start hook can load fresh project context.

That makes a hook different from an agent skill. A skill supplies reusable know-how that the agent chooses or is told to use. A hook is wired to an event and fires automatically. It is also different from a system prompt: the prompt influences behavior, while the hook can enforce a concrete check outside the model.

Why it matters at your desk. In an AI coding workflow such as Cursor, a small team might run tests after agent edits, reject changes to secrets, or alert a reviewer when a long refactor finishes. The same pattern can protect a publishing workflow by requiring a metadata check before a draft moves forward.

Treat hooks as production automation, not decorative settings. A hook may run code or send data whenever its event occurs, so inspect what it does, keep its permissions narrow, and make failures visible. Use deterministic hooks for rules you can state precisely; use human review when the decision still requires judgment.