Docs

Getting Started

From zero to production in 90 seconds.

While is a sovereign, agent-first PaaS. Your AI agent connects via the Model Context Protocol (MCP), deploys your application, monitors production with built-in sensors, and fixes issues autonomously. The loop is the product: SHIP → SENSE → FIX → repeat.

1

Get your API key

Your admin provisions API keys via the admin endpoint. Each key is scoped to control what operations are allowed.

curl -X POST https://while.sh/api/admin/api-keys \
  -H "x-admin-secret: YOUR_ADMIN_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"tenantId": "your-tenant-id", "name": "my-agent", "scopes": ["full"]}'

# Response: { "key": "whl_abc123...", "name": "my-agent", "scopes": ["full"] }

Save the key — it cannot be retrieved again. Available scopes: full, deploy, operate, read-only, sensors-only.

2

Connect your AI agent via MCP

Add While to your agent's MCP configuration. The agent auto-discovers all 45 available tools.

{
  "mcpServers": {
    "while": {
      "url": "https://while.sh/mcp/sse",
      "headers": {
        "Authorization": "Bearer whl_your_api_key"
      }
    }
  }
}

Works with Claude, Cursor, Windsurf, and any MCP-compatible agent. See the full MCP Integration guide.

3

Create a project

Projects automatically get staging and production environments. Each environment is isolated with its own deployments, databases, domains, and secrets.

// Via MCP tool
while.projects.create({ name: "my-app" })

// Response:
// { id: "clx...", name: "my-app", environments: [
//   { id: "env_stg", name: "staging" },
//   { id: "env_prd", name: "production" }
// ]}
4

Deploy your application

Point While at your git repo. It builds a container image, pushes to Harbor, and creates Kubernetes resources automatically.

while.deploy.trigger({
  environmentId: "env_stg",
  gitUrl: "https://github.com/you/my-app.git",
  commitSha: "abc123",
  commitMsg: "Initial deployment"
})

// Build pipeline: clone → docker build → push to Harbor → K8s deploy
// Track status: while.deploy.get({ deploymentId: "dep_..." })

Guardrails are enforced automatically. Production environments can be locked, and deploy rate limits apply.

5

Monitor with sensors

While provides three built-in sensor types. Query them to detect issues before your users do.

// Check for errors (auto-correlated with deployments)
while.errors.summary({ environmentId: "env_stg" })
// → { open: 0, resolved: 3, total: 3 }

// Check performance
while.perf.getCurrentLatency({ environmentId: "env_stg" })
// → { p50: 12, p95: 45, p99: 120, throughput: 500, errorRate: 0.01 }

// Check uptime
while.uptime.status({ environmentId: "env_stg" })
// → [{ url: "https://app.example.com/health", lastStatus: 200, uptimePct: 99.9 }]
6

Set up webhooks for autonomous operation

Subscribe to events so your agent gets notified automatically — no polling required. While runs while you sleep.

while.webhooks.create({
  url: "https://your-agent.com/webhook",
  events: ["deployment.failed", "error.detected", "uptime.down"]
})

// Your agent receives POST requests with event payloads
// and can autonomously fix issues and redeploy.

See the full Webhooks guide for payload formats and signature verification.