Skip to content

Hooks

Run install and setup commands at sandbox lifecycle points with hooks.SandboxReady.

Updated View as Markdown

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.

{
  "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 dependenciesbun 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.
Navigation

Type to search…

↑↓ navigate↵ selectEsc close