Skip to main content
The SDKs and the msb CLI expose one surface with two backends behind it: the local runtime on your machine, and microsandbox cloud. Every call resolves a backend the same way, and the same code runs against either. Most applications never choose explicitly. A non-empty MSB_API_KEY selects the cloud; no key means the local runtime:
The sections below are the explicit overrides, in the order they win. Select at most one.

Environment

The MSB_BACKEND environment variable forces a backend for a single command or shell, for example to use the local runtime while a key is exported:

Code

Programmatic selection wins over environment and profile resolution. Use it when the application should decide regardless of its environment:

Profiles

Profiles give named backend configurations in config.json, useful when you switch between local and cloud regularly or keep per-project defaults:
active_profile sets the default. MSB_PROFILE=<name> overrides it for a single command:
Cloud profiles require api_key_ref. The url field is optional and defaults to https://api.microsandbox.dev; set it only for a development, self-hosted, or on-prem control plane. See the profiles schema for the allowed fields and credential-reference formats.

Resolution order

Backend resolution uses this order:
  1. Programmatic backend set by the SDK
  2. MSB_BACKEND=local, or a non-empty MSB_API_KEY
  3. MSB_PROFILE=<name>
  4. active_profile
  5. Local runtime
MSB_API_URL only overrides the cloud endpoint; it never selects the cloud backend without an API key.