Bastion: Isolated Linux VMs for Background Coding Agents
Bastion provides isolated Linux virtual machines (VMs) specifically designed for background coding agents. By giving each agent its own VM, Bastion eliminates runtime conflicts between parallel agents and provides complete control over the file system and background processes.
Key Capabilities of Bastion
Bastion allows developers to scale background coding agents by providing them with dedicated, reproducible environments. The system is designed for isolation and automation through the following features:
Virtual Machine Isolation
Every coding agent runs in a separate VM, ensuring that agents working in parallel do not interfere with one another. This isolation provides agents with full administrative control over their specific development environment, including the management of background processes and the file system.
JSON-Based Environment Definition
Environments are not configured manually. Instead, Bastion uses schema-validated JSON templates to initialize environments. These templates define the agent's working directory, authentication keys (such as OpenAI API keys), and the specific model configuration (e.g., openai/gpt-5.5).
Self-Hosting and Infrastructure
Bastion can be self-hosted on any Linux system with KVM support. This allows deployment on local workstations or cloud instances, such as AWS EC2, giving users full control over their infrastructure.
Workflow and Implementation
Deploying an agent environment in Bastion involves a four-step process:
- Template Creation: A JSON configuration file is created to define the agent's environment. This includes an
actionsblock where the user can specify initialization steps—such as installing Bun, cloning a Git repository, and runningbun install—and start-up commands likenohup bun run dev &. - Template Initialization: The template is registered with the Bastion CLI using the command
bastion templates create --key acme-app --file ./template.json. - Environment Deployment: An environment is deployed from the template using
bastion env create --template-key acme-app --key agent-1 --tag issue-32. - Interfacing: Users can access the environment directly via SSH or through the Bastion-specific
opencodeinterface usingbastion opencode --key agent-1.
Technical Architecture
Bastion leverages KVM (Kernel-based Virtual Machine) for its isolation layer. The system provides a variety of utility tools and runtimes to simplify the environment setup through custom actions. It also supports proxying to environment services and a multiplexer for managing multiple agent environments.
"Cool concept! I guess you already knew the name Bastion would conflict with the term "Bastion host""
— @Alifatisk on Hacker News