---
title: "Hooks"
description: "Run install and setup commands at sandbox lifecycle points with hooks.SandboxReady."
---

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

# Hooks

**Hooks** run shell commands at points in a sandbox's lifecycle. They're how you
install dependencies, select a runtime, or do any one-time setup so the agent
starts from a ready-to-work environment.

## `SandboxReady`

`SandboxReady` is the hook that runs once the sandbox is up and your repository
is checked out — before preview processes start. Provide an **array of commands**;
they run **in order**.

```json
{
  "hooks": {
"SandboxReady": [
  { "command": "source /usr/local/share/nvm/nvm.sh && nvm use 24" },
  { "command": "bun install" }
]
  }
}
```

Each entry is an object with a **`command`** string. Commands run in your
repository's working directory.

## What to put here

- **Install dependencies** — `bun install`, `npm ci`, `pip install -r requirements.txt`, etc.
- **Select a runtime/toolchain** — e.g. activate a Node version.
- **One-time setup** — generate code, prepare a database schema, seed fixtures.

> **Keep it fast and deterministic**
>
> Hooks run on every sandbox. Prefer commands that are idempotent and reasonably
> quick — heavy setup slows down every session, task, and automation. Hook
> execution is time-bounded, so long-running processes belong in
> [preview processes](/configuration/preview), not hooks.

Source: https://docs.trevize.dev/configuration/hooks/index.mdx
