Skip to content

Tutorials

Coding agent

Run coding-agent tasks in a microVM with explicit filesystem, network, and persistence boundaries.

Use this pattern when an agent needs to inspect or modify a project but should not run directly in the host process.

Create a narrow project directory for the task. Avoid mounting $HOME, SSH agent sockets, cloud credentials, browser profiles, or unrelated repositories.

Terminal window
mkdir -p /tmp/mvm-agent-work
cp -R ./src /tmp/mvm-agent-work/src

Prefer a Nix flake that declares the tools the agent needs:

Terminal window
mvmctl machine build --flake .

For local development through this repository, the builder VM is the Linux build boundary. The runtime guest later boots the built artifact.

Terminal window
mvmctl machine run --flake . --name coding-agent
mvmctl machine exec coding-agent -- bash -lc 'cd /work && python task.py'

Use file transfer or a narrow mount for input/output. Keep generated patches and logs outside broad host write access.

Start with no egress for code analysis. If the task needs registries or model APIs, add only those destinations and record why they are needed.

Use cold mode only when the agent needs to resume an environment with installed packages, caches, or intermediate files.

Terminal window
mvmctl machine pause coding-agent
mvmctl machine resume coding-agent

Use mvmctl machine stop and cleanup commands when the task is complete.

  • Do not pass long-lived credentials as plaintext environment variables.
  • Keep host mounts narrow and read-only unless write access is required.
  • Treat command output and logs as sensitive.
  • Keep network allowlists task-specific.
  • Save snapshots only when the task requires recoverable state.