# Pangea — Full Platform Reference for AI Agents > Self-contained guide to Pangea (`https://pangea.host`) for coding agents and MCP clients. Everything in this document reflects live platform behavior, CLI commands, MCP tools, and five-meter billing limits. --- ## 1. What Pangea Is & Onboarding Flow Pangea is an AI-agent-first container hosting platform. Daily build, deploy, secret, AI, domain, worker, preview, and sandbox workflows are designed to be operated directly by coding agents via the `pangea` CLI and bundled stdio MCP server (`pangea mcp`), while the Web Console (`https://pangea.host/console/...`) focuses on account sign-in, credential issuance, billing, governance, observations, and final approvals for irreversible deletion. ### Onboarding Flow (4 Steps) 1. **Sign in**: Authenticate with Google or GitHub at `https://pangea.host/account`. Accounts with a verified primary email can be linked in `/account` so personal workspaces and shared team apps appear together. Signing in alone does not start billing or hosting. 2. **Select a plan at `https://pangea.host/billing`**: - **Cardless Free Sandbox (`$0/mo`)**: Instant activation with a linked GitHub account created 30+ days ago (`1` workspace per GitHub account, no credit card, `15`-minute auto-sleep, daily/total sandbox caps; cardless workspaces with zero HTTP traffic and zero deploys for 30 consecutive days may be archived or deleted after advance email notice). - **Card-verified Free Sandbox (`$0/mo`)**: Complete a `$0` Stripe `SetupIntent` card check (`1` per unique card) to unlock GitHub Actions CI, PR previews, and `1`-hour idle sleep. Free Sandbox never auto-upgrades to a paid plan. - **Paid plans (`Mini $9/mo` through `Scale $79/mo`, or `Custom`)**: Unlock always-on apps (`--no-sleep`), custom domains, background workers, horizontal autoscaling, higher capacities, and team collaborators (`Launch $19+`). 3. **Download a 90-day connection file at `https://pangea.host/console/connect`**: - One unified key covers the user's personal workspace and all shared team workspaces they have access to (owner, co-admin, or read-only viewer). - Credentials are valid for up to **90 days** (maximum 5 active keys; explicit renewal and revocation; no auto-renewal). - **Security rule**: Never read or paste `.token` file contents into chat, logs, Git, or model context. Pass only the local file path (`$HOME/Downloads/pangea-cli-tok_.token`). 4. **Install CLI, log into default config, and register MCP**: - Requires **Python 3.10+** (`python3.13`, `python3.12`, `python3.11`, `python3.10`, or verified `python3 >= 3.10`) in an isolated venv (`$HOME/.local/share/pangea/cli-`), verifying the wheel SHA-256 against `SHA256SUMS`. - Symlink `"$HOME/.local/share/pangea/cli-/bin/pangea"` to `"$HOME/.local/bin/pangea"` and add `$HOME/.local/bin` to `PATH`. - Move the token file to `$HOME/.config/pangea/` with `chmod 600` (`umask 077`, dir `chmod 700`) and run: ```bash pangea login --endpoint 'https://pangea.host/api/agent' --token-file "$HOME/.config/pangea/" ``` - `pangea login` saves to the **default profile** (`~/.config/pangea/client.json`), so all new terminals, chat sessions, and `pangea mcp` work automatically without setting `PANGEA_CLIENT_CONFIG` per session. (`PANGEA_PROFILE=` is optional for multiple accounts.) - Register `pangea mcp` permanently in the client's MCP config using the resolved absolute path to `$HOME/.local/bin/pangea` (recommended for GUI apps where `~/.local/bin` may not be in `PATH`): ```json { "mcpServers": { "pangea": { "command": "/Users/you/.local/bin/pangea", "args": ["mcp"] } } } ``` - Verify with `pangea whoami` and `pangea projects` (or `pangea_whoami` / `pangea_list_projects`). --- ## 2. Dockerfile HTTP App Rules & Project Lifecycle Pangea deploys containerized HTTP applications using the `dockerfile-http-v1` template. - **Bind address & port**: Listen on `0.0.0.0` (not `127.0.0.1`) on an unprivileged port in `1024..65535` (default `8080`). Privileged ports `< 1024` are rejected. - **Health endpoint**: Expose an HTTP health route (default `/healthz`) returning `2xx` when ready to serve traffic. - **Container security sandbox**: Pods run as **non-root UID 1000** with **read-only root filesystem** (`readOnlyRootFilesystem: true`), dropped capabilities, writable `/tmp` scratch (`emptyDir`), and optional persistent `/data`. - If an app writes caches, home files, or temp files, direct them to `/tmp` (e.g., `ENV HOME=/tmp`) or `/data` for durable data. - **`pangea.yaml` & creation**: - `pangea init --template dockerfile-http-v1 --name --directory --http-port --health-path --persistent-data|--no-persistent-data` - Or via MCP: `pangea_create_project` (creates the project and writes `pangea.yaml` in one step). - Existing projects: link with `pangea link --project --directory ` (never run `init` on an existing project). - Project names: `2–40` lowercase letters, digits, or hyphens starting with a letter (`^[a-z][a-z0-9-]{1,39}$`). - **Offline preflight check**: Always run `pangea_check_directory` or `pangea doctor` before deploying to catch privileged ports `< 1024`, read-only rootfs traps, unpersisted SQLite paths outside `/data`, missing `.dockerignore`, or accidental secrets in `pangea.yaml`. - **Idempotent deployment**: - `pangea deploy --resume --wait 300` (or `pangea_deploy_directory`). - `--resume` reuses the durable idempotency receipt for unchanged source bytes and target project. Do not mutate source between retries of an interrupted submission. - Monorepo subdirectories with their own `Dockerfile` (plus repo `.gitignore` and subdir `.dockerignore` / `.pangeaignore`) are supported directly (`--dockerfile` supported). - Inspect progress and state with `pangea operation --events --logs build`, `pangea view --directory `, `pangea status`, and `pangea logs --component web`. - Only report an app as live after `pangea view` confirms `actions.open=true`, `live.status=available`, and `publication.open_url`, followed by an actual HTTP probe to that URL. - **Encrypted runtime secrets**: - Up to **64 secrets** (`64 KiB` total per project) stored encrypted and injected via Kubernetes `Secret/pangea-app-secrets`. Plaintext values are never returned via API, CLI, MCP, or Web Console. - Manage via `pangea secrets set` (`--env-file`, `--stdin-json`, or `KEY=VALUE`, plus `--apply` to roll out without rebuilding), `pangea secrets list`, `pangea secrets unset`, or MCP (`pangea_set_secrets`, `pangea_list_secrets`, `pangea_delete_secrets`). - Reserved prefixes (`PANGEA_AI_*`, `PANGEA_LLM_*`, `PANGEA_SPEECH_*`) cannot be overwritten by user secrets. --- ## 3. Persistent `/data`, Backups, Exports & Stateless vs Stateful - **Persistent `/data` volume (`--persistent-data`)**: - Mounts durable storage at `/data`. All other paths (outside `/data`) and container memory are ephemeral. Storage remains allocated and metered (`GiB-mo`) even when an app is stopped or sleeping. - **SQLite replication**: Eligible stateful SQLite apps receive continuous Litestream S3 WAL replication. - **Managed PostgreSQL & Private TLS Redis**: Available on configured/operator-enrolled projects; Redis snapshot persistence is not a backup. - **Automated encrypted backups, export & restore**: - Automated encrypted backups (`pangea backup`, `pangea backups`, `pangea_backup_project`) and clean-room restores (`pangea restore `) into a new empty HTTP project. - On-demand `/data` export anytime: `pangea export` (`-o snapshot.tar.gz`) or MCP `pangea_export_data` captures and downloads a consistent `.tar.gz` snapshot of `/data`. - **Stateless vs Stateful trade-offs**: - **Stateless HTTP apps** (`--no-persistent-data`): Support zero-downtime rolling updates (`rollout: "rolling"`), horizontal Web autoscaling (`1–64` replicas), background worker processes (`Mini+`), PR previews (`pangea preview up`), and instant KEDA scale-to-zero / idle sleep. - **Stateful HTTP apps** (`--persistent-data`): Keep `/data` safely across restarts and sleep; use `recreate` rollout semantics (only one writer pod mounts the volume at a time) and cannot use horizontal Web autoscaling or PR preview cloning with local volumes. - **Safe deletion & Trash**: - Web Console Trash stages retired apps safely before permanent deletion. - CLI/MCP (`pangea delete` / `pangea_delete_project`) stops and purges stateless apps or previews (`--retry` recovers stalled deletions). Deleting persistent `/data` requires owner authority and explicit confirmation (`--confirm-data-loss`, or final approval in Web Console). --- ## 4. Workers, Horizontal Autoscaling & Compute / Scratch Sizing - **Background Workers (`pangea_set_processes` / `pangea processes`)**: - Available on stateless always-on HTTP apps (`Mini+` and enabled beta). - Declare up to **12 named non-HTTP worker processes**, each scaled to **1–32 replicas** within workspace capacity, sharing the same built container image. - Configure `args`, `resources`, optional `replicas` (`1–32`), `stop_order`, `scratch_mib` (`128–32768`), `termination_grace_seconds`, `environment`, and `service_bindings`. - Pass `{}` (or `pangea processes delete --all`) to clear all workers. - **Horizontal Web Autoscaling (`pangea_set_autoscaling` / `pangea autoscaling`)**: - Available on compatible stateless rolling HTTP apps (`Mini+`; excludes databases, idle-sleep apps, and local persistent `/data` volumes). - Configure `min_replicas` (`1–64`), `max_replicas` (`min_replicas..64`), and `target_cpu_percent` (`20–90%`, default `60%`). - To disable on a running app, scale down to `min_replicas=1, max_replicas=1` first or run `pangea autoscaling delete` / `pangea_set_autoscaling(enabled=false)`. - **Compute & `/tmp` Scratch Sizing (`pangea_set_resources` / `pangea resources set`)**: - Adjust in-place without rebuilding: - `cpu_m`: `50–32000` millicores (subject to workspace plan runtime limits) - `memory_mib`: `64–65536` MiB (subject to plan per-app & total live memory limits) - `scratch_mib`: `128–32768` MiB for `/tmp` `emptyDir` sizeLimit - `runtime_class`: `"gvisor"` (default) or `"runc"` (for trusted workspaces) --- ## 5. Shared AI (LLM & Speech) Every active workspace plan (Free Sandbox through Scale, Custom, and invited beta) can enable self-service Shared AI per Dockerfile HTTP app with zero external API keys. Usage meters to monthly `AI & GPU Time (GPU-min)` (active GPU time excluding queue wait). ### Activation & Rotation - **MCP**: `pangea_enable_ai` / `pangea_disable_ai` / `pangea_get_ai` - **CLI**: `pangea ai enable --project PROJECT_ID --apply` (use `--rotate` to rotate the Bearer token without rebuilding, `--no-apply` to persist without immediate rollout) - **Web Console**: **Shared AI (LLM & Speech)** panel on the project page. ### Injected Read-Only Environment Variables - `PANGEA_AI_ENABLED=1` - `PANGEA_LLM_BASE_URL` (default `https://llm-gateway.pangea-llm.svc.cluster.local:8443/v1`) - `PANGEA_LLM_API_KEY` (workspace-scoped ES256 token `pga_ai_...`) - `PANGEA_LLM_MODEL` (default family alias `gemma`; `qwen` and `default` are also accepted) - `PANGEA_SPEECH_BASE_URL` (default `https://speech-router.pangea-speech.svc.cluster.local:8443`) - `PANGEA_SPEECH_API_KEY` (workspace-scoped Bearer token `pga_ai_...`) - `PANGEA_AI_CA_PEM` (PEM CA bundle for verifying internal HTTPS endpoints) ### Mandatory TLS Verification & API Usage - **Always verify TLS using `PANGEA_AI_CA_PEM`** (write it to a temp file or pass it to `ssl.create_default_context(cadata=...)` / `NODE_EXTRA_CA_CERTS` / `httpx.Client(verify=ca_path)`). Never set `verify=False` or `rejectUnauthorized: false`. - **LLM Chat Completions (OpenAI-compatible)**: - `GET ${PANGEA_LLM_BASE_URL}/models` - `POST ${PANGEA_LLM_BASE_URL}/chat/completions` with `Authorization: Bearer ${PANGEA_LLM_API_KEY}` and `model: "gemma"` (or `"qwen"` / `"default"`). - Supports `stream: true` SSE streaming and JSON-object mode. - Shared pool constraints: default **6 starts/min** workspace budget across LLM + Speech, **180-second** deadline per LLM completion, up to **2,048 output tokens**. - **Speech Synthesis (TTS) & Transcription (Whisper ASR) Async Job Polling**: - `GET ${PANGEA_SPEECH_BASE_URL}/v1/models` - `POST ${PANGEA_SPEECH_BASE_URL}/v1/jobs` with a unique `Idempotency-Key` header: - TTS standard speakers: `kind: "tts"`, `model: "qwen3-tts-custom-voice"`, `input: { text, language, speaker }` (e.g. `"Vivian"`) - TTS voice clone: `kind: "tts"`, `model: "qwen3-tts-base-voice-clone"` with reference WAV audio - ASR transcription: Whisper ASR job via `/v1/jobs` - Poll `GET ${PANGEA_SPEECH_BASE_URL}/v1/jobs/{id}` until `state === "completed"` - Download result (e.g. `audio/wav`) from `GET ${PANGEA_SPEECH_BASE_URL}/v1/jobs/{id}/result` - Release server-side result storage with `POST ${PANGEA_SPEECH_BASE_URL}/v1/jobs/{id}/ack` - **Resilience**: Handle `429` (respect `Retry-After` with backoff/jitter), `502`/`503`/`504`, and timeouts gracefully without failing `/healthz`. Reaching monthly `GPU-min` hard cap pauses only Shared AI calls; Web containers and `/data` stay online. --- ## 6. Short Aliases, Auto-Sleep & Custom Domains - **Default & Short Aliases (`.pangea.host`)**: - Every HTTP app automatically gets `https://.pangea.host` (`3–40` lowercase characters) with automatic wildcard TLS. - Manage custom `.pangea.host` aliases via `pangea alias get|set|delete` or MCP `pangea_get_alias`, `pangea_set_alias`, `pangea_delete_alias`. - **Auto-Sleep & Transparent Wake**: - **Cardless Free Sandbox**: `15`-minute idle sleep (`900s`). - **Card-verified Free Sandbox**: `1`-hour idle sleep (`3600s`, default for new stateless Dockerfile HTTP apps). - **Mini ($9/mo)+ & enabled beta**: Supports always-on mode (`--no-sleep`) and autoscaling (`min_replicas` stays awake). - **Transparent wake**: KEDA holds the first incoming HTTP/API/webhook/SSE/WebSocket request until the container is ready—no interstitial page or redirect hop. Persistent `/data` stays intact; databases never sleep. - **Custom Domains (`Mini $9/mo+` and enabled beta)**: - Attach up to **5 custom domains** per project while keeping `.pangea.host`. - Managed via Console **Addresses**, `pangea domains list|add|verify|remove`, or MCP `pangea_list_domains`, `pangea_domain_add`, `pangea_domain_verify`, `pangea_domain_remove`. - Add generates a DNS TXT challenge; verify validates DNS and activates automatic edge TLS. Update your app's canonical URL, cookies, and OAuth callbacks to match. --- ## 7. GitHub Actions CI & PR Previews - **Availability**: Self-service on **card-verified Free Sandbox** (`2` repos / `2` parallel runs), **Mini** (`4` / `4`), **Launch** (`8` / `4`), **Grow** (`16` / `8`), **Scale** (`32` / `8`), Custom plans, and invited beta. - **Cardless Free Sandbox CI gate**: Returns `REGISTRATION_DISABLED` / `PLAN_UPGRADE_REQUIRED` until the user completes a `$0` Stripe card check or upgrades to `Mini+`. - **Zero-Secret CI Runners**: - Pangea-managed GitHub Actions runners automatically inject the `pangea` CLI on `PATH` and a job-scoped, short-lived ES256 credential at `PANGEA_CI_TOKEN_FILE` (`pga_ci_...`, with `PANGEA_TOKEN` compatibility). Zero GitHub Secrets are needed. - Pod-native Linux runtimes (`node-24`, `node-22`, `python-3.13`, `python-3.12`, `php-8.4`, `go-1.24`, `rust-1`, etc.) execute standard `run:` steps unprivileged with writable `/tmp`, `/var/tmp`, `/var/cache`, `/var/log`, `/run`. - Managed non-privileged service presets on `127.0.0.1` and service alias: `postgres-17` (`5432`), `mysql-8` (`3306`), `redis-7` (`6379`), `meilisearch-1` (`7700`). - Optional `platform: "macos-arm64"` ephemeral VMs for unsigned iOS Simulator builds where enabled. - **Registration & Workflow Policies**: - Inspect eligibility and GitHub App install URL via `GET /ci/registration` or `pangea ci-registration-info`. - Register via `POST /ci/registrations` (`pangea ci-register`). - Non-privileged Pod-native profiles allow `workflows: "*"` (same-repo commits/PRs; fork PRs rejected). Profiles with isolated `docker: true` or explicit pinning support 1–8 SHA-256 digests updated via `pangea ci-workflows` or MCP `pangea_update_ci_workflows`. - **PR Previews (`pangea preview up/down`, `pangea_preview_up/down`)**: - Idempotently create, update, stop, and purge stateless PR preview environments (`{base}-pr-{pr}.pangea.host` or custom delegated preview domain templates) inheriting HTTP config, sleep pool, and GitHub repo App Group from `pangea.yaml` or `--clone-from`. - Streams live build/deploy logs into GitHub Actions, writes clickable URLs to `GITHUB_STEP_SUMMARY`, and outputs `preview_url`, `project_id`, `preview_name` to `GITHUB_OUTPUT`. - `pangea preview down` cleanly purges stateless previews when a `preview` label is removed or PR closes. --- ## 8. Ephemeral Agent Sessions (gVisor Sandboxes) Launch isolated kernel-sandboxed gVisor containers per user conversation or agent task from any `dockerfile-http-v1` app. - **Pool configuration (`pangea sessions pool set` / `pangea_set_session_pool`)**: - `warm_replicas` (`0–16`): `SandboxWarmPool` standby pods yield **~0.1s** sub-second checkout when creating a session with no per-session `env`/`files`/resource overrides. - `max_concurrent` (`1–32`), `cpu_m` (`50–8000`), `memory_mib` (`64–16384`), `scratch_mib` (`128–32768`), `idle_ttl` (`60–86400s`), `max_ttl` (`60–86400s`). - Secret isolation is **off by default** (`inherit_secrets: false`); whitelist keys explicitly via `--allowed-secret-keys` or use `egress_proxies`. - **Session-only projects (`session_only: true` / `pangea create --dockerfile-http-v1 --session-only`)**: - Skips public web Ingress and HTTP server requirement when paired with `exec_mode: "builtin"`. Set `ENV HOME=/tmp` and keep scratch inside `/tmp`. Rejects `persistent_data`, `autoscaling`, `processes`, `redis`, `litestream`, and `idle_sleep`. - **Builtin Exec API (`exec_mode: "builtin"`)**: - `POST https://sandbox.pangea.host/_pangea/exec` (one-shot or streaming NDJSON) - `wss://sandbox.pangea.host/_pangea/exec/ws` (bidirectional WebSocket `spawn` / `stdin` / `signal` / `stdout` / `stderr` / `exit`) - **Pause & Resume `/tmp` Snapshots (`exec_mode: "builtin"`)**: - `pangea sessions pause` / `pangea_pause_session` snapshots up to `16` relative or `/tmp/...` paths (`ttl_days`: `1–30`) to object storage and tears down the Pod immediately, freeing compute & `max_concurrent` slots. - `pangea sessions resume` / `pangea_resume_session` restores the archived `/tmp` paths onto a WarmPool or fresh Pod with fresh routing headers. - **Outbound Credential-Injecting Egress Proxy (`egress_proxies`)**: - Register up to `8` routes mapping upstream HTTPS endpoints to project secrets; containers receive only ephemeral `pga_pxy_...` tokens while `pangea-egress-proxy` injects real API keys outbound (`600s` streaming read timeout). - **Least-privilege Session Tokens (`pga_ses_...`)**: - Mint single-project tokens (`pangea sessions token create` / `pangea_create_session_token`, up to `20` active, `90`-day max lifetime) scoped exclusively to `sessions` (`create`, `list`, `get`, `touch`, `pause`, `resume`, `delete`). - Route multi-turn HTTP/SSE/WebSocket traffic through `https://sandbox.pangea.host` using the returned Ed25519 `headers` (`Authorization`, `X-Sandbox-ID`, `X-Sandbox-Namespace`, `X-Sandbox-Port`). Note: `/healthz` on `sandbox.pangea.host` is reserved for router health. --- ## 9. Edge Access Protection & Cookieless Web Analytics - **Edge Access Protection**: - Protect apps or PR previews at the edge with zero app-code changes using `pangea access` (`show`, `set`, `off`, `token create|list|revoke`, `default list|show|set|off`) or MCP tools (`pangea_access_get`, `pangea_access_set`, `pangea_access_token_create`, `pangea_access_token_revoke`, `pangea_access_default_set`). - Issues scoped `pga_acc_...` access tokens and supports repository-level default policies for PR previews. - **Cookieless Web Analytics (Managed Umami)**: - Enable per deployed HTTP app with one click in Console or via `pangea analytics enable --project PROJECT_ID` / MCP `pangea_enable_analytics` (plus `pangea_get_analytics`, `pangea_get_analytics_stats`, `pangea_disable_analytics`). - Generates a `