Dev tools
Background Agents: AI Coding Tools That Open PRs
Background agents are AI coding agents that run in the cloud and open pull requests. How they work, the main tools compared, setup, costs and safe review.
Background agents are AI coding agents that work on a task by themselves in a cloud environment while you do something else, then hand back the result, usually as a branch or pull request. Instead of an assistant answering in your editor while you watch, you give the agent a task such as "fix this bug" or "add tests for this module", it clones your repository into an isolated machine, writes and runs code, and reports back when it's done. The main tools are Cursor's Cloud Agents (previously called background agents), GitHub Copilot's cloud agent, OpenAI Codex cloud tasks, Claude Code on the web and Google's Jules. They're best for well-defined tasks with clear success checks, and they still need a human to review every change before it's merged.
This guide explains how background agents work, compares the main tools, shows how to set one up, and covers the costs, security settings and review habits that make them useful rather than risky.
What Are Background Agents?
A background agent is an AI coding agent that runs asynchronously: you hand it a task and don't need to stay in the loop while it works. Three things separate it from an assistant in your editor:
- It runs somewhere else, usually a cloud virtual machine or container with a copy of your repository, not on your laptop.
- It works for longer, often several minutes to much longer, reading code, running commands and tests, and iterating until it reaches a result.
- It delivers a reviewable result, typically a branch, a pull request, a diff or a summary, rather than live edits in your open files.
Because each agent has its own environment, you can run several at once on different tasks, which is the main appeal: one developer can supervise multiple parallel streams of work. The vendors increasingly call them cloud agents, since the defining feature is that they run in the cloud.
How Background Agents Work
The workflow is similar across tools:
- You start a task from the editor, a web dashboard, a chat app such as Slack, an issue tracker, a pull request comment or the command line.
- The platform creates an isolated environment, clones your repository, and installs dependencies using a setup script or configuration file you provide.
- The agent plans and works: it reads the code, edits files, runs tests, linters and builds, and fixes what fails.
- It reports back with a summary, logs and the changes, often as a pull request. Some tools attach screenshots or videos of the agent testing a web app.
- You review, request changes in comments or a follow-up prompt, and merge or discard.
Background Agent Tools Compared
| Tool | Where it runs | How you start tasks | What you get back |
|---|---|---|---|
| Cursor Cloud Agents | An isolated virtual machine per agent | Cursor editor (Cloud mode), cursor.com/agents, or by mentioning @Cursor in Slack, GitHub or Linear; also from automations | Pull requests, with videos, screenshots and logs of the agent's work |
| GitHub Copilot cloud agent | A GitHub-managed cloud sandbox, a GitHub Actions runner or a custom environment | Assign an issue to Copilot, the agents panel on GitHub, editor or command line | A branch and pull request for review |
| OpenAI Codex (cloud) | OpenAI's cloud environments, with your repository | Codex web app, IDE extension, command line or mobile; keeps running when your computer sleeps | A diff you can review and open as a pull request |
| Claude Code on the web | Anthropic-managed cloud sessions | claude.ai/code, the Claude mobile and desktop apps, or the Claude Code command line | Branch and pull request; can also watch and fix pull request issues |
| Google Jules | Google cloud virtual machines | Jules web app, connected to GitHub | A plan for approval, then a pull request |
Features, names and plan limits change often in this category; check each vendor's documentation before relying on a specific feature. GitHub, for example, has announced a further evolution of its agent called Copilot in the cloud for paid plans.
Cursor Background Agent (Cloud Agents)
The Cursor background agent was renamed Cloud Agents. Each agent runs on its own virtual machine with a copy of your repository, can run your app and tests, and opens a pull request when it's done, attaching videos, screenshots and logs so you can see what it tested. You can start agents from the Cursor editor by choosing the cloud option, from the web at cursor.com/agents, or by mentioning @Cursor in Slack, GitHub or Linear. Cursor also lets automations start cloud agents on a schedule or in response to events.
Background Agents in Claude Code
Claude Code background agents come in two forms:
- Cloud sessions: Claude Code on the web runs tasks in Anthropic-managed cloud environments. You can start them from claude.ai/code, the mobile and desktop apps, or the command line, then move a session between cloud and local when you want to continue on your own machine. Cloud sessions can open pull requests and can be set to watch a pull request and fix failing checks or review comments. They're available on paid Claude plans.
- Local background work: in the Claude Code command line, you can run long commands and subagents in the background while you keep working, and run several sessions in separate git worktrees so they don't edit the same files.
OpenAI Codex Cloud Tasks
OpenAI's Codex runs both locally and in the cloud. Cloud tasks run in OpenAI's environments, so they continue while your computer is closed, and you can review the diff and open a pull request when the task finishes. You can delegate to the cloud from the Codex app, the IDE extension or the command line. Our guide to how to use OpenAI Codex walks through setup.
What Background Agents Are Good At
Background agents work best on tasks that are clear, self-contained and easy to check:
- Bug fixes with a reproduction, such as a failing test or a clear error message.
- Adding or improving tests for existing code.
- Small features with a clear spec, especially following an existing pattern in the codebase.
- Refactors and migrations that are repetitive, such as renaming an API across files or upgrading a dependency.
- Documentation updates and code comments.
- Fixing lint errors and failing CI checks.
- Investigation tasks: "find where this value is calculated and explain it" can be faster delegated than done.
They're weaker at tasks with vague requirements, big architectural decisions, work that needs access to systems they can't reach, and anything where judging "done" requires deep product context.
How to Set Up a Background Agent
- Connect your repository: usually by installing the vendor's GitHub app and choosing which repositories the agent can access.
- Configure the environment: provide a setup script or configuration file that installs dependencies and tools, so the agent can build and test. Without this, agents often fail or skip testing.
- Add instructions for the agent: most tools read a repository instructions file such as AGENTS.md, CLAUDE.md or tool-specific rules, describing how to build, test and follow your conventions.
- Decide on secrets and network access: give agents only the secrets and internet access they need; many tools let you restrict outbound network access.
- Write a good task: describe the goal, the relevant files, how to verify success ("all tests in this folder pass"), and what not to touch.
- Start small: begin with low-risk tasks, review the results closely and expand once you trust the setup.
Writing a Good Task for a Background Agent
The quality of the result depends heavily on the task description. A weak task says "fix the login bug". A strong task gives the agent what a new teammate would need:
Users with an apostrophe in their email address can't log in. The error appears in the login handler when the address is validated. Fix the validation so these addresses are accepted, add tests covering addresses with apostrophes and plus signs, and make sure the full authentication test suite passes. Don't change the password-reset flow.
That task states the problem, points to where to look, defines success with tests, and sets a boundary. Agents given tasks like this need far fewer rounds of correction.
Reviewing Background Agent Pull Requests
A background agent can produce a lot of code quickly, which moves the bottleneck to review. Good habits:
- Treat agent pull requests like a new contributor's: read the diff, don't just check that tests pass.
- Check that tests are meaningful, not changed to pass or written to test nothing.
- Look for scope creep: agents sometimes change unrelated files.
- Run CI and code review tools on every pull request. AI review tools can help, but they don't replace a human reviewer; our guide to AI code review covers how to combine them.
- Keep pull requests small by giving agents small tasks.
- Iterate in comments or follow-up prompts instead of fixing everything yourself.
Costs and Limits
Background agents use more compute than chat because they work longer and run tools. Pricing models vary:
- Included usage on paid plans, with limits on tasks or sessions.
- Usage-based billing for the AI models the agent uses, often at API rates.
- Compute charges for the cloud environment in some tools, such as GitHub Actions minutes when the agent uses Actions runners.
Running many agents in parallel can use up limits quickly. Track usage, set spending limits where the tool supports them, and cancel tasks that go off track rather than letting them run.
Security Considerations
An AI coding agent with repository access and the ability to run code needs the same care as any automation with write access:
- Least privilege: give access only to the repositories and secrets each agent needs.
- Limit network access to what the build needs, to reduce the risk of data being sent elsewhere.
- Watch for prompt injection: instructions hidden in issues, web pages or dependencies can try to steer the agent. Restricted network access and review reduce the risk.
- Protect your main branch: require pull request review and passing checks before merging; agents should never push directly to production branches.
- Audit logs: use the tool's logs to see what each agent did.
Background Agents vs Local Agents
| Background (cloud) agents | Local agents in your editor or terminal | |
|---|---|---|
| Where code runs | Vendor's cloud environment | Your machine |
| Your attention | Not needed while it works | Usually watching and approving steps |
| Parallel work | Easy; many agents at once | Limited by your machine and focus |
| Access to local tools and data | Only what you configure | Everything on your machine |
| Best for | Well-defined tasks you can review later | Exploratory and interactive work |
Many developers use both: local agents for interactive work, background agents for tasks they can hand off.
Common Mistakes
- Skipping environment setup, so the agent can't run tests.
- Vague tasks without a clear definition of done.
- Merging without review because tests pass.
- Giving broad secrets and network access by default.
- Running too many agents and creating more pull requests than the team can review.
FAQ
What is a background agent?
A background agent is an AI coding agent that works on a task by itself in a cloud environment while you do other things, then returns its changes, usually as a branch or pull request for you to review.
What happened to Cursor background agents?
Cursor renamed them Cloud Agents. They still run in isolated virtual machines and open pull requests, and you can start them from the editor, the web, or tools such as Slack, GitHub and Linear.
Does Claude Code have background agents?
Yes. Claude Code on the web runs cloud sessions that work on tasks and open pull requests, and the Claude Code command line can run tasks and subagents in the background locally.
Are background agents safe?
They can be used safely with least-privilege access, restricted network access, protected branches and human review of every pull request. Never let an agent merge or deploy to production without review.
What tasks should I give a background agent?
Well-defined tasks that are easy to check, such as bug fixes with a failing test, adding tests, small features following existing patterns, dependency upgrades, documentation and fixing CI failures.