The open-source agent SDK that gives every agent its own VM.
Ailoy is an open-source SDK for building AI agents right in your own code. Every agent gets a Linux VM of its own as its sandbox, so it can install software, write and run code and keep files without touching your machine. The sandbox is part of how you build the agent, not a separate service you wire in.
CAD modeling |
Image editing |
Gameplay |
Laya(JEV) |
It supports Python,
JavaScript (
TypeScript), and
Rust APIs, and works on
Linux,
Windows, and
macOS.
Requirements
No system dependencies are required, but your agent's model needs a way to run: by default its provider's CLI (Claude Code, Codex or Gemini CLI), or its API with a key.
On Windows, the sandbox's microVM runs on the Windows Hypervisor Platform, which is off by default. Turn the optional feature on from an administrator PowerShell and restart, with virtualization enabled in the firmware:
Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform
Quickstart
By default, Claude, GPT and Gemini run through their CLIs, so install and log in to the one for your model: Claude Code (claude), Codex (codex) or Gemini CLI (gemini).
To call the provider's API instead, set its key and switch the org to the api backend before building the agent, e.g. ailoy.set_lang_model_provider("anthropic", "api") in Python (setLangModelProvider in Node.js, ailoy::model::set_lang_model_provider in Rust):
export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY, GEMINI_API_KEY
Amazon Bedrock, OpenRouter and a server you run yourself (vLLM, llama-server, Ollama, LM Studio) are backends too; see the model providers guide.
Then build your agent with this simple API in your preferred language:
Python
pip install ailoy-py
import asyncio
from pathlib import Path
from ailoy import AgentBuilder
from virtx import Client
async def main() -> None:
# Starts virtx's server, fetched into its cache the first time.
client = Client.spawn()
await client.pull_image("python:3.12-slim-trixie").complete()
sandbox = await client.create_sandbox("python:3.12-slim-trixie")
agent = await (
# For openai, use "openai/gpt-6-luna"
AgentBuilder("anthropic/claude-haiku-5-5")
.instruction("Write what you are asked for into /artifacts.")
.sandbox(sandbox)
.build()
)
async for output in agent.run("Create a bar chart comparing the populations of European countries and save it to /artifacts/population.png."):
for part in output["message"]["contents"]:
if part["type"] == "text":
print(part["text"])
Path("population.png").write_bytes(await sandbox.read_file("artifacts/population.png"))
asyncio.run(main())
agent.run yields one complete message for each step of the tool loop, and agent.run_stream streams each message token by token as the model writes it.
Node.js
npm install @brekkylab/ailoy @brekkylab/virtx
const { writeFileSync } = require('node:fs')
const { AgentBuilder } = require('@brekkylab/ailoy')
const { Client } = require('@brekkylab/virtx')
async function main() {
// Starts virtx's server, fetched into its cache the first time.
const client = Client.spawn()
await client.pullImage('python:3.12-slim-trixie').complete()
const sandbox = await client.createSandbox('python:3.12-slim-trixie')
// For openai, use "openai/gpt-6-luna"
const agent = await new AgentBuilder('anthropic/claude-haiku-5-5')
.instruction('Write what you are asked for into /artifacts.')
.sandbox(sandbox)
.build()
for await (const { message } of agent.run('Create a bar chart comparing the populations of European countries and save it to /artifacts/population.png.')) {
for (const part of message.contents) {
if (part.type === 'text') console.log(part.text)
}
}
writeFileSync('population.png', await sandbox.readFile('artifacts/population.png'))
await agent.close()
await client.close()
}
main()
agent.run yields one complete message for each step of the tool loop, and agent.runStream streams each message token by token as the model writes it.
Rust
[dependencies]
ailoy = "0.3"
virtx = "0.2"
use ailoy::{
agent::AgentBuilder,
message::{Message, Part, Role},
};
use futures::StreamExt as _;
use virtx::{Client, Files as _, SandboxCreateArgs};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Starts virtx's server, fetched into its cache the first time.
let client = Client::spawn_virtx([] as [&str; 0]).await?;
client.pull_image("python:3.12-slim-trixie", None).complete(false).await?;
let sandbox = client
.create_sandbox(&SandboxCreateArgs::new("python:3.12-slim-trixie"))
.await?;
// For openai, use "openai/gpt-6-luna"
let mut agent = AgentBuilder::new("anthropic/claude-haiku-5-5")
.instruction("Write what you are asked for into /artifacts.")
.sandbox(sandbox.clone())
.build()
.await?;
let query = Message::new(Role::User).with_contents([Part::text("Create a bar chart comparing the populations of European countries and save it to /artifacts/population.png.")]);
let mut stream = agent.run(query);
while let Some(output) = stream.next().await {
let message = output?.message;
if message.role == Role::Assistant {
for text in message.contents.iter().filter_map(Part::as_text) {
println!("{text}");
}
}
}
let png = sandbox.read_file("artifacts/population.png", 0, None).await?;
std::fs::write("population.png", png)?;
Ok(())
}
agent.run yields one complete message for each step of the tool loop, and agent.run_stream streams each message token by token as the model writes it.
...Or skip the reading: point your coding agent (Claude Code, Codex, Cursor, ...) at this README and tell it what agent you want to build. This repo is its own plugin marketplace, so the agent skill installs with no clone first:
claude plugin marketplace add brekkylab/ailoy && claude plugin install ailoy@brekkylab
codex plugin marketplace add brekkylab/ailoy && codex plugin add ailoy@brekkylab
What can an agent do?
The examples live in ailoy-examples, each in Rust, Python and Node, with the commands to run them in their READMEs.
You'll need a GPU (any GPU that supports Vulkan, or Metal on Macs) for the examples that run ML models.
| Example | Description |
|---|---|
| cad | Writes CadQuery, renders the model from four sides, looks at the renders and iterates |
| offshore_leaks | Analyses the ICIJ Offshore Leaks database with SQL and Python that the agent writes itself |
| retail_bench | Runs a supermarket simulator, one day per turn |
| gameplay | Plays OpenTTD (Transport Tycoon Deluxe) while you watch over VNC |
| sam3 | Segments images and videos with SAM3 on the guest GPU (ncnn + Vulkan) |
| tts | Speaks text in a voice described in words, using Qwen3-TTS |
| laya | Answers typed decision questions with a local model on the GPU |
| browser-use | Waits for what you ask of it, in a window of your own browser |
Small examples that each show one thing stay here in examples/. The first, hello, is one turn with no tools and no sandbox:
cargo run --example hello # Rust
cd examples/hello/python && uv run main.py # Python
cd examples/hello/node && npm install && npm start # Node
How it works
Ailoy gives the agent a computer of its own.
Agent stacks are often put together from separate pieces: a library that runs the loop around the model, a hosted service that provides the sandbox, and glue code between the two. Ailoy keeps the loop and the sandbox in one SDK:
- The Ailoy SDK runs the agent loop on your host. It sends the prompt to the model, runs the tool calls the model asks for, feeds the results back, and decides when the agent is done.
- virtx gives each agent a Linux VM of its own, built on krun, with no separate VM daemon to install. The VM is the agent's sandbox: its commands and file tools run inside it, and files go in and out of it through virtx, never through your machine's own folders.
That lets you build agents that do more than call predefined tools. Inside its VM an agent can install and use software, write its own scripts and work in a general-purpose computing environment. The VM supports the GPU too, so an agent can run ML models, or even games, in there.
The docs cover the VM's image, volumes and resources, and the virtx README covers the VM layer itself.
Building from source
git clone https://github.com/brekkylab/ailoy
cd ailoy
cargo build
For the bindings:
cd bindings/python && uv run maturin develop # Python
cd bindings/node && npm install && npm run build # Node.js
Contributing
Bug reports, ideas and pull requests are welcome. CONTRIBUTING.md covers setup, tests and how to open a PR. Questions and show-and-tell go on Discord.
License
Apache-2.0. See LICENSE.md.
Metadata
Release files for ailoy-py 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| ailoy_py-0.3.3-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for ailoy_py-0.3.3-cp311-abi3-win_amd64.whl |
| ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ x86-64 | Details for ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_x86_64.whl |
| ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ ARM64 | Details for ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_aarch64.whl |
| ailoy_py-0.3.3-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for ailoy_py-0.3.3-cp311-abi3-macosx_11_0_arm64.whl |
Total release size: 53.1 MB
Release files / ailoy_py-0.3.3-cp311-abi3-win_amd64.whl
| Download URL | ailoy_py-0.3.3-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 12.6 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0ea965d5a78b8a41a791a56d9559c0a9ea10216cc4bd32e04f2a0f9a03b6151b
|
|
BLAKE2b-256 checksum How to use checksums |
46b54ad23e32e3d5b12d2e7867d01d706f1e4e2a17927d05c7cfb54b5e1f3b96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 13.9 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fd93314409a7817d60634792f5094e8f6b0425f17e19a9e7081c781c5f35fae4
|
|
BLAKE2b-256 checksum How to use checksums |
3d87e2a26d6ffda864c11e2dc9eca70bdd2a5d5ef64aa35ca18ce68e13a16921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | ailoy_py-0.3.3-cp311-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 14.1 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8066e1301bb10b2ca3db3b4a9f491e3e9d4bb693f2bb471aba4d4c3a40b38c00
|
|
BLAKE2b-256 checksum How to use checksums |
f6bfb7e704c230f52e5ce8d8b7a11c473d3aafe4b95c769ddccf35f02664c102
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / ailoy_py-0.3.3-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | ailoy_py-0.3.3-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 12.5 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5c9721048c8f4b3234c9070de73758a8f3adcebd08eedbc66ee4bbdf56b5b777
|
|
BLAKE2b-256 checksum How to use checksums |
7b8509ebe3786ff5efadcb4a29350f7721b1ad6035ee66def5d51434be3994c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for ailoy-py 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.