Installation
An agent needs Ailoy and virtx’s packages, a way for its model to run, and a machine that can run its sandbox.
Requirements
- Python 3.11 or later, Node.js 22 or later, or Rust 1.95 or later.
- For the machine that runs the sandbox, which is yours unless the virtx server runs elsewhere, depending on its OS:
- Linux: KVM, with
/dev/kvmopen to your user and virtualization enabled in the firmware. Most kernels have KVM built in. - macOS: Apple silicon.
- Windows: Windows 11 or later, with the Windows Hypervisor Platform turned on (below).
- Linux: KVM, with
Windows
The Windows Hypervisor Platform is off by default. With virtualization enabled in the firmware, turn it on from an administrator PowerShell, then restart:
Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatformPackages
pip install ailoy-pyThis installs virtx too, the package your code makes sandboxes with.
npm install @brekkylab/ailoyThis installs @brekkylab/virtx too, the package your code makes sandboxes with. With pnpm, which keeps a package from importing what it did not list, add @brekkylab/virtx yourself.
cargo add ailoy virtx futures anyhow tokio --features tokio/macros,tokio/rt-multi-threadvirtx is the crate your code makes sandboxes with. Cargo lets your code use only the crates it lists, so add it beside ailoy. tokio, futures and anyhow are what the examples on these pages run on.
You don’t install virtx’s server separately: the first Client.spawn() (Client::spawn_virtx in Rust) downloads it into virtx’s cache.
A model to run
With a CLI login (default)
Claude, GPT and Gemini run through their CLIs by default, so the examples need no key. Install the one for your model and log in:
| CLI | Log in | Check |
|---|---|---|
| Claude Code | claude auth login |
claude auth status |
| Codex | codex login |
codex login status |
| Gemini CLI | Run gemini and sign in |
Without a login, the first turn fails with the CLI’s own message, such as Claude Code’s “Not logged in”.
With an API key
Set the key, and switch the org to the api backend before building the agent:
export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY, GEMINI_API_KEYimport ailoy
ailoy.set_lang_model_provider("anthropic", "api")const { setLangModelProvider } = require('@brekkylab/ailoy')
setLangModelProvider('anthropic', 'api')ailoy::model::set_lang_model_provider("anthropic", ailoy::model::Backend::Api);Model providers lists every backend: the CLIs, each org’s own API, Amazon Bedrock, OpenRouter and a server you run yourself (vLLM, llama-server, Ollama, LM Studio).
Troubleshooting
| What you see | Cause | Fix |
|---|---|---|
boot_failed, when a sandbox is made |
This machine can’t boot a VM. | Linux: open /dev/kvm to your user with sudo usermod -aG kvm $USER, then log in again. Windows: turn on the Hypervisor Platform. Any OS: turn on virtualization (Intel VT-x, AMD-V) in the firmware. Set KRUN_LOG=debug to see the hypervisor’s own messages after last logged. |
no virtx-stdio release … for macos-x86_64 |
virtx runs on Apple silicon only, not on an Intel Mac. | Run the virtx server on another machine and connect to it (Hello world). |
fetching …/virtx/releases/…, on the first Client.spawn() |
The server’s download failed. | Check the network or proxy, set VIRTX_DIST_URL to a mirror, or download the server yourself and point VIRTX_STDIO at it (Environment variables). |
… does not match its SHA256SUMS |
The download came back changed, as a proxy may do. | Try again, or set VIRTX_STDIO as above. |
| An error from the model’s CLI or API on the first turn | It comes from the model’s backend, not the sandbox. | See Model providers. |
Next
- How an agent works: where each part runs and what happens in a turn.
- Defining an agent: everything an
AgentBuildercan give an agent.