NEW: Claude Code Security — research preview

Cloud Agent

Run Copilot agents on GitHub servers — REST API, auto model selection, secrets, and usage metrics

NEWRead time: 6 min

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 caseWhy cloud agent
Create a PR from a GitHub issueNative GitHub integration, no local setup needed
Run agent tasks while your laptop is closedRuns on GitHub servers
Trigger tasks from CI/CD pipelinesREST API access
Assign issues to an agent via the GitHub UICloud-native workflow
Collaborate with teammates on an agent sessionShared 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 task

Secrets 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-review

Available 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:

  1. Monitors review comments on the PR
  2. Addresses reviewer feedback automatically
  3. Fixes failing CI checks
  4. 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:

  1. Open any issue in your repository
  2. In the Assignees panel, select Copilot
  3. 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.


  • 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