> ## Documentation Index
> Fetch the complete documentation index at: https://docs.matrices.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hooks

> Approve, deny, or rewrite work mid-turn.

A hook interrupts a turn to approve, deny, or rewrite what happens next. Ask a
person before sending a payment, say, or redact a result before the model reads
it, or have another agent review a response before it's saved. Hooks live on a
[profile](/model/profiles), and every agent using that profile runs them.

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "id": "approve-transfers",
  "point": "before_tool_call",
  "match": { "tools": ["payments.transfer"] },
  "processor": { "type": "client" },
  "onFailure": "fail_closed"
}
```

There are four points where a hook can step in. `before_turn_start` sees the
incoming user message. `before_tool_call` sees a tool name and input before
the tool runs. `after_tool_result` sees a result before the model does.
`after_model_response` sees the model's reply before it's saved.

A hook can only tighten things. It can't turn on a tool the roles left out,
because role checks run first, and an after-the-fact hook can't undo something
that already happened out in the world. If you want a hard boundary, leave the
tool out of the roles.

New profiles come with six removable approval hooks covering the destructive
things an agent could do on day one: deleting agents, creating roles, sending
Gmail, writing Calendar and Drive, and pointing a toolset at a URL. Send
`hooks: []` if you don't want them.

<Info>
  **Belongs to** a profile (≤ 16, in order) · **Runs at** one of four points ·
  **Processed by** `client` | `url` | `agent` · **Decides** `allow` | `deny` |
  `ask` | `defer`
</Info>

## Rules

* Approving a hook grants nothing. See [Rules](/model/rules).
* Hooks run in profile order; the first non-`defer` decision wins.
* A `client` hook pauses the turn until someone resolves the wait.

## API

* Points, processors, decisions, defaults: [Hooks](/reference/hooks).
* `GET /v1/threads?state=waiting` lists parked work;
  `POST /v1/threads/{threadId}/waits/{waitId}/resolve` clears one.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.