A coding agent on your laptop stops when your laptop does. Close the lid on the way to a meeting and the long refactor you started is paused until you are back, if the terminal session survives at all. The usual workaround is a cloud VM you set up by hand, with your SSH keys, your tools and your agent installed, which you then forget to turn off.

Sandscale workspaces are built for this case. The workspaces concept page describes one as a persistent cloud computer for coding agents and for you: its files survive, you open it in the browser or over SSH, and it stops when nobody is using it. This post walks through using one for a long-running agent session, based on the workspace guide and the CLI reference.

Workspace or sandbox?

Sandscale has both, and they solve different problems.

  • A sandbox is a throwaway box. It starts from a template or snapshot, runs, and when it stops its disk is deleted. It is the right place for code you do not trust and for anything you want to start clean every time.
  • A workspace keeps its disk. Your repository, branch, installed tools and the agent's session are still there the next time you open it. It is the right place for your own ongoing work, with an agent working alongside you.

For "keep my agent going on this repo while I am away", a workspace is the fit. For "run this untrusted install script", a sandbox is.

Set it up

From the guide, with the CLI installed and signed in:

sandscale workspace templates list sandscale workspace create payments-dev --template go-service sandscale workspace open payments-dev 

A template is the machine your organization set up: image, size and tools. templates show NAME lists any parameters, filled in with --param KEY=VALUE. The first build takes a while; sandscale workspace logs payments-dev shows it.

open starts the workspace if it is stopped, waits until it runs and connects over SSH with a short-lived certificate and a checked host key. --ide browser opens it in the browser instead, and editors that connect over SSH, such as VS Code or Cursor, use sandscale workspace ssh. The SDKs can list, start, stop and connect to workspaces; creating one is done with the CLI or the console.

Run the agent inside it

Once connected, install and run your agent in the workspace the way you would locally. The concepts page names Claude Code, Codex, Gemini CLI or your own agent. Run it inside a terminal multiplexer such as tmux, so the session belongs to the workspace and not to your SSH connection. Then:

  • Close your laptop. The SSH connection drops; the agent's session keeps running on the workspace.
  • Later, from any device, sandscale workspace ssh payments-dev and reattach.

The editors and devices page puts it as: the agent's session lives on the workspace, not your laptop.

If the agent runs a dev server, reach it with port forwarding:

sandscale workspace port-forward payments-dev 3000 5432:5432 

Each port listens on 127.0.0.1 on your computer and reaches the workspace through SSH until you press Ctrl+C. Nothing is opened to the internet.

Schedules and idle stop

A workspace that runs all night by accident is the cloud-VM problem again. Workspaces have two controls:

  • Idle stop. A workspace stops when it has been idle for a while; sandscale workspace schedule idle payments-dev 30m sets how long.
  • Schedules. schedule start payments-dev "30 8 * * 1-5" --timezone Europe/Berlin starts it at 08:30 on weekdays, and schedule stop payments-dev 8h stops it 8 hours after each start. Your organization's policy can shorten what you set, and schedule show prints the values in force.

Hours count against your plan only while the workspace runs, and stopping keeps the disk. For an agent left working overnight, decide in advance how long it may run, and set the stop schedule to match. Before relying on idle stop during a long unattended task, check with schedule show and a short test that the workspace stays up while your agent is busy and stops when it is done; that way the behaviour you depend on is one you have seen.

What to give the agent

A workspace is your computer in the cloud, so the security question is the same as on your laptop: what can the agent reach?

  • Repository access. The agent needs to push a branch, not to merge to main. A token or deploy key scoped to the repository, with branch protection on main, keeps a bad night to a bad branch.
  • Secrets. Put the ones the agent needs in Vault, not in a dotfile on the disk. A persistent disk is persistent for secrets too.
  • Policy. Agent policy can allow, block or send a step to a person, and approvals route risky calls to a named approver. For unattended work, decide which commands should wait for you in the morning rather than run.
  • Throwaway work in sandboxes. If the agent needs to run something untrusted, such as a third-party script or an unfamiliar repo's install, it can use the Sandscale MCP server to do that in a sandbox instead of on the workspace's disk.

Starts, stops and wakes are recorded in the audit log, per the schedules page.

When Agent Cloud fits better

If what you want is "give this task to an agent and get a pull request back", rather than "keep my own session alive", Agent Cloud does that on top of workspaces: each task runs in a workspace of its own, you can watch it step by step, and the result is a branch and a pull request, never a push to main. The plans reference lists Agent Cloud on Pro, Team and Enterprise.

Which plan

The plans reference lists workspaces on every plan. Workspaces use your plan's vCPU-hours only while they run.

Originally published on the Sandscale blog.