Modern development has shifted from the local workstation to a variety of environments, including high-powered cloud virtual machines, home servers, and specialized development boxes. As AI coding agents become an essential part of our daily workflows, it is increasingly common to find yourself in a situation where the agent is busy executing a long-running task on a remote machine, yet you need to interact with it from your mobile device or a different computer. Dealing with the limitations of session management, network constraints, and security is a significant hurdle for any developer working with remote AI agents.
As of October 2026, major CLI-based AI coding agents have matured significantly, providing native mechanisms for remote interaction. Claude Code 2.1.310 introduces the claude remote-control functionality, which allows developers to bridge a session running on a remote VM directly into the Claude mobile application or via the web interface at Claude. Simultaneously, OpenAI has advanced its ecosystem with the OpenAI Codex 0.164.0, which includes experimental daemon support and integration with the ChatGPT desktop application. These tools ensure that your agent remains reachable without requiring you to expose your machines directly to the public internet.
Understanding the Underlying Mechanisms
To effectively manage these agents remotely, one must understand that we are essentially dealing with three primary connectivity models. First, we have the SSH-based approach, which remains the bedrock of remote interaction. By maintaining a persistent shell session, you ensure the agent remains operational regardless of your local network status. Second, we have vendor-managed relays, where the agent makes outbound requests to a cloud-based service, essentially acting as a bridge between your local mobile device and the remote compute node. Third, we have tunneling technologies, which become necessary when your development box is situated behind a restrictive NAT or firewall environment.
The Foundational Workflow: SSH and Tmux
The most robust way to manage long-running processes on a remote machine is by using tmux. This terminal multiplexer allows you to detach from a session and reattach later, effectively insulating your agent from network interruptions. We recommend defining your VM in your ~/.ssh/config file to streamline access.
Host devbox
HostName 203.0.113.10
User ubuntu
IdentityFile ~/.ssh/id_ed25519
ServerAliveInterval 30
Once configured, you can use a single command to handle session creation and reattachment seamlessly:
ssh -t devbox tmux new -A -s agent
By utilizing the -A flag, tmux will attempt to attach to an existing session named agent or create it if it does not exist. Inside this session, you can launch your agent, work on your code, and detach by pressing Ctrl-b followed by d.
Implementing Claude Code Remote Control
For those utilizing Claude Code, the remote control feature is exceptionally powerful. It transforms your VM into a server that communicates securely with the Anthropic API. To activate this, ensure you are running your agent within a managed terminal environment like tmux and execute the remote control command:
cd ~/app
claude remote-control --name "devbox app"
Upon initialization, the tool will provide a session URL or a QR code. Scanning this with the Claude mobile app connects your phone to the remote process. This configuration ensures that execution remains on the VM while your interaction layer becomes mobile. It is critical to note that this functionality requires a qualifying subscription, such as Pro, Max, Team, or Enterprise, and is not compatible with standard API key-based deployments.
Advanced Codex Deployment Strategies
The OpenAI Codex offers a more granular approach to remote connectivity. The recommended production path is integrating your VM as an SSH host within the ChatGPT desktop application. By registering the host, the desktop app manages the underlying SSH connections and provides a GUI-driven interface for your remote projects. For advanced users, the experimental headless daemon mode exists as an alternative.
codex remote-control start
codex remote-control pair
If you prefer a terminal-centric workflow without the overhead of desktop applications, you can leverage the codex app-server to bind to a local loopback address, which is then exposed via SSH tunneling. This effectively turns any terminal with SSH access into a control node for your agent.
# On the VM
codex app-server --listen ws://127.0.0.1:4500
# On your laptop
ssh -N -L 4500:127.0.0.1:4500 devbox
Managing NAT Traversal with Pinggy
Development environments often exist on home networks behind Carrier-Grade NAT (CGNAT). Under these conditions, inbound SSH access is impossible without assistance. Pinggy provides an elegant solution to this problem by creating a reverse tunnel from your local box to the public internet.
To expose your local SSH port, execute the following command on your devbox:
ssh -p 443 -R0:localhost:22 tcp@free.pinggy.io
This command opens a secure tunnel, providing you with a unique public address that routes back to your home devbox. For stable, production-grade usage, you should utilize a Pro token to reserve a persistent port, which ensures that your configuration does not change between reboots. This is essential for maintaining a consistent connection for your coding agents.
Production Considerations and Best Practices
When deploying AI agents in a remote configuration, security must be your primary focus. Because these agents possess the capability to read, write, and execute code on your file system, you must ensure that your SSH configuration is hardened. Disabling password-based authentication in favor of public-key cryptography is non-negotiable. Ensure that your /etc/ssh/sshd_config contains PasswordAuthentication no and verify this with sshd -T.
Additionally, consider the resource consumption of your agent. Large-scale repository indexing and real-time inference can consume significant CPU and memory. Use htop or top to monitor your VM performance while the agent is active. If you notice performance degradation, consider leveraging Docker containers to isolate the agent environment from the rest of your system, ensuring that a runaway process cannot exhaust all available host resources.
Troubleshooting Common Issues
If your remote connection fails, the first step is always to verify the reachability of the underlying SSH tunnel. Use ssh -v to debug handshake issues. If the agent itself becomes unresponsive, reattach to your tmux session to check for runtime errors or process crashes. For Claude Code, ensure that the ANTHROPIC_BASE_URL variable is not misconfigured, as custom gateways can interfere with the signaling required for remote control functionality. For Codex, verify that the version on your remote host matches the version of your local client, as minor version discrepancies can occasionally cause protocol mismatches in the WebSocket communication layer.
When dealing with home devboxes, remember that network stability is a variable. ISPs may reset connections periodically. Implementing a systemd service to automatically restart your Pinggy tunnel ensures that your remote development environment recovers gracefully from power outages or network resets.
Future-Proofing Your Workflow
As the ecosystem evolves, keep an eye on official documentation from Anthropic and OpenAI. The landscape of AI agents is changing rapidly, and new features are added on a monthly basis. Subscribing to release notes and tracking relevant GitHub issues will allow you to stay ahead of breaking changes. By mastering the fundamental patterns of process isolation via tmux, secure remote access via ssh, and network agility via Pinggy, you are positioning yourself to take full advantage of the next generation of AI-assisted software development, regardless of where your hardware happens to be located.
Every route in this guide rests on one rule: the agent runs on the VM, and your phone and laptop are only windows into it. The work is keeping that process alive and reachable: tmux for the session, the remote-control mode your plan supports for the phone, and SSH for everything else, through a Pinggy tunnel when the box is at home. To check it, start a long task, detach from tmux, close the SSH session and open the session on your phone. If the agent is still working, you are set.

Top comments (0)