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

# Isolation modes

> Modes 1–6 with honest requirements — warm pool default, k8s and branch DB fallbacks.

Multi-recorder = one sandbox session per Record. Junnu and Laddu each get a distinct `sandboxId`.

## Overview

| Mode | Key | Behavior |
| - | - | - |
| 1 | `schema_prefix` | Dedicated SQL schema + Redis key prefix |
| 2 | `dedicated_db` | Dedicated Postgres database + Redis DB index |
| 3 | `warm_pool` | **Default.** Checkout a pre-warmed (1) or (2) slot |
| 4 | `docker_session` | Per-session Compose sandbox project |
| 5 | `k8s_job` | Per-session k8s Pod+Service |
| 6 | `branch_db` | Branchable Postgres + Redis prefix |

```bash theme={null}
# Concurrent recorders — Junnu and Laddu each get a distinct sandboxId
curl -X POST http://127.0.0.1:4100/api/projects/demo-coffee/sessions \
  -H 'x-alibi-api-key: junnu-key-demo' \
  -H 'content-type: application/json' \
  -d '{"recorder":"junnu","isolationMode":"warm_pool"}'

curl -X POST http://127.0.0.1:4100/api/projects/demo-coffee/sessions \
  -H 'x-alibi-api-key: laddu-key-demo' \
  -H 'content-type: application/json' \
  -d '{"recorder":"laddu","isolationMode":"warm_pool"}'
```

Drive each brother’s traffic with his own `x-alibi-sandbox-id`. After Junnu saves a case, Laddu can list/run it project-wide.

Pool APIs: `GET/POST /api/projects/:id/sandboxes`, `POST .../sandboxes/warm`, `POST .../sandboxes/pool`, `POST .../sandboxes/reap`.

## Mode 4 — `docker_session`

Requires Docker socket + Compose plugin in the CP image, and:

```bash theme={null}
ALIBI_HOST_REPO_DIR=$(pwd) docker compose up
```

so sandbox bind mounts resolve on the host. Without Docker, Session Start fails for this mode (no soft-PASS).

## Mode 5 — `k8s_job`

Per session the control plane renders `k8s/sandbox/sandbox-job.yaml` (Pod + NodePort Service) and runs `kubectl apply`. Session Stop deletes the Pod/Service.

| Env | Default | Purpose |
| - | - | - |
| `ALIBI_K8S_NAMESPACE` | `alibi-sandboxes` | Target namespace |
| `ALIBI_K8S_MANIFEST_DIR` | `k8s/sandbox` | Template directory |
| `ALIBI_K8S_FAIL_CLOSED` | `0` | When `1`, failed kubectl → Session Start error |

**CI / no cluster:** Start still succeeds with a **logical** binding (`k8s.status` explains the skip), unless fail-closed is on.

## Mode 6 — `branch_db`

Branchable Postgres plus a dedicated Redis key prefix (`alibi:br_<slot>:`).

| Env | Default | Purpose |
| - | - | - |
| `ALIBI_BRANCH_PROVIDER` | `local` | `local` or `neon` |
| `ALIBI_BRANCH_TEMPLATE_DB` | admin DB name | `CREATE DATABASE … TEMPLATE` source |
| `ALIBI_BRANCH_API_KEY` / `NEON_API_KEY` | — | Neon API bearer token |
| `ALIBI_BRANCH_FAIL_CLOSED` | `0` | When `1` + Neon, missing creds → error |

**`local` (CI-friendly):** `CREATE DATABASE alibi_br_* TEMPLATE <template>` via `psql`. If the template stays busy, falls back to an empty DB (`branch.status=local:empty-fallback`).

**`neon`:** Creates a branch via Neon API. Default soft-falls back to local when credentials/API fail; set `ALIBI_BRANCH_FAIL_CLOSED=1` to refuse instead.

## Smoke

```bash theme={null}
./scripts/smoke_isolation_56.sh
```


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