Terminal sessions
Launch a coding agent directly on a Railway cloud agent and work with it through your terminal. Railway CA gives you one place to browse your machines, start sessions, and return to work that's still running.
The coding agent and its terminal interface run on the Railway machine. Your computer connects over SSH; your code, tools, and session processes stay on the cloud agent.
To manage these machines in Herdr, use the Herdr setup guide.
Start a session
Follow the quickstart prerequisites to enable Cloud Agents, install the Railway CLI, and sign in. Then choose a coding agent:
| Coding agent | Launch command |
|---|---|
| Claude Code | railway code --claude |
| Codex | railway code --codex |
| Grok | railway code --grok |
| Railway Agent | railway code --railway |
| OpenCode | railway code --opencode remote |
Each of these commands creates a new cloud agent, carries available credentials, and opens the session in Railway CA. To reuse an existing agent, use railway ca start with the same flag. Add --new there when you want a fresh machine and disk:
railway ca start --claude
railway ca start --claude --newFor Codex, OpenCode, and Railway Agent, railway code can also select an existing agent with --agent <agent-name>.
Railway Agent uses the Railway credentials already on the machine. Other coding agents can use eligible sign-ins from your computer or ask you to authenticate on the agent. See credentials and configuration.
OpenCode's remote action runs both its client and server on the cloud agent. Without remote, the command prepares a server and offers to connect a client on your computer.
Choose an agent interactively
Open the Railway CA menu to browse machines and sessions or start a new one:
railway caThe launch picker includes the coding agents above and a shell.
Save your default coding agent, project, and skills preferences with:
railway ca setuprailway ca and railway ca start use that preference when you don't pass an agent flag. railway code doesn't: without an agent flag, it opens Railway Agent on a new VM.
Work with a repository
A new machine starts in /app. You can ask the coding agent to clone a repository and work in it, or open a shell:
railway ca ssh <agent-name> -- bashThen clone your project:
cd /app
gh repo clone OWNER/REPOSITORYLaunching from a local repository does not upload its source files. See give it a project for the first-task walkthrough.
Manage and return to sessions
Inside Railway CA, press Option+F to show the agent tree. Each machine shows its existing sessions beneath its name. Select a running session to return to it. To start another session on an existing agent, select the agent and press Option+P to start one from a prompt. Press n to create a new agent instead. Option+N opens the same picker in the selected agent's project. On macOS, Option+N needs your terminal to use Option as Meta.
A terminal disconnect leaves the machine and its active sessions running until the agent sleeps after five idle minutes. A command left running in a detached session doesn't keep the agent awake. Open railway ca again to reconnect. Exiting the coding agent itself ends that session's process.
Stop compute when you're finished:
railway ca sleep <agent-name>Sleep keeps the disk and stops running processes. After waking the machine, start a new process to continue; saved history depends on the coding agent. See manage agents and sessions.
Additional installed tools
The development image also includes pi and Cursor CLI. These are available from a shell and use their own sign-in flows. The Railway CLI's launch picker and automatic credential transfer cover the agents listed above.
Open a shell with railway ca ssh <agent-name> -- bash, then run pi or cursor-agent. Complete the tool's authentication on the cloud agent as needed.
Connect a local app instead
You can also use Railway as a remote environment for Claude Desktop, Codex Desktop, or OpenCode Desktop and local terminal clients. Choose that path when you want to work through an app on your computer.