Ailoy is a library for building any kind of AI agents right in your own code.
It works on Linux, Windows, and macOS.
[!WARNING] Ailoy is under active development, and its API may change between versions.
Requirements
No system dependencies are required, but you need an API key for the LLM provider your agent will use.
Mounting host folders into the console (virtx's virtual filesystem) needs FUSE: install FUSE-T on macOS or Dokany on Windows. See the virtx documentation for details.
On Windows, the console's micro-VM 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
Set the API key for your model's provider, either in the environment or in a .env file:
Then build your agent with this simple API in your preferred language:
= await
= await
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.
const = require
const console_ = await
.
.
.
.
// For openai, use "openai/gpt-5.6-luna"
const agent = await
.
.
.
.
try finally
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.
[]
= "0.3"
= "0.1"
use ;
use Recipe;
use StreamExt as _;
async
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.
What can an agent do?
You'll need a GPU (any GPU that supports Vulkan, or Metal on Macs) for the examples that run ML models.
| Example | Description |
|---|---|
| hello | One turn with no tools and no console |
| 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 |
Each example lives in examples/<name>, with one folder per language (rust, python, node) and, where the three share files (skills, prompts, model preparation scripts), a shared folder.
Rust:
Python:
Node:
How It Works
Ailoy give the agent a computer of its own.
This lets you build agents that do more than call predefined tools: they can install and use software, create their own scripts, and operate in a general-purpose computing environment—without touching the host system beyond what you explicitly expose.
To make this possible, Ailoy uses krun-based virtualization to give each agent a virtual machine of its own, with no separate VM daemon to install.
The virtualization used in Ailoy also supports the GPU, so an agent can run ML models, or even games, inside its VM.
See virtx for more details.
Building from source
For the bindings:
&& && &&
License
Apache-2.0. See LICENSE.md.