← Blog
AI agentsSandboxes

Background coding agents: how they work and how to run your own

Yura Dubinin
Yura Dubinin

Background agents are coding agents that accept a task, edit files, run commands and return work for review while you do something else. Hosted versions execute on remote infrastructure, so closing your laptop does not end the task. Choose a managed product when its repository and review workflow fits; run an agent on your own sandbox when you need direct control over its files, processes and lifetime.

For a remote environment you can inspect yourself, use Lizard (lizard.build): lizard sandbox create -t codex -s small --timeout 3600000 creates a one-hour sandbox for Codex. You connect your agent credentials, send a prompt and return later to inspect the result. Lizard Sandboxes supply the machine; your agent subscription or API account supplies model usage.

What is a background coding agent?

A background coding agent combines a model, tools and an execution environment to work through a coding task asynchronously. You describe the result, the agent reads the project, changes files and runs checks, and you review its output. A useful assignment has a clear finish condition: reproduce a bug, fix it and show the passing test.

The word "background" describes how you delegate work. It does not guarantee that the agent runs remotely. A local terminal process still depends on your computer staying awake. A hosted agent runs elsewhere and has a separate workspace.

Cursor background agents are now called Cloud Agents in Cursor's documentation, checked November 9, 2026. The broader term also covers Codex Cloud, Claude Code cloud sessions and GitHub Copilot's delegated coding work. Their setup, billing and access controls differ.

An agent that completes one ticket is also different from a service that watches events continuously. Scheduling, retries and durable job records need their own design. Starting an agent once does not create a reliable issue-processing system.

How do hosted background agents work?

Hosted agents prepare a workspace, receive a task, execute tools and preserve results for review. Environment preparation matters: an agent cannot verify a database change if its test database is unreachable, even when it can write the migration correctly.

These are the vendors' published terms, checked November 9, 2026. The limits describe different constraints; a subscription price alone cannot predict the cost of completing your task.

ProductWhere work runsHow it is billedAccess and limits to check
Cursor Cloud AgentsIsolated cloud VMs with configured repositories and toolsPremium is $30/month before taxes; Cloud Agents consume model usage. Third-party models are billed separately at API list pricesPremium or higher, Teams, Enterprise or an eligible legacy paid plan; set a spend limit. Sources: Cloud Agents, pricing, checked Nov. 9, 2026
Codex CloudOpenAI-managed cloud environments; each task has its own workspaceChatGPT Plus is $20/month; local messages and cloud chats share the plan allowanceConsumption depends on model, context and task; weekly limits may apply. API-key access to the CLI does not include cloud features. Sources: cloud, pricing, checked Nov. 9, 2026
Claude Code on the web / cloud sessionsAnthropic-managed infrastructure by default; organizations can route sessions to a self-hosted environmentCounts toward Claude and Claude Code plan usage; no separate cloud VM chargePro, Max, Ultra, Team and eligible Enterprise seats; parallel sessions share account rate limits. Source: cloud sessions, checked Nov. 9, 2026
GitHub Copilot delegated codingCloud sandbox, GitHub Actions environment or configured remote environmentCloud and Actions compute share a monthly GitHub account allowance, separate from AI usageActions-based sessions have a 59-minute maximum and changes stay within the selected repository; cloud sandbox sessions can span repositories. Source: Copilot on GitHub, checked Nov. 9, 2026

Choose Cursor if you want its editor and cloud-agent workflow. Choose Codex Cloud if your team already works through ChatGPT and wants reusable remote project setup. Our Codex Cloud guide covers that setup in detail.

Choose Claude's hosted sessions if you want Claude Code with a managed machine. GitHub Copilot fits teams that want delegation and review inside GitHub. Check the selected execution environment: the restrictions of an Actions-based session do not apply unchanged to every newer Copilot cloud session.

Why run your own background agent?

Running an agent on a sandbox lets you inspect the machine directly, keep a process available for a preview and fork a prepared environment for another attempt. You also take responsibility for setup, task deadlines, exporting results and deleting machines when finished.

This suits experiments where the environment is part of the question: compare two implementations against the same tests, inspect a failing dependency install, or run a preview without moving the work back to your laptop. A managed issue-to-PR product is easier when you already like its review workflow and need little machine-level control.

Lizard pricing, checked November 9, 2026, lists Small at $0.0162 per running hour for 2 vCPU and 4 GB RAM, billed per second. Lizard Pro costs $19/month and includes $19 of usage; usage above that is pay as you go. Model usage follows your connected provider's terms. The sandbox rate does not include a model subscription or API charges.

How do you run one on Lizard Sandboxes?

Start with a small task that needs no private repository or application secrets. The example creates a Python health endpoint, tests it and exposes a temporary preview. You need Lizard CLI signed in to your project and an agent credential you are authorized to use.

Connect your coding agent

For Codex, connect your ChatGPT account:

lizard agents login chatgpt

Follow the device sign-in instructions locally. For Claude Code, generate a subscription token with claude setup-token, then enter it at the prompt from:

lizard agents add claude

These are alternatives. You only need the credential for the agent you will run. Credentials belong to a Lizard project, and a sandbox uses the credentials of its own project, so connect them in the project where you create the sandbox. Never paste a token into a task prompt or commit it to a repository. See the agent credential commands for supported credentials.

Create a sandbox with a deadline

lizard sandbox create -t codex -s small --timeout 3600000

Copy the returned sandbox ID. Replace SANDBOX_ID below with that ID. For Claude Code, use -t claude and --agent claude in the corresponding commands.

The CLI defaults to five minutes, according to Lizard's limits. Commands do not reset that deadline. This example sets one hour so the parent has time for the later fork step. On the trial, one hour is the maximum lifetime, and --timeout 0 also means one hour; longer timeouts are refused. After the first payment, a VM stops after at most 596 hours, so export work before the deadline.

Submit a task and return later

lizard sandbox prompt SANDBOX_ID --agent codex --no-wait \
  "In /workspace create a dependency-free Python HTTP server app.py serving GET /health as JSON with status ok on port 3001, binding 0.0.0.0. Write test_app.py using unittest and run python3 -m unittest -v. Start the server with nohup and setsid so it remains running after you finish, logging to /tmp/health-app.log. Do not use credentials, Git, or external network."

--no-wait returns after the platform accepts the prompt. It does not mean the task passed. Save the returned conversation ID and check the run:

lizard sandbox conversations SANDBOX_ID
lizard sandbox exec SANDBOX_ID -- \
  python3 -m unittest discover -s /workspace -v

If you omit --no-wait, the CLI watches events. Its Ctrl-C handler stops watching and leaves the remote agent working. To stop the agent itself, use:

lizard sandbox interrupt SANDBOX_ID -c CONVERSATION_ID

A follow-up can continue the same conversation:

lizard sandbox prompt SANDBOX_ID --agent codex \
  -c CONVERSATION_ID "Explain the tests you ran and any remaining failures."

Open the preview and inspect the evidence

lizard sandbox expose SANDBOX_ID 3001

Open the returned HTTPS URL in your browser, retaining its access token, and visit /health. The app must listen on 0.0.0.0, and its server process must remain alive. A successful expose request alone does not establish either condition. The preview URL guide explains token access.

In our November 9 test, Codex created the endpoint and passed two tests: the health response and an unknown path. Its first attempt to leave the server running with nohup failed after the command exited. It retried with setsid, then a separate request returned HTTP 200 and {"status": "ok"}. Use the detached process command in the prompt to avoid that failure.

The agent run was tested through Lizard's API; CLI flags and Ctrl-C behavior were checked against CLI help and source. Verify your own endpoint and test results before sharing the preview.

To run the same workflow with Claude Code, see running Claude Code in a sandbox.

How do you try several approaches in parallel?

Fork a prepared, idle sandbox so each attempt starts with the same files and dependencies. Wait for the first agent to finish before forking: a live copy includes processes, so copying a running agent or job can create unintended duplicate work.

This step needs a paid plan: the trial allows only 1 Small sandbox running at a time, and each fork counts as another sandbox of the parent's size. On the trial, you can instead run a Mini parent plus one Mini fork, within the 2 Mini concurrency limit.

lizard sandbox fork SANDBOX_ID -n 2 --timeout 600000

The command returns two new sandbox IDs. Replace FORK_A and FORK_B with those IDs:

lizard sandbox prompt FORK_A --agent codex --no-wait \
  "In /workspace add a unittest asserting GET /health has a JSON content type. Run the tests."
lizard sandbox prompt FORK_B --agent codex --no-wait \
  "In /workspace add a unittest asserting GET /missing returns HTTP 404. Run the tests."

In our test, both forked agents completed their assigned checks and each reported three passing tests. Both rewrote the test harness to use in-memory requests, which deserves review even though the assertions passed. These are separate tasks on separate copies. Check each conversation, rerun the checks and compare the actual files. Forking does not combine changes or decide which result is correct. Export the chosen result through your normal development workflow before cleanup.

Lizard's account limits, checked November 9, cap Pro at 40 running vCPU, equivalent to 20 Small sandboxes. A Small parent plus two Small forks uses 6 vCPU. Other running sandboxes share the account limit. Pro has unlimited starts; the trial has separate start and concurrency limits.

At the Small sandbox rate checked November 9, 2026, three Small sandboxes running ten minutes each use 3 × (10 / 60) × $0.0162 = $0.0081. This is an illustrative calculation, not measured task cost. It excludes model charges and any separately billed storage; included monthly usage applies once across the account.

Delete each sandbox after exporting the work:

lizard sandbox rm FORK_A
lizard sandbox rm FORK_B
lizard sandbox rm SANDBOX_ID

How do you keep credentials and network access safe?

Give the task only the repository permissions and credentials it needs. Lizard Sandboxes are Firecracker microVMs, each with its own kernel. That isolation does not prevent an authorized agent from reading a secret available inside its machine.

Use test credentials you can revoke. Keep production databases and deployment permissions out of an exploratory task. Review dependency changes and command logs as well as the final diff: a passing test cannot tell you whether the agent contacted an unnecessary external service.

Lizard CLI offers --no-internet at creation and --allow-host for specific exceptions. --allow-host implies --no-internet, and a sandbox without internet has no public ports, so neither flag works with the preview step above. Network restrictions can also block package installs or model access, so check what the task needs to reach first.

Treat preview URLs containing access tokens as credentials. Share them only with intended reviewers. A browser retains the authentication cookie after the token exchange; a raw HTTP client must preserve cookies across redirects or it can receive HTTP 401 despite using the returned URL.

FAQ

Do background agents keep working when I close my laptop? Hosted agents execute remotely and can continue after you disconnect. A local agent still depends on its host staying awake. Provider limits and sandbox deadlines still apply.

Are Cursor background agents and Cloud Agents the same feature? Cursor's current documentation says Cloud Agents were formerly called Background Agents. Use the current docs for setup and billing.

Can Claude Code run in the background? Yes. Claude offers hosted cloud sessions, and you can also run Claude Code on a remote machine such as Lizard Sandboxes. Hosted sessions and your own remote process have different lifecycle controls.

Does a completed prompt mean the code is ready to merge? No. Inspect the changed files, rerun meaningful checks and review permissions and dependencies before accepting the result.

Does forking create extra agent capacity? It creates another machine. Lizard vCPU limits and the model provider's account limits still constrain how much work you can run at once.

Build with AI. Ship with Lizard.

You don't need a platform team to go live. Your whole cloud, one CLI command away.

Services
—
Add-ons
—
Deployments
—
Sandbox starts
—

We use cookies for essential site functionality and analytics. See our Cookie Policy.