Skip to content
Runtime

How to run Cline in a cloud sandbox

Install the cline CLI with npm in a Linux microVM. Authenticate it with a secret's placeholder, and run cline --json "<task>".

Runtime lets the Cline CLI keep its default auto-approve on, without trusting it with your key. Cline's CLI approves every tool by default when it is given a prompt. A scripted run needs that. A laptop should not allow it. On Runtime, the run happens in a Firecracker microVM with its own kernel, Ubuntu 24.04 and Node.js 24. That is well past Cline's Node.js 20 minimum. The provider key is a Runtime secret. What Cline saves in its providers.json is a placeholder. The host's proxy adds the real key to requests to the provider's API. A 2 vCPU, 4 GiB sandbox costs $0.03125 an hour while Cline waits on the model. The cline npm package was at 3.0.73 on 25 October 2026.

Cline comes in two forms. Each pairs with Runtime in a different way:

Cline Pairing
The CLI (cline) Runs inside a sandbox on a checkout, driven by the SDK
The VS Code extension Stays in your editor and calls Runtime's MCP server for sandboxes

Put the key in as a placeholder

Cline stores provider credentials with cline auth. Store the real key as a Runtime secret first:

Terminalprintf %s "$ANTHROPIC_API_KEY" | npx withruntime secrets set ANTHROPIC_API_KEY --host api.anthropic.com

Inside every sandbox in your account, ANTHROPIC_API_KEY now holds a placeholder. Passing that variable to cline auth --apikey stores the placeholder in ~/.cline/data/settings/providers.json. The placeholder is worthless to anyone who copies the file. The proxy swaps in the real key on HTTPS requests to api.anthropic.com, and only on those requests (secrets sandboxes never see).

Run the CLI on a repo

TypeScriptimport { writeFile } from "node:fs/promises";import { Sandbox } from "withruntime";const repo = "https://github.com/your-org/your-repo";const task = "Make the settings page load without layout shift and run the unit tests.";await using sbx = await Sandbox.create({ diskMiB: 8192, timeoutSeconds: 3600 });const step = { check: true, timeoutMs: 600_000 } as const;await sbx.exec("npm install -g --prefix /workspace/.local cline", step);await sbx.exec(["git", "clone", "--depth", "1", repo, "/workspace/app"], step);await sbx.exec(  'cline auth --provider anthropic --apikey "$ANTHROPIC_API_KEY" --modelid claude-opus-5-5',  step,);await sbx.network.set({ internet: true, allow: ["api.anthropic.com", "registry.npmjs.org"] });const run = await sbx.exec(["cline", "--json", "-t", "1500", "-c", "/workspace/app", task], {  timeoutMs: 1_800_000,  onStderr: (text) => process.stderr.write(text),});const lines = run.stdout  .split("\n")  .filter(Boolean)  .map((line) => JSON.parse(line));const finished = lines.find((m) => m.type === "run_result");console.log(run.exitCode, finished?.finishReason, finished?.text);await sbx.exec("git add -A && git diff --cached > /workspace/cline.patch", {  cwd: "/workspace/app",  check: true,});await writeFile("cline.patch", await sbx.files.readText("/workspace/cline.patch"));
Pythonimport sys, jsonfrom withruntime import Sandboxrepo = "https://github.com/your-org/your-repo"task = "Make the settings page load without layout shift and run the unit tests."with Sandbox.create(disk_mib=8192, timeout_seconds=3600) as sbx:    sbx.exec("npm install -g --prefix /workspace/.local cline",             check=True, timeout_ms=600_000)    sbx.exec(["git", "clone", "--depth", "1", repo, "/workspace/app"],             check=True, timeout_ms=600_000)    sbx.exec('cline auth --provider anthropic --apikey "$ANTHROPIC_API_KEY"'             " --modelid claude-opus-5-5", check=True, timeout_ms=600_000)    sbx.network.set(internet=True, allow=["api.anthropic.com", "registry.npmjs.org"])    run = sbx.exec(["cline", "--json", "-t", "1500", "-c", "/workspace/app", task],                   timeout_ms=1_800_000, on_stderr=sys.stderr.write)    lines = [json.loads(line) for line in run.stdout.splitlines() if line]    finished = next((m for m in lines if m.get("type") == "run_result"), None)    print(run.exit_code, finished and finished.get("finishReason"), finished and finished.get("text"))    sbx.exec("git add -A && git diff --cached > /workspace/cline.patch",             cwd="/workspace/app", check=True)    with open("cline.patch", "w") as file:        file.write(sbx.files.read_text("/workspace/cline.patch"))

What each line does:

  • The install uses --prefix /workspace/.local. cline therefore lands in the first directory on the sandbox's PATH, with no sudo.
  • cline auth runs through a shell on purpose. The shell expands $ANTHROPIC_API_KEY to the placeholder inside the sandbox. The command line your code sends contains no key at all. The flags match Cline's own GitHub Actions sample.
  • --json turns on headless output: one JSON object per line, with a type and a ts timestamp. Agent events arrive as agent_event lines, and the run_result line holds finishReason and the final text, which the sample keeps as Cline's answer.
  • -t 1500 is Cline's own timeout in seconds. It is set under the SDK's 30-minute limit, so Cline stops first and reports the timeout on stderr as a JSON error line.
  • -c sets the working directory. The task is the last argument and is passed as one array element, untouched by any shell.
  • Auto-approve needs no flag. --auto-approve defaults to true for a CLI prompt. Pass --auto-approve false to have tool calls wait instead.

Cline saves each session under ~/.cline/data/sessions. --id <session-id> resumes one. To come back to a run later, keep its sandbox. Pausing it keeps the checkout and the session data, and compute billing stops.

CLI options for scripts

From Cline's CLI reference, 25 October 2026:

Option Effect
cline "<prompt>" Starts in act mode with auto-approve on
--json Newline-delimited JSON messages
-p, --plan Plan mode
-t, --timeout <seconds> Stops the run after that long; 0 means no limit
-m, --model <id> Model for this run
-P, --provider <id> Provider for this run
-c, --cwd <path> Working directory
--retries <count> Consecutive mistakes allowed before halting
--id <session-id> Resume a saved session

Give the Cline extension Runtime sandboxes

The VS Code extension, and the CLI on your own machine, read MCP servers from ~/.cline/data/settings/cline_mcp_settings.json. In the extension, open the MCP Servers icon, then Configure, then Configure MCP Servers. Add this entry:

JSON{  "mcpServers": {    "runtime": {      "command": "npx",      "args": ["-y", "withruntime", "mcp"],      "disabled": false,      "autoApprove": []    }  }}

From a terminal, cline mcp opens a wizard that writes the same entry. The first Runtime call returns a link and a code. Approve Connect agent in the browser, and the tools appear. No key goes in the settings file (MCP). For the remote server, Cline's Remote Servers tab takes https://api.withruntime.com/mcp as Streamable HTTP.

autoApprove lists tools that Cline may call without asking. Read-only tools, such as runtime_sandboxes_list and runtime_sandboxes_files_read, are safe to add there. Leave runtime_sandboxes_create out if you want to confirm each new machine.

Tool Use from the editor
runtime_sandboxes_create A clean Linux machine for code Cline wrote
runtime_sandboxes_exec Run it and see the real exit code
runtime_sandboxes_previews Open the app it started at a private HTTPS address
runtime_sandboxes_files_read Read logs and results back into the chat

Cost

On Runtime, CPU is billed as used, at $0.025 per vCPU-hour, with a floor of a twentieth of a vCPU. Memory is billed at $0.0075 per reserved GiB-hour. So 2 vCPUs and 4 GiB cost $0.03125 an hour while Cline waits on the model. With both cores busy, they cost $0.08 an hour (pricing). Your provider bills the tokens. A new account gets 100 free hours of a 1 GB machine in its first 30 days. No card is needed:

Terminalnpx withruntime sandboxes run -- node --version

To serve what the agent builds, see preview agent-built apps. Other agents with the same setup are Claude Code and OpenCode.

Sources

Checked 25 October 2026.

Facts on this page were checked on 25 October 2026.

Related.

100 free hoursin your first 30 days.

of a 1 GB machine

  • No credit card
  • Four sandboxes at once, 2 vCPU and 4 GiB each
  • Then prepaid credit from $10, no plan fee
Start free, no card
Start free, no card