← All posts

Your AI Coding Agent Is Wasted on Your Laptop: Wire It to a Remote Linux Box

October 16, 2026 · 4 min read · The xShellz Team

TL;DR

  • SSH into an xshellz.box Agent Shell and run Codex or Gemini CLI directly on a dedicated Ubuntu 24.04 box that stays up 24/7 with no idle timeout.
  • Every Agent Shell ships with 6 coding agent CLIs preinstalled, including Codex and Gemini CLI, so there is nothing to install after you connect.
  • The root account inside the box is fake root, sandboxed by gVisor plus userns-remap, so the agent gets a real shell without touching a raw VPS.

SSH into an xshellz.box Agent Shell and run Codex or Gemini CLI there directly. Connect with ssh -p <port> root@<host>; the box runs Ubuntu 24.04 and all 6 coding agent CLIs, including Codex and Gemini CLI, are already installed. Your agent gets a real Linux shell, not a chat window.

We build and operate xShellz, the team behind the borg terminal agent, the Agent Shell boxes and the hosted model gateway; everything below is what we run in production ourselves.

How do I give Gemini CLI or Codex a remote Linux environment to actually run commands in?

SSH into an Agent Shell box and type the agent's command. The box ships with all 6 agent CLIs preinstalled, so ssh -p <port> root@<host> drops you into an Ubuntu 24.04 shell where codex and gemini already exist. Start one inside tmux and it keeps running after you disconnect, because the box itself runs 24/7 with no idle shutdown. There is no chat-only mode to settle for: the agent simply has a shell.

how to connect ai coding agents to a remote shell

ssh -p <port> root@<host>
tmux new -s codex codex

The first line opens the SSH session; the second starts Codex inside tmux so the session survives your laptop sleeping. Gemini CLI works the same way: tmux new -s gemini gemini. Detach with Ctrl-b then d and reattach later with tmux attach -t codex, per the tmux manual. This is standard SSH plus tmux, nothing proprietary. There is also an MCP route for Claude Code: claude mcp add xshellz -- ssh -p <port> agent@<host> xshellz-mcp.

can i use gemini cli on a remote linux box via ssh

Yes. Gemini CLI is one of the 6 coding agent CLIs preinstalled on every Agent Shell, so connect with ssh -p <port> root@<host>, type gemini, and supply your own API key. Because the box is always-on, a long agent task started in tmux is still running when you check back the next morning. Your home directory /root persists across rebuilds, so prompts, configs and any files the agent writes stay put while the rest of the filesystem resets on image updates.

how to set up a remote dev environment for ai agents

The toolchain ships already: git, Node 22, Python 3, ripgrep, tmux, build-essential, nano, vim, htop and less. For extra packages you write an xshellz.box manifest file in your home directory, one package per line (a bare name or apt: for apt, pip: for Python, npm: for Node), and it is reinstalled on every boot. So every box is the same environment. /root is the only path that survives a rebuild; everything else resets to a clean image. See the Agent Shell page for the full setup.

is it safe to give an ai agent ssh access to a server

The root you get is not a raw VPS root. xshellz.box runs every box with Linux userns-remap plus a gVisor sandbox, so the agent's root is fake root inside a namespaced, sandboxed kernel, as documented for user namespaces. That is the tradeoff we picked: real shell access, no host compromise. The only persistent path is /root; the rest of the filesystem is ephemeral and resets when a box is rebuilt on a newer image. An agent's worst mistake is contained to a throwaway layer.

Frequently asked questions

Do I need to install Codex or Gemini CLI on the box myself?

No. Every Agent Shell ships with 6 coding agent CLIs preinstalled: borg, Claude Code, OpenAI Codex, Gemini CLI, opencode and pi. After ssh -p <port> root@<host> you type codex or gemini and it runs.

What happens to my files when the box is rebuilt?

Only /root persists; the rest of the filesystem is ephemeral and resets when a box is rebuilt on a newer image. Your home directory, including agent configs and service account files, survives, while system files return to a clean Ubuntu 24.04 baseline.

Does the free tier pause when my laptop is closed?

No. Every tier, free included, runs 24/7 with 0 idle timeout and 0 trial countdown. The box stays up whether or not your SSH session is connected, which is the whole point: an agent that only runs while your terminal is open is a script, not an agent.