What are background agents?
On this page
Background agents are AI coding agents that take a task, work on it in a cloud environment while the developer does something else, and hand back a branch or a pull request. No person watches each step. Before you turn them on, decide which repositories and secrets they can reach, what network access they get, who reviews their pull requests and who owns what each run costs.
Key takeaways
- Background agents run coding tasks in a cloud copy of your repository and return a branch or pull request.
- A local coding agent waits for you on your laptop. A background agent keeps working after you close it.
- Keep secrets out of the agent's reach where the tool allows it, and have someone other than the requester review the pull request.
- Each run uses paid model capacity, so give background agent spend an owner.
Background agents work on a copy of your repository in the cloud
The pattern looks the same across coding tools. A developer describes a task, and the tool starts a cloud machine, clones the repository and lets the agent edit files, run tests and iterate. When the agent finishes, it pushes a branch or opens a pull request.
GitHub's documentation describes its agent researching a repository, planning changes and implementing them in the background, running tests and linters in a cloud development environment. Claude Code calls the same idea a cloud session, and its docs say the session keeps running after you close your laptop.
Typical jobs are well scoped and easy to check: fixing a reported bug, adding missing tests, updating a dependency or replacing a deprecated call across many files. Each one ends in a pull request a person can read.
Background agents and local agents differ in who is watching
A local coding agent and a background agent can run the same model. What changes is where the work happens and who sees it.
| Local coding agent | Background agent | |
|---|---|---|
| Where it runs | On the developer's laptop | On a cloud machine |
| Who sees each step | The developer, who answers prompts as they come | Nobody until the result arrives |
| What it can reach | The developer's files, credentials and network | What the cloud environment gives it |
| What it hands back | Changes in the working copy | A branch or pull request |
Developers like background agents because they can start several tasks at once and review the results later. That distance is also why the settings for access and review matter: the developer is in a meeting while the agent runs commands.
Access decides how much one bad run can break
A background agent gets roughly what a developer gets: a cloned repository, installed dependencies, environment variables and network access. Each of those needs a deliberate setting.
Start with secrets. You can revert a bad commit in a minute, but a leaked production key has to be rotated in every system that used it. Some tools keep credentials outside the agent's machine: Claude Code's docs say git credentials stay outside the sandbox and a proxy authenticates with scoped credentials. Other setups inject secrets straight into the agent's environment, where the agent can read them.
Then look at the network. Claude Code limits network access by default in its hosted environment, and admins can disable it. An agent with open internet access can fetch instructions from anywhere, including a page written to mislead it.
The pull request review is the approval step
A background agent's work reaches production through a pull request, so the review is where a person checks what the agent did.
Figure 1 as text
- The background run, unwatched on a cloud machine: a task is described (a bug, a test or a dependency update), the agent edits and tests on a copy of the repository, then it opens a pull request.
- The review before merge, where a person approves the work: branch rules keep agent branches out of auto-merge, a second reviewer who did not ask for the task reads the change, then the change is merged or sent back, and the decision stays with the pull request.
- Keep production secrets off the cloud machine. Then the worst a bad run can produce is a bad pull request, and the review catches it.
Picture a developer who asks a background agent to fix a flaky test. The agent makes the test pass by loosening the assertion. The developer approves the pull request between meetings, because it is their own task and the checks are green, and the bug that test was catching ships the same afternoon.
Branch rules close that gap. GitHub notes that a ruleset or branch protection rule can stop its agent from creating or updating pull requests. Require a reviewer other than the developer who started the task, and keep agent branches out of auto-merge.
Cost and records need an owner
Background runs use paid model capacity. Claude Code's docs say cloud sessions count toward your plan's usage limits and that parallel tasks use limits faster, so ten agents running overnight use roughly ten times the capacity of one. Judge that spend by the pull requests it produced, because counting volume alone leads to tokenmaxxing.
You also need a record of each run. After an incident, someone will ask what prompt started the change and what the agent ran.
Moring AI's Claude Code governance keeps that record for Claude Code, capturing every session along with secret blocking and customer data masking. Its local AI governance puts a team and a name against each person's AI spend.
Give a background agent the access you would give a new contractor, and review its pull requests with the same care.
Frequently asked questions
What are background agents?
Background agents are AI coding agents that take a task, work on it in a cloud environment while the developer does other work, and return a branch or a pull request. Background agents clone the repository, edit files, run tests and iterate without a person watching each step. The pull request is where a person reviews the result before it reaches production.
Are background agents the same as cloud agents?
Background agents and cloud agents describe the same pattern: an AI coding agent that runs a task on a remote machine and hands back a branch or pull request. GitHub describes its agent working in the background in a cloud development environment, and Claude Code calls the same idea a cloud session. The governance questions are the same under either name.
What is the difference between a background agent and a local coding agent?
A local coding agent runs on the developer's laptop and waits for the developer to approve each risky step. A background agent runs on a cloud machine, keeps working after the developer closes the laptop and returns a branch or pull request. A background agent therefore needs its access set in advance, because nobody approves its steps as they happen.
What access should a background agent have?
A background agent should get one repository, the dependencies its task needs and no production secrets. Where the tool supports it, keep credentials outside the agent's environment and let a proxy authenticate with scoped access, as Claude Code does for git. Limit network access to the domains the task needs, so a background agent cannot fetch instructions from arbitrary pages.
Who should review a background agent's pull request?
A background agent's pull request should be reviewed by someone other than the developer who started the task. The requester wants the task finished and tends to approve green checks quickly. A second reviewer, plus branch rules that keep agent branches out of auto-merge, turns the pull request review into a real approval step.
How do background agents affect AI costs?
Each background agent run uses paid model capacity, and developers often run several in parallel. Claude Code's documentation says cloud sessions count toward plan usage limits and that parallel tasks use limits faster. Give each team's background agent spend an owner, and judge it by the pull requests it produced instead of the volume of runs.
How does Moring AI help govern coding agents?
Moring AI governs coding agents on Claude Code through its Claude Code governance product. Claude Code governance checks each prompt against your AI usage policy, blocks secrets and masks customer data before a prompt leaves, and records every Claude Code session. That record shows how each change was made when someone reviews it later.
Related reading
Sources
- GitHub Docs, "GitHub Copilot on GitHub.com and GitHub Mobile", accessed 1 December 2026
- Claude Code Docs, "Use Claude Code in the cloud", accessed 1 December 2026