Start locally
Microsandbox runs locally by default, without a cloud account or daemon:Switch to cloud
Get an API key from the dashboard and set it in your environment:Switch back
Select local execution again:Connection settings
Connection settings
MSB_BACKEND=remote switches unqualified SDK calls and CLI commands to remote. MSB_API_KEY supplies credentials; setting it alone does not switch where commands run. cloud remains an alias for remote. Set MSB_API_URL to use another API, or save a profile for later commands.Save a connection
Save a connection as a profile to use it again. Profiles live in~/.microsandbox/config.json.
Add profiles to config.json
Add profiles to config.json
url on a remote profile for a self-hosted API. See the profiles schema for all fields and credential sources. Readers accept the previous backend and cloud spellings; older SDKs may reject profiles rewritten with kind and remote.View and switch
MSB_PROFILE:
Load a profile in code
New SDK calls honor the active profile. To use a different named profile explicitly:More options
Another endpoint
The default endpoint ishttps://api.microsandbox.dev. Set an explicit URL to use another compatible API; an empty URL is an error.
Explicit http:// endpoints are supported for deployments that manage transport protection separately, such as local development or an encrypted tunnel. HTTP itself does not encrypt the API key, request body or response. Use HTTPS when you need the SDK connection to provide transport encryption and server-certificate verification.
Set another endpoint
Set another endpoint
MSB_API_KEY and MSB_API_URL independently. A key is required. The URL defaults to https://api.microsandbox.dev.
For Standard and Shared options, see compute types.
Change a remote context
Change a remote context
Create a copy of a context to change its endpoint, credentials, or options. Settings you leave out stay the same. Existing resources keep their original connection. Copying a context does not reload profiles or configuration.Empty URLs and keys are errors. Changing a connection does not contact the server.
HTTP settings
HTTP settings
Request timeouts and user agents can be set when constructing or deriving a context. See the SDK references for options and validation. Custom HTTP client behavior is documented in the Rust configuration reference.
Which CLI setting wins?
Which CLI setting wins?
CLI selection uses this order:
- Explicit
--localor--remoteon a supported resource command - Managed
active_profile MSB_BACKEND=local|remoteMSB_PROFILE- Saved
active_profile - Local runtime
allowed_backends.--remote uses MSB_API_KEY and optional MSB_API_URL (otherwise the hosted default), not the credentials or URL of the saved profile. Missing environment credentials are an error. --local selects the local context. These flags apply to the current command and do not save a new profile preference.Environment and managed settings can override msb context use; the command warns when they do. reset clears only the saved preference. Missing credentials or a blocked connection cause an error. The command will not run locally instead.A managed active_profile of null or "" clears saved and environment-selected profiles, while preserving MSB_BACKEND. To enforce local execution, choose a named managed local profile. Managed profile entries replace same-named user entries.Allow only local or remote execution
Allow only local or remote execution
Set
allowed_backends to ["local"], ["remote"], or ["local", "remote"] in user configuration or managed overrides. cloud remains an input alias for remote. Both are allowed by default; an empty list is invalid. null removes the restriction, and managed values replace user values.This controls where execution is allowed. It does not switch the current connection. Changes apply to newly created contexts. See managed configuration.Check your connection
msb context shows where CLI commands run. To check an object’s connection in code, see your SDK reference.
See configuration for defaults and cloud limitations for feature differences.
Resource selectors
For explicit selection before creation, lookup or listing, use the resource’slocal() or remote() selector. Sandbox, Volume and Snapshot return their existing plural collection types. Unqualified calls follow configuration and fall back to local. Explicit selectors override the configured destination and respect managed backend restrictions.
MSB_API_KEY and optional MSB_API_URL at the call, ignoring ambient backend/profile selection. Construction performs no remote lookup; validation or missing-provider errors happen before a usable remote collection is returned. Existing collections, deferred builders and resources keep captured credentials after environment changes. Go’s local selectors also return an error because context/provider construction can fail. Rust selectors are gated by the corresponding local/cloud feature. Bindings require the corresponding installed provider and never fall back to the other destination.
Use Resource.ctx(context) or context collections when selecting a named profile, a different account or custom local configuration. Instance resources remain bound to their original destination. Rust local_state() / remote_state() expose retained backend-specific state; they do not perform live inspection.
Agent connection timeouts
Agent connection timeout errors identify the phase that exhausted the connection deadline:identity is the sandbox lookup, websocket covers connection establishment and upgrade, and handshake is the guest-agent protocol handshake. The deadline covers the whole attempt. A timeout does not retry the command or change TLS verification; retain the phase when reporting an intermittent connection failure.