The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
TL;DR
Prepare the selected cloud first, then use the shared preview, apply, verification and recovery workflow.
Shared deployment workflow
Architecture
Choose the GCP architecture or AWS architecture. These shared commands assume the corresponding cloud prerequisites have been prepared.
Prerequisites
Follow the GCP prerequisites or
AWS prerequisites before cloud-writing commands.
Stage names do not select a cloud; the ignored declaration's home field does.
Bootstrap a stage
Use the separate GCP bootstrap procedure or
AWS bootstrap and compatibility check.
npm run bootstrap prepares prerequisites; it does not prove application readiness.
Required application values include OIDC_CLIENT_ID; set and verify them using configuration.
Deploy through GitHub Actions
For a stage with verified mdeploy prerequisites, the entrypoint is mdeploy-all.yml.
It defaults to a preview. Example: preview an open PR's merge result in dev:
gh workflow run mdeploy-all.yml --ref main -f stage=dev -f ref='#123' -f components=api+runner -f apply=false
Replace #123 with the intended PR, or use a full commit SHA. Review the resolved SHA, stage identity,
artifact identities and complete resource diff. For a branch-contained SHA or release, reuse that ref with apply=true.
For a PR, repeat #123 and compare its newly resolved merge SHA with the preview before approving the Environment.
A moved PR/base can change that merge SHA; a merge candidate outside the selected branch cannot be reapplied as a bare SHA.
| Ref | Allowed stages | Artifact path |
|---|---|---|
| Full SHA | dev, stage |
Ensure commit images and runner build exist; the commit must belong to the selected workflow branch |
Open PR #number |
dev, stage |
Use the current open, mergeable PR's merge commit for images and runner build |
Stable vX.Y.Z tag |
stage |
Resolve to a commit on the selected branch; use commit images and runner build |
Published vX.Y.Z release |
dev, prod |
Version-qualified images and published runner release |
Dev/prod release dispatches run from main. Production accepts releases only. For a protected production apply:
gh workflow run mdeploy-all.yml --ref main -f stage=prod -f ref=vX.Y.Z -f components=api+runner -f apply=true -f confirm=true
Stage candidate dispatches may use a workflow branch and accept its full SHAs or open PR merge candidates.
Stage also accepts stable tags as commit references: it resolves the tag once, then builds or reuses artifacts for that SHA.
It does not require a GitHub Release or use its published Runner assets.
Dev/prod published stable releases still run from main; RC inputs remain refused.
Dev/prod import existing release images from GHCR; stage is an independent deployment target.
Production requires a stable release on main and protected apply confirmation.
Selections that include Runner also require its published tarball and checksum.
Example stage preview after its prerequisites and artifacts are prepared:
gh workflow run mdeploy-all.yml --ref main -f stage=stage -f ref='<full-main-sha>' -f components=api+runner -f apply=false
gh workflow run mdeploy-all.yml --ref main -f stage=stage -f ref='#123' -f components=api+runner -f apply=false
Run a preview of the chosen ref first. On GCP, components=api deploys the API image and environment
to both the API and App Worker Cloud Run services; components=runner converges the binary and Runner environment through OS Policies.
Both include the workload's required read grants and leave unrelated infrastructure outside the targets.
The default api+runner retains full-stack deployment; AWS/SST supports only that selection for now.
Individual selection requires existing workloads; Runner fleet changes require a full deployment.
The first Cloud Apps deployment requires api+runner to create its worker and source-storage grants.
Existing stage protection, configuration checks and per-stage queuing still apply; do not cancel a healthy apply to start another.
Use the same public workflow for individual previews, after preparing the stage declaration:
gh workflow run mdeploy-all.yml --ref main -f stage=dev -f ref='<full-main-sha>' -f components=api -f apply=false
gh workflow run mdeploy-all.yml --ref main -f stage=dev -f ref='<full-main-sha>' -f components=runner -f apply=false
For environment changes alone, reuse the deployed component's ref; its existing env group remains the configuration source.
The internal CLI receives --components from the workflow; no separate public deployment workflow is introduced.
Image releases are published to GHCR through mbuild-release. Release deployment imports these existing images into the target stage's AR/ECR repository, verifies manifest digests and enforces the target scan policy. It never starts a release build. Missing GHCR images stop planning and print the manual publication command; authentication and network failures remain registry errors. See the release runbook.
Approval rounds
When the target Environment has required reviewers:
| Path | Protected work | Approval rounds |
|---|---|---|
| Commit or PR to dev/stage | Parallel per-artifact plan/build jobs, then a separate deploy job | 2 batches |
| Published release to dev/prod | Verify release artifacts, import GHCR images and deploy in one job | 1 |
| Stable tag to stage | Resolve as a commit and follow the commit path | 2 |
Ref validation runs before either protected path.
Both paths retain stage concurrency, image verification, scan policy, configuration fingerprint and protected-stage confirmation.
The shared deployment action owns the apply checks; the shared image action also backs the reusable mbuild workflow.
Commit image and Runner preparation run in separate matrix jobs, each checking only its selected artifact. Both jobs bind the target Environment; approve the preparation batch after both are awaiting review, then approve deployment separately. Approval covers jobs currently waiting: a queued or later job can require another review.
The matrix permits two concurrent legs with separate artifact locks and keeps a successful sibling running when another fails. Deploy waits for the complete preparation matrix to succeed; commit routes do not depend on matrix output ordering. Rerunning a preparation leg repeats its checks and reuses existing artifacts. A failed import or build stops deployment. Apply is never automatically retried; inspect failed applies and any retained state lock before rerunning. Release dev deployments keep the stage lock through cloud E2E. The result and both Environment approvals appear in the release run. Standalone dev/stage apply results go to dev Slack. Release and prod apply results go to #release. Each result links to the run.
Caller attribution
Automation callers may supply the optional string inputs requested_by (a public GitHub username) and
request_id (an opaque operation ID). When both are present, the run title appends
· @<public-login> · <opaque-operation-id>. Omitting either preserves the native run title.
These fields provide display and correlation metadata; they do not grant reviewer authority.
Keep email addresses and credentials out of both inputs. Existing apply, confirm and Environment approval requirements still apply.
Retained legacy AWS deployment
The AWS deployment guide owns the retained SST path and its compatibility boundary. Its runner update launcher is separate from current mdeploy orchestration.
Deploy an existing stack
Local deployment uses the same stage configuration and artifact identities. Prepare images first
with mbuild, and prepare the selected runner artifact.
The following example assumes release images vX.Y.Z-<sha> and runner release X.Y.Z already exist:
export BOXLITE_IMAGE_TAG='vX.Y.Z-<full-commit-sha>'
export VERSION='X.Y.Z'
npm run mstage login -- --stage dev
npm run mstage env digest -- --stage dev
npm run mbuild import-release -- --tag <full-commit-sha> --version vX.Y.Z --ghcr boxlite-ai/boxlite --stage dev
npm run mbuild verify -- --tag <full-commit-sha> --version vX.Y.Z --stage dev
npm run mdeploy -- --stage dev --diff
npm run mdeploy -- --stage dev
Substitute real values and inspect the preview before the last command. Add --confirm for a
protected stage. For a commit runner build, use the selectors in the runner runbook.
mdeploy --local-env bypasses store loading and is an explicit diagnostic option, not the default.
Fractional CPU upgrade
Apply the CPU-column migration first. Upgrade every Runner, including migration destinations, with its matching Runtime/C ABI before deploying the API that accepts fractions, then deploy the dashboard. See the fractional CPU data contract for storage and metering behavior.
Migration lock acquisition times out after five seconds; retry in a maintenance window if needed. Rollback to integer columns refuses fractional or out-of-range rows rather than rounding allocations. After fractional Boxes exist, retain compatible API and Runner versions; disabling new fractional creation alone does not make older binaries safe.
Secrets & credentials
Configuration owns the file/store/CI boundaries, and
security explains runtime identity and protection. Inspect names with
npm run mstage env list -- --stage dev; value exports belong in a secure destination.
Cloudflare API token
Provide an account-owned token with Zone:Read and DNS:Edit, restricted to the zone used by
STACK_DOMAIN and PROXY_DOMAIN, plus the user domain's zone when the stage sets one (below). Set CLOUDFLARE_DEFAULT_ACCOUNT_ID and CLOUDFLARE_ZONE_ID
to the intended account/zone. Both are required by the current deployment group, alongside the token.
Users' named apps (demo.<STACK_USER_DOMAIN>) live under a registrable domain of their own, so a
named app is never same-site with the dashboard and a blocklisted one does not take the platform's
domain with it. Generated box URLs still sit under PROXY_DOMAIN; moving them is separate work. A stage that sets STACK_USER_DOMAIN also sets CLOUDFLARE_USER_ZONE_ID, the zone
holding that domain. On GCP the edge writes
*.<STACK_USER_DOMAIN> into that zone and issues its certificate through its own DNS authorization;
the apex is not used. The API and the proxy learn the domain as PROXY_APP_DOMAIN. Unset, the stage
offers no named apps. The deploy refuses a user domain under the same registrable domain as
STACK_DOMAIN or an overridden DASHBOARD_DOMAIN (a sibling such as apps.boxlite.ai beside dev.boxlite.ai included), and refuses one
on AWS, whose edge serves none.
The token is created in Cloudflare's dashboard; a provider login does not generate it.
Follow the selected cloud’s deployment guide for credential storage and rotation destinations.
Verify the result
| Check | Evidence to inspect |
|---|---|
| Intended deployment | Resolved stage, cloud/project/account, commit and artifact identities |
| Infrastructure | Successful apply with no unexpected replacement or deletion |
| API and dashboard | Public HTTPS, /api/health, dashboard load and OIDC login |
| Proxy | Healthy load-balancer backends and an actual box preview/tunnel |
| Runners | Fleet registration, target health identity, box create/exec/stop |
| Persistent volumes | Create/mount/write/read using a test volume if enabled |
| Telemetry | A new test event reaches the configured destination and is queryable |
Use the runner, network, and ClickHouse guides to locate the failing boundary. The legacy wrapper's automatic checks do not imply that mdeploy performs the same checks.
Recovery and teardown
| Symptom | Next check |
|---|---|
| Stage/config not found | Ignored declaration and CI environment variable; configuration |
| Missing required key or digest mismatch | Correct the stage store, review values, then certify the intended group |
| Missing image or runner artifact | Verify the exact commit/release in the correct stage; do not treat permission failure as absence |
| Credential failure | Check identity using the selected cloud’s deployment guide |
| Service cannot reach a runner | Private routes, firewall source ranges and DNS |
| Apply succeeded but runner is old | Cloud rollout reports and live health |
| Locked or interrupted deployment | Confirm no writer is running, then follow state recovery |
| Login, invitation or email failure | Identity and mail |
Do not clear a live deployment's lock or restart a healthy service merely because an apply is slow. An apply can partially succeed before failing; inspect cloud and state before retrying or rolling back.
Refresh reconciles the checkpoint; it does not apply a new desired resource graph:
npm run mdeploy -- --stage dev --refresh
npm run mdeploy -- --stage dev --diff
For intentional removal of an unprotected disposable stage, the command is
npm run mdeploy -- --stage <stage> --remove --confirm. Protected stages are refused.
Independent resource protection and retained data can also prevent or outlive removal; inventory them
before calling teardown complete. Bootstrap identities, registries and artifact/state buckets have
separate ownership and are not implicitly erased by removing application resources.
Scaling and cost
Use runner operations to add capacity. Resource sizes, database availability,
backups and ClickHouse mode come from the stage's deploy block.
Use the separate GCP cost catalog or AWS inventory.
Estimate from the selected region, configuration and traffic rather than a fixed monthly total.
Reference
Architecture · mdeploy · mstage · mbuild · ClickHouse · Status page