12 / 19
Agents in the cloud and in the background, assigning work with @claude on GitHub, automatic PR review and verifying the result.
So far the agent has run on your computer, with you sitting in front of it. But plenty of work can move forward without waiting for you. Starting a bug fix from your phone and reviewing its PR in the evening, or having every PR reviewed automatically, are examples. In this lesson we take the agent off your machine and away from your screen.
| Route | Where it runs | How you start it | The result |
|---|---|---|---|
| A cloud session | On the provider's virtual machine | The browser, the mobile app, the terminal | A branch and a PR |
| An agent in CI | On a GitHub Actions runner | @claude in a PR or an issue, or automatically on every PR | A PR comment or a commit |
| Headless | On your machine or in a script | claude -p "..." | Terminal output or JSON |
A cloud session is an agent session that runs on a virtual machine the provider manages instead of your machine. It keeps working even if you close your laptop, and you can look in on it from any device.1 In Claude Code you start one at claude.ai/code, from the Code tab of the mobile app, or from the terminal:1
claude --cloud "Fix the pagination bug in the product list and run the tests"The virtual machine clones the repository from GitHub, not your local folder. If you have local commits, push them first.1 Every --cloud command opens a separate session, so you can start several jobs at once.1 When the work is done you open a PR, or pull the session with its branch into your terminal with claude --teleport and carry on there.1
The flow the Claude Code docs suggest: work the plan out together locally in plan mode, write it to a file and push it, then hand the implementation to the cloud.1 The SPEC.md from the Spec-driven development lesson is exactly for this.
Having the PR watched: with Auto-fix on, the agent watches the CI failures and review comments on the PR. When the fix is clear it pushes it itself, and when a comment is ambiguous it asks you.1
The equivalent in Cursor is Cloud Agents. You start one from the web, from mobile, from Slack, or by writing @cursor in a PR. The agent works on a separate branch and opens a PR with screenshots.2
Tip
A cloud session draws on your plan's usage limit. Every session you start in parallel consumes the limit proportionally.1
With Claude Code GitHub Actions you put the agent inside your repository. The easiest setup is the /install-github-app command in Claude Code. It installs the GitHub App, adds the key as a repository secret and prepares a PR for the workflow file.3 After that you can assign the agent work in any issue or PR comment:3
@claude fix the TypeError in CartSummary and add a testTo run the agent on every PR by itself, you give the workflow a prompt. In that case the agent does not wait to be mentioned.3 A workflow that reviews every PR automatically:3
# .github/workflows/code-review.yml
name: Code Review
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
plugin_marketplaces: "https://github.com/anthropics/claude-code.git"
plugins: "code-review@claude-code-plugins"
prompt: "/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
claude_args: '--allowedTools "mcp__github_inline_comment__create_inline_comment"'--comment has the findings written to the PR as line comments. Draft PRs are skipped.3 The agent reviews by reading the project's CLAUDE.md. Write your review criteria there.3
The cost has two parts: GitHub Actions minutes and tokens. Limit the number of rounds with --max-turns inside claude_args, and the duration by adding timeout-minutes to the workflow.3
Caution
Never write the API key into the workflow file. Store it as a repository secret and give the workflow only the permissions it needs.3
claude -p runs the agent with a single command, without opening a chat. It becomes part of a script, a pre-commit hook or a CI step:4
claude -p "Fix the lint errors in the changed files" \
--allowedTools "Edit,Bash(pnpm lint *)" \
--permission-mode dontAsk \
--max-turns 20--output-format json gives the result in a form a script can read. --allowedTools pre-approves the listed tools, --permission-mode dontAsk refuses anything else that would have prompted, and --max-turns caps the rounds.4 For a batch job, try three files first, fix the prompt, then run the rest.4
The longer the agent runs unattended, the more the independent check before you call the work done matters.4 Three rules:
Give it a goal that can be checked. Without a check it can run, the agent stops at "this looks done".4 Put the test command in the prompt, or use the Stop hook from the Hooks and permission modes lesson.
Ask for proof. The test output, the command that was run, a screenshot. Reading the proof is faster than verifying everything from scratch.4
Isolate risky work. Simon Willison hands risky work to agents running asynchronously in the cloud instead of in a local terminal.5 There the agent cannot touch your machine or your keys.
Before you walk away, answer these five questions for that specific job:4
| Question | Possible answers |
|---|---|
| Does it know what done looks like? | A spec file, a test it has to turn green, a /goal condition |
| Can it check its own work? | The test suite, a Stop hook, a review step |
| What can it touch? | Permission rules, dontAsk, the sandbox, a worktree |
| What stops it? | --max-turns, --max-budget-usd, a spend limit |
| Where does the result go, and who signs off? | A PR or a comment, and a person who approves the merge |
With /goal, a separate model checks your condition after every turn and the agent keeps going until it's met. That helps on long runs, where an agent can stop at a progress summary with work still open.4
Warning
Issue and PR comments can be written by anyone, and an instruction can be hidden in text the agent reads (see Security and cost). With Auto-fix on, the agent also writes comments on your behalf. Turn Auto-fix off in repositories that have deploy automation triggered by a comment.1
Start a small job with claude --cloud and close the terminal. What is the agent doing when you look in on the session from your phone?
Run /install-github-app in a test repository and write a small request with @claude in an issue. Is the result a comment or a PR?
Turn on the automatic review workflow and send a deliberately broken PR. Does the review find the bug?
Run the same request with claude -p once with --allowedTools and once without. What is the difference?
Official docs: Claude Code "Use Claude Code in the cloud"; the cloud environments, --teleport, Auto-fix and security.1
Official docs: Claude Code "GitHub Actions"; the setup, example workflows and keeping the cost down.3
Article: Simon Willison, "Embracing the parallel coding agent lifestyle"; which work he gives to local and to cloud agents.5
Sources
The cloud session, `--cloud`, `--teleport`, Auto-fix, limits and security.
Agents running in the cloud, the ways to start them and delivery as a PR.
`/install-github-app`, `@claude`, the automatic review workflow, secrets and cost.
Headless mode, `--allowedTools`, `dontAsk`, the five questions before an unattended run, `/goal` and verification.
: — October 5, 2025. Asynchronous cloud agents for risky work.
Check the lesson's main ideas with three questions.
Your progress is stored only in this browser.
Last updated: November 3, 2026