Local libvirt/KVM sandbox VM manager for coding agents (Ubuntu 24.04 cloud-image, SSH, optional virtiofs share, optional nftables isolation).
Project description
Read the Docs |
|
Pypi |
A small Python CLI to create and manage a local libvirt/KVM Ubuntu 24.04 VM designed for running coding agents with a stronger boundary than containers.
What it provides
Dedicated libvirt NAT network per aivm configuration
Optional host firewall isolation via nftables
Ubuntu cloud-image VM provisioning via cloud-init
SSH + VS Code Remote-SSH workflows
Optional virtiofs folder sharing (explicit trust extension)
Optional settings sync into the guest user profile
A single config store for defaults, VMs, networks, and attachments
Install
uv pip install .
Fast Start
Recommended for new repos:
Currently aivm config init is required, but we will make that implicit in a future version.
aivm code .
aivm status
aivm status --sudo # optional deeper privileged checks
aivm code . auto-selects/bootstraps VM context from the global config store (~/.config/aivm/config.toml), attaches the current folder if needed, and opens VS Code.
If you prefer an explicit flow, aivm config init is required before aivm vm create.
See also:
Status and sudo behavior
By default, aivm status avoids privileged probes. Use --sudo for network/firewall/libvirt/image checks.
Privileged host actions prompt before sudo operations. Use:
--yes to auto-approve all prompts
--yes-sudo to auto-approve only sudo prompts
Config default:
[behavior]
yes_sudo = true
Common Workflows
VS Code and SSH
aivm vm ssh_config
aivm code . --sync_settings
aivm vm code --host_src . --sync_settings
aivm vm code . --sync_settings
aivm vm ssh .
Folder attachment
aivm attach .
aivm vm attach --vm aivm-2404 --host_src .
By default, attached folders mount to the same absolute path inside the guest. Use --guest_dst to override. Running VMs are live-attached when possible. aivm code and aivm ssh remount the selected folder and best-effort restore other folders already saved for that VM after guest startup.
Inventory and visibility
aivm list
aivm vm list
aivm list --section vms
aivm list --section networks
aivm list --section folders
aivm status --detail
Config-store lifecycle (explicit flow)
aivm config init
aivm vm create
aivm vm sync_settings
aivm vm update
aivm config discover
aivm config show
aivm config edit
aivm help plan
aivm help tree
aivm host doctor
Settings sync configuration
[sync]
enabled = true
overwrite = true
paths = [
"~/.gitconfig",
"~/.gitignore",
"~/.config/Code/User/settings.json",
"~/.config/Code/User/keybindings.json",
"~/.tmux.conf",
"~/.bashrc",
]
Ad hoc override:
aivm vm sync-settings \
--paths "~/.gitconfig,~/.config/Code/User/settings.json,~/.tmux.conf"
When [sync].enabled=true, aivm vm code ... syncs before launching VS Code.
Command Groups
aivm config --help
aivm host --help
aivm host image_fetch --help
aivm help --help
aivm host net --help
aivm host fw --help
aivm vm --help
Safety Notes
This tool assumes Linux + libvirt. It focuses on Debian/Ubuntu hosts for dependency installation.
Security model and threat model details: the Security Model.
NAT alone does not prevent VM -> LAN. Enable firewall isolation if you want “internet-only” access.
To allow specific VM->host or VM->blocked-LAN service ports while firewall isolation is enabled, set [firewall].allow_tcp_ports / allow_udp_ports in config (for example allow_tcp_ports = [22, 5432]).
virtiofs sharing is optional; it’s powerful, but it intentionally exposes that host directory to the VM.
aivm vm code requires VS Code’s code CLI and the Remote - SSH extension.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aivm-0.2.0.tar.gz.
File metadata
- Download URL: aivm-0.2.0.tar.gz
- Upload date:
- Size: 93.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7b983541c2091b478207709dd8a67918f2df3eefb6601f453a9af36fa69e953
|
|
| MD5 |
ab390faf0cf7544542ba583d00a4deee
|
|
| BLAKE2b-256 |
2fabea707fa2405173dad181d71fc64d16e59673ff67bd2eb1197d164bd41e3c
|
File details
Details for the file aivm-0.2.0-py3-none-any.whl.
File metadata
- Download URL: aivm-0.2.0-py3-none-any.whl
- Upload date:
- Size: 76.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6afde12b2b7281fd5939673dd6ba24fd9bb66f0488fcca1323e1e1df83da01a8
|
|
| MD5 |
b606ab8e5c61b33f46a2df44bfd676f5
|
|
| BLAKE2b-256 |
bf4a35d75b55ea9e62ab45a116b7f13066180b2a5a908866b00799c1fcae9be9
|