bash call to a Vers computer — so the agent acts on a remote machine without knowing it.
This direct API example uses retained v1 wire names such as
/vm, vm_id, and
vm_exec. Those are protocol and example identifiers; the product resource is
called a computer.What you’ll build
- An extension that registers
create_vm,vm_exec,vm_use,vm_local, and an overriddenbashtool - A transparent routing pattern that generalizes to containers, cloud VMs, SSH hosts, or any remote execution target
- Time: ~20 minutes — mostly reading, ~80 lines to write
Prerequisites
- pi coding agent installed
- Vers account with
VERS_API_KEYset in your environment sshandopensslon yourPATH
Step 1: Create the Extension
Create~/.pi/agent/extensions/my-vers.ts:
pi -e ~/.pi/agent/extensions/my-vers.ts. Pi should start with no errors.
Step 2: Add Computer Creation
Add this inside themyVersExtension function:
/reload in the TUI). Ask the agent to create a computer — it calls your tool and returns a computer ID.
Step 3: Add SSH Execution
Vers computers use SSH over TLS on port 443. Add the SSH helper and a tool:uname -a on it. You’ll see the computer’s kernel info.
The SSH connection uses
openssl s_client as a ProxyCommand to tunnel through TLS on port 443. This is how Vers exposes SSH without opening additional ports.Step 4: Override bash for Transparent Routing
This is the key pattern. Instead of making the LLM usevm_exec, override the built-in bash so normal commands route to the computer automatically:
- Ask the agent to create a computer
- Ask it to
vm_usethat computer - Ask it to install Node.js — it runs
apt-get install nodejsover SSH without the LLM knowing
bash as usual. Your extension decides where it runs.
Step 5: Add Status on Startup
Show the computer count in the footer when pi starts:The Complete Extension
The full file is ~80 lines of logic. Copy it from the assembled steps above, or see the production version with all four tool overrides (bash, read, edit, write) plus branching, commits, and SCP at hdresearch/pi-v.
Key Patterns
Tool override routing
API client as closure
TheversApi function, activeVmId state, and SSH helpers all live in the extension’s closure. Multiple tools share them. No global state, no classes — just functions and variables scoped to the extension.
Status feedback
ctx.ui.setStatus shows persistent info in the footer. ctx.ui.setWidget shows multi-line info above the editor. Use these to keep the user informed without interrupting the agent.
What’s next
Vers CLI
The supported command-line surface for remote computers.
Full pi-v extension
Production version:
read/edit/write overrides, commits, branches, SCP.Shell authentication
Create an API key through the terminal-oriented authentication flow.
Vers overview
The product model behind the API.