MicroVM backend
Last updated Nov 30, 2026 View as Markdown
The details of runs on the microVM backend (--backend vm): what they require, their limits, and their errors. Running in a microVM shows how to use it. The options are in the command line, the [vm] and [policy] keys in config.toml, and every error code in exit codes and errors.
Requirements
- macOS 13 or later on Apple Silicon. Elsewhere a VM run fails before anything starts with
backend_unsupported, and never falls back to the host. - A Pandra binary signed with the virtualization entitlement. A release is signed. A binary built from a checkout fails with
vm_entitlement_missing; sign it withcargo xtask sign, run in the checkout.
Backend
--backend host|vmonpandra runandpandra syncselects the backend. Without it,backendin the agent's table applies, thenbackendin[defaults], and the default ishost. A package cannot choose its backend.- A session keeps the backend it was created on.
pandra resumetakes no--backend. - On the host backend,
--network-preset,--allow-host, and--publishare a usage error, and thepolicyandvmtables have no effect. When apolicytable sets a preset or a destination for the agent, the approval summary adds aPolicy:row and a host dry run aPolicyrow:not enforced on the host backend; --backend vm enforces it.
Resources
| Resource | Default | Set with |
|---|---|---|
| CPUs | 4, or all of the Mac's when it has fewer | --cpus N, cpus in the vm tables |
| Memory | the smaller of 4 GiB and half of the Mac's | --memory SIZE, memory in the vm tables, such as "8GiB" |
--cpusand--memorywork onrunandresume. A value the Mac cannot give fails with a usage error that names the range.- The CPUs and memory are limits, not reserved when the VM starts. A VM takes memory from the Mac as its guest uses it, and keeps what it took until its run ends.
Downloads
- The first VM run downloads what the VM needs and keeps it.
pandra sync AGENT --backend vmdownloads it ahead. - With
--offline, a VM run that misses a part fails withvm_asset_missing, which lists each part and names thepandra synccommand above. - The VM runs the harness version that
--harness-versionor the configuration pins, else the version of the harness on your Mac. Without either, the run fails withharness_not_found, and the fix ispandra harness use NAME@VERSION. Apathset for the harness is not used in the VM. - Under
[harnesses] downloads = "manual", Pandra never downloads the harness's Linux build. Install it withpandra harness install NAME@VERSION --platform linux-arm64.pandra harness listshows Linux installations withlinux-arm64in itsPLATFORMcolumn, andpandra harness remove NAME@VERSION --platform linux-arm64removes one. - A download whose digest differs is not kept, and the run fails with
digest_mismatch.
Images
- The default image is
ghcr.io/pandra-io/vm-base: Debian with git, ripgrep, curl, less, Node, uv with Python, the GitHub CLI, bubblewrap, socat, the OpenSSH server, and CA certificates. Its useragentcan usesudowithout a password. imagein thevmtables names another image, by tag or digest. Pandra pulls itslinux/arm64variant with the credentialspandra pulluses. A registry on a loopback address, such aslocalhost:5001, is reached over plain HTTP, and every other one over HTTPS.- An image must be built
FROMthe base image and keep its OpenSSH server, socat, and theagentaccount. An image not built from the base, or without alinux/arm64variant, fails withvm_image_unsupported. An image that removes either program or locksagentfails withvm_start_failed. - The image's environment variables are used. Its entrypoint, command, user, and working directory are not.
[runners]is not used in a VM.- An MCP server distributed as an OCI image cannot run in a VM, which has no container runtime: the run fails with
vm_server_unsupported.
Session disks
- Each session has a disk of its own, made from its image, which holds everything outside the shared directories.
pandra resumeboots the same disk, so what the agent installed is still there. A newer image applies to new sessions only. - The sessions that one TUI run creates share that run's VM and its disk.
- A disk is used by one run at a time. A run of a session whose disk another run uses fails with
vm_disk_busy, which names that session: wait for it to end, or stop it. - A disk takes only the space the agent wrote.
- A disk is removed with the last session that uses it.
pandra system prunealso removes the disks, images, and other VM downloads that nothing uses, and counts them as VM parts (Removed 3 VM parts, andvm_partswith--json).
Files, environment variables, and commands
- The VM shares the run's workspace and the session's harness home for reading and writing, and the run's prepared files and the harness's installation for reading only, each at its path on the Mac. A run in a worktree also shares its repository's Git directory, for reading and writing.
- A workspace, or a worktree's Git directory, that is or holds Pandra's data, configuration, or cache directory fails with
vm_workspace_too_broad. The fix is a narrower workspace (--workspace DIR). - A change made on the Mac is not reported to file watchers in the VM.
- The VM does not inherit your environment variables. It gets the image's variables, the ones the configuration sets for the agent, the ones
--envpasses, and the ones the harness needs. - In the VM, only
pandra skillandpandra versionwork. Every other command fails withnot_available_in_vm, so an agent in the VM cannot start other agents through Pandra. The harness's own subagents work.
--env
--env NAME=VALUEand--env NAME(repeatable) onrunandresumepass a variable into the VM.NAMEalone takes the value your shell has when the run starts, and a name your shell does not set is not passed. When a name is given more than once, the last one applies.- They apply over the configuration's
env, and only to the run they are given to: a resume passes only its own. - A name Pandra reserves is refused with
env_reserved: aPANDRA_*name, a name Pandra removes from a run, a name the harness sets, a certificate variable such asSSL_CERT_FILEorNODE_EXTRA_CA_CERTS, and the harness's credential variables, which belong to a target. - On the host backend,
--envis a usage error: a host run inherits your shell's variables. - A value given on the command line is never shown or written to a record.
--dry-runlists the variable with the origin--envand no value, and a command Pandra suggests writes it as--env NAME.
Network rules
| Preset | Allows |
|---|---|
strict | Only the model and login endpoints. |
minimal, the default | The model and login endpoints of the harness and provider, the remote MCP servers the package declares, and the registries of its servers' runners (registry.npmjs.org for npx, pypi.org and files.pythonhosted.org for uvx). |
balanced | minimal, plus package registries, the base image's operating system mirrors, and code hosts. --dry-run lists them. |
open | Every destination except the Mac's loopback and local network. |
network-presetin thepolicytables and--network-presetselect the preset.allow-hostsin thepolicytables and--allow-hostadd destinations. A run's destinations are those of the preset,[policy], the agent'spolicytable, the flags, and the session's approvals together.- The rules are read again at every resume.
- A destination is
HOST[:PORT], a host name or an IP address. The port is 443 when it is left out. *.example.commatches every subdomain ofexample.comat any depth, and notexample.comitself. A lone*, a wildcard over one label such as*.com, and a wildcard in any label but the first are refused.*.co.ukis accepted.- A run adds at most 1,024 destinations through the
policytables,--allow-host, and the hosts of its tokens together, and publishes at most 256 ports. More of either fails withvalue_invalid. - The Mac's loopback, local network, and own addresses are refused under every preset, also when an allowed name resolves to one.
--allow-host 10.0.0.5:8080allows that address.--allow-host localhost:5432makes the Mac's127.0.0.1:5432reachable ashost.pandra.internal:5432. - A name that is not allowed does not resolve, and a connection that is not allowed is reset.
- On port 443, and on the port of each host Pandra injects a credential for, the TLS server name must be allowed too. A connection there that is not TLS, or sends no server name, is refused.
- UDP other than name lookups is dropped. The VM has IPv4 only.
- A target whose base URL variable, such as
ANTHROPIC_BASE_URL, takes its value from a secret cannot run in a VM: the run fails withnot_supported_yet. Write the base URL as a literal.
Refused destinations
- Each refused destination is reported once per run, and the end of a run lists them with the command that allows each.
- With
--json, each is awarningevent with the codedestination_refusedand the detailshost,port, andallow_command.portis null for a name refused when it was looked up.allow_commandis null when allowing the destination would not help, such as a connection on port 443 that is not TLS. - A run reports at most 1,000 destinations and counts the rest, as
refused_beyond_limitin theresultevent with--json.
pandra policy
text
pandra policy list SESSION
pandra policy allow host SESSION HOST[:PORT]... [--save]
pandra policy remove host SESSION HOST[:PORT]...
pandra policy network-preset SESSION PRESETlistshows the session's preset, each allowed destination with where it comes from, and the destinations its run has refused so far. For a session that is not running, it shows what a resume would start with.allow hostallows destinations at once for the running VM and for the session's later resumes, and for the other sessions that share its disk. A destination is written as for--allow-host. What is allowed is what you write:api.example.comdoes not allow*.example.com.--savealso writes the destinations to the agent'spolicytable.remove hosttakes back destinations the session approved, at once for the running VM and for later resumes, and printsremoved HOST:PORTfor each. A destination matches as written, so removingapi.example.comleaves*.example.comapproved. A destination the session did not approve, such as one a preset, apolicytable,--allow-host, or a token allows, fails the command with a usage error, and nothing is removed. It has no--save: remove a saved destination from the agent'spolicytable. It cannot recall what already left the VM, and connections already open stay open.network-presetchanges the session's preset. While its run goes on, a preset can only be widened, in the orderstrict,minimal,balanced,open.- A session keeps at most 1,000 approved destinations. One more is a usage error; use a wildcard or
pandra policy network-presetinstead. - Allowing a destination never sends a credential to it.
pandra policyfails inside the VM. On the Mac,allow,remove, andnetwork-presetfail whenPANDRA_RUN_IDis set, as it is in an agent's run, and say that the user has to run them. An agent on the host runs as you and can unset the variable, so only the refusal inside the VM is a boundary. A session on the host backend has no policy, and the commands fail with a usage error.- In an ACP session, the editor is asked with a permission request for a refused destination where allowing it can help, and allowing it allows the name on port 443 or on the port that was refused. A destination refused because it is a local address is only reported.
Published ports
--publish [HOST_PORT:]GUEST_PORT(-p, repeatable) onrunandresume, andportsin thevmtables, publish a port of the VM on the Mac's127.0.0.1. The host port is the guest port when it is left out.- A server in the VM must listen on
0.0.0.0to be reachable. - A host port that cannot be bound fails the run with
vm_port_in_usebefore anything starts, and the run never uses another port. When--publishgave the port, the error's step is the same command with another host port. When the configuration gave it, the message names the file and line.
Credentials
| Credential | In the VM |
|---|---|
| A target's credential | a placeholder; Pandra injects the value on requests to the provider |
| A secret header of a remote MCP server | a placeholder; injected on requests to the server |
| The harness's login on your Mac | a placeholder; injected on requests to the provider |
| A token for named hosts | a placeholder; injected on requests to the named hosts |
A value for a local MCP server, a variable in env or passed with --env | the value itself |
[harnesses.NAME] secret-proxy = falsemakes that harness's target credentials and the secret headers of its remote MCP servers enter the VM as values.- The dry run's
Credentialssection says whether each credential is injected on the host or enters the VM. - A placeholder sent to another host on a connection Pandra decrypts is passed on as it is, with a warning.
- A WebSocket to a host whose credential Pandra injects fails, so Claude Code's voice mode does not work in a VM.
Logins
- Without a target credential, a VM run uses the harness's login on your Mac. Pandra never renews it and never gives the refresh token to the VM.
- An expired login fails the run with
vm_login_expired: start the harness on your Mac once, which renews it. A Pi run renews Pi's login first throughpi auth print-bearer-token. A token that expires during a run is read again when the provider rejects it, and the run stops withvm_login_expiredwhen it was not renewed. - For Claude Code's login, macOS can ask whether
securitymay use the keychain itemClaude Code-credentials. Allow it, or the run cannot use the login. - These logins fail with
vm_login_unsupported, and the fix is a target with an API key:- Claude Code's
apiKeyHelper, or a credential variable in its settings'env. - Codex's
CODEX_API_KEYin your shell, or a model provider in Codex's own configuration. - A Pi
models.jsonthat configures the run's provider. - Pi's ChatGPT login (the provider
openai-codex).
- Claude Code's
- A Codex login kept in the macOS keyring cannot be shared with a run on either backend.
Tokens for named hosts
[vm.tokens.NAME]gives a token to every VM run, and[agents."<identity>".vm.tokens.NAME]to one agent.secretnames a logical secret,hoststhe hosts, andenv, which is optional, a variable in the VM that holds the placeholder.- The token's hosts are allowed destinations on port 443, and count toward the 1,024 destinations of a run.
- Git in the VM offers the token to those hosts and uses HTTPS for their SSH remotes, so a workspace cloned over SSH fetches and pushes unchanged.
- Your Git
user.nameanduser.emailare copied into the VM. SSH remotes of other hosts and commit signing do not work.
TUI and ACP
- A TUI run in a VM holds at most 64 sessions. A further conversation started in it, such as with
/new, is blocked with a message that says to start another run. - In an ACP session, the MCP servers the editor provides are left out, with the warning
runtime_mcp_not_supported_in_vm. - A quest does not run members in a VM. A member whose backend is
vmfails the quest before anything starts withvm_quest_unsupported. The fix ispandra config set --agent AGENT backend host.
Errors
| Code | Fix |
|---|---|
backend_unsupported | Run on the host backend. |
vm_entitlement_missing | Install a release, or run cargo xtask sign in the checkout you built from. |
vm_workspace_too_broad | Choose a narrower workspace with --workspace DIR. |
vm_asset_missing | Run pandra sync AGENT --backend vm while online, or pandra harness install NAME@VERSION --platform linux-arm64 under manual downloads. |
vm_image_unsupported | Build the image FROM the base image, for linux/arm64. |
vm_disk_busy | Wait for the named session's run to end, or stop it. |
vm_server_unsupported | Run on the host backend, or replace the server. |
vm_login_expired | Start the harness on your Mac once. |
vm_login_unsupported | Use a target with an API key. |
vm_start_failed | Check the image keeps the base image's OpenSSH server, socat, and agent account. With --json, details.console holds the VM console's last lines. |
vm_port_in_use | Publish another host port, or free the port. |
vm_quest_unsupported | pandra config set --agent AGENT backend host. |
not_available_in_vm | Run the command on your Mac. |
harness_exited | A VM that stops during a run, such as one out of memory, ends the run with this code. For memory, give the VM more with --memory. |