Cloud Agent
Run Copilot agents on GitHub servers — REST API, auto model selection, secrets, and usage metrics
title: "Cloud Agent" description: "Run Copilot agents on GitHub servers — REST API, auto model selection, secrets, and usage metrics" section: "Copilot" readTime: "6 min" badge: "NEW"
Copilot Cloud Agent
The cloud agent runs on GitHub's servers rather than your local machine. It integrates natively with GitHub pull requests, issues, and repositories — and can be triggered programmatically via the REST API.
When to Use the Cloud Agent
| Use case | Why cloud agent |
|---|---|
| Create a PR from a GitHub issue | Native GitHub integration, no local setup needed |
| Run agent tasks while your laptop is closed | Runs on GitHub servers |
| Trigger tasks from CI/CD pipelines | REST API access |
| Assign issues to an agent via the GitHub UI | Cloud-native workflow |
| Collaborate with teammates on an agent session | Shared GitHub context |
For interactive, iterative work use the local agent instead.
Start via REST API
Trigger cloud agent tasks programmatically:
curl -X POST \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
https://api.github.com/repos/{owner}/{repo}/copilot/agent-tasks \
-d '{
"task": "Fix the failing tests in src/api/__tests__/auth.test.ts",
"branch": "fix/auth-tests"
}'This is useful for:
- CI pipelines that auto-triage failing tests
- Scripts that batch-process open issues
- Integrations that kick off agent tasks from external events (webhooks, Slack, etc.)
Auto Model Selection
The cloud agent now selects the best model for your task automatically. You don't need to specify a model — it evaluates task complexity and picks accordingly.
To override and specify a model:
# In the GitHub Copilot app or via the VS Code cloud agent session
# Select a model from the session settings before starting the taskSecrets and Variables
Pass repository secrets and environment variables to cloud agent sessions:
{
"task": "Run the deployment to staging",
"secrets": ["STAGING_API_KEY", "DATABASE_URL"],
"variables": {
"ENVIRONMENT": "staging",
"REGION": "us-east-1"
}
}Secrets are pulled from your repository's secret store — the agent never exposes them in logs or output.
Usage Metrics
Track cloud agent activity via the Copilot usage metrics API:
# Team-level usage metrics
GET /orgs/{org}/team/{team_slug}/copilot/metrics
# Code review comment types
GET /repos/{owner}/{repo}/copilot/metrics/code-reviewAvailable metrics include:
- Token usage by agent type
- Code review comments (categorized by type: suggestion, blocking, informational)
- Sessions started, completed, and abandoned
- Per-team breakdowns
Agent Merge
After the cloud agent opens a PR, Agent Merge can take over:
- Monitors review comments on the PR
- Addresses reviewer feedback automatically
- Fixes failing CI checks
- Merges once your defined conditions are met (approvals, checks passing)
Configure conditions in the GitHub Copilot app or in the agent session settings.
Start from the GitHub UI
Assign a GitHub issue directly to Copilot:
- Open any issue in your repository
- In the Assignees panel, select Copilot
- The cloud agent reads the issue, creates a branch, implements the fix, and opens a PR
The PR links back to the original issue and includes a summary of what was done.
Related
- Agents — All agent types including local and Copilot CLI
- Copilot App — Desktop app built around cloud agent sessions
- Customization — Custom agents and instructions for cloud sessions