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:
Environment
TheMSB_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 inconfig.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:
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:- Programmatic backend set by the SDK
MSB_BACKEND=local, or a non-emptyMSB_API_KEYMSB_PROFILE=<name>active_profile- Local runtime
MSB_API_URL only overrides the cloud endpoint; it never selects the cloud backend without an API key.