GitHub Copilot reference

For first-time setup, see Using GitHub Copilot. Shared options are in AI engines.

Copilot is the default engine. Grant copilot-requests: write for organization-billed inference, or supply COPILOT_GITHUB_TOKEN. External providers use BYOK configuration.

The default CLI pin is 1.0.115, embedded with its reviewed checksum-manifest digest. Installation prefers that version from the trusted runner toolcache. On a cache miss, it downloads and verifies the pinned release rather than consulting the live compatibility matrix. engine.version overrides the default. CLI-only execution is the default; engine.copilot-sdk: true or engine.driver selects SDK mode.

With the built-in installer and @microsoft/copilot-sdk 2.0.0, the default CLI is 1.0.113, the SDK’s companion release for protocol v4, verified against a pinned checksum manifest. An explicit engine.version still wins, so pin a compatible CLI when you choose a different SDK version.

Without a model, engine.model, or engine.model-routing, a Copilot workflow on GitHub Copilot inference uses model routing with goal: cost and mode: auto for its main agent, instead of the auto model. A nonempty GH_AW_MODEL_AGENT_COPILOT or GH_AW_DEFAULT_MODEL_COPILOT variable bypasses routing at run time, with the agent variable winning. Set top-level model-routing: false to opt out without pinning a model. BYOK providers aren’t routed by default.

Copilot supports engine.agent, custom harnesses, max-continuations, bare mode, and per-command bash allowlists. Both CLI and SDK always run in offline BYOK mode, where native web tools are unavailable. tools.web-fetch enables the built-in MCP fallback inside AWF; tools.web-search remains unsupported.

Sandboxed CLI sessions derive URL approvals from finalized AWF network rules, including network_allowed additions. Domain rules cover apex/subdomains and HTTP/HTTPS unless restricted by protocol/port. These approvals do not grant shell access or bypass the firewall.

Copilot resolves model aliases before launch. Exact IDs pass through unchanged; unavailable IDs fail the first inference request.

Copilot dynamic workflows are experimental and disabled by default. Current CLI releases require both settings:

engine:
id: copilot
dynamic-workflows: true
args: ["--experimental"]

gh-aw enables EXTENSIONS, loads project extensions, and pre-approves workflow runs. SDK sessions honor the same switch. Store definitions in .github/extensions/<name>/extension.mjs and request the registered workflow by name in the prompt. Their agents retain workflow tool/sandbox restrictions. Availability also depends on the Copilot account; enabling extensions does not make them available with BYOK.

The trusted activation snapshot recursively restores .github/ after agent checkouts, even with PR checkout disabled, so PR-head extensions, settings, and hooks cannot replace trusted definitions. Use ambient-folders for support files elsewhere. Without dynamic workflows, project extensions are not loaded and runs are denied; .github/ is restored only when PR checkout requires it.

See the dynamic workflow example.

To download a Copilot CLI version not covered by the setup action’s built-in pins, provide engine.checksums-sha256 alongside engine.version:

engine:
id: copilot
version: "1.0.101"
checksums-sha256: "018625eac68670d66ede904b9b82cdcd6ab8f87ba20e6e1fbdf0b62c8295d5be"

The example uses the manifest digest for v1.0.101; change both fields together for another release. The digest authenticates SHA256SUMS.txt, not an individual archive. It must be a literal 64-character lowercase hex string obtained through an independently trusted channel. A checksum fetched from the same potentially intercepted origin as the executable is not independent authentication.

An explicit pin overrides the built-in manifest pin and bypasses the runner toolcache. The host archive and any requested musl guest archive are verified against the authenticated manifest. The field works only with the built-in Copilot CLI installer, not other engines or inline engine definitions, and not with command, which replaces that installer.

The engine’s version and pin are inherited by detection and eval jobs that reuse that engine. A separate safe-outputs.threat-detection.engine override accepts its own version and checksums-sha256. For AWF, use sandbox.agent.checksums-sha256.

The compiler supplies the reviewed digest automatically when engine.version is omitted or matches the CLI-only default. Installs using the CLI-only default digest pass --prefer-toolcache: the pin authenticates downloaded archives, not the cached host binary. A musl guest archive is still downloaded and verified when the host uses cache. The automatic SDK companion pin and user-supplied frontmatter pins bypass the toolcache.

Compilation fails if the compiler’s default version or digest is missing or malformed. Other versions without an explicit pin retain the trusted toolcache policy and setup action’s built-in release pins; an unreviewed download still fails closed. A frontmatter pin requires a literal semantic release version such as "1.0.101" or "v1.0.101"; it cannot be combined with latest, an omitted version, or a version expression.

For maintainers, pkg/constants/version_constants.go stores DefaultCopilotVersion and DefaultCopilotChecksumsSHA256 together. Run make update-copilot-version COPILOT_VERSION=VERSION to update both from the reviewed pin table and sync the installer and compatibility metadata. New releases must first be authenticated and added with scripts/update-release-pins.sh; the resolver refuses releases without a reviewed pin.

Use agent to reference a custom agent file in .github/agents/ (omit the .agent.md extension):

engine:
id: copilot
agent: technical-doc-writer # .github/agents/technical-doc-writer.agent.md

See Copilot Agent Files for details.

The Copilot engine can route requests to an external LLM provider instead of GitHub’s default routing (for example OpenAI, Anthropic, Azure OpenAI, or a local Ollama or vLLM instance), while still using the Copilot CLI tooling.

Set COPILOT_PROVIDER_BASE_URL in engine.env to activate BYOK mode.

  • Credentials: COPILOT_PROVIDER_BASE_URL, COPILOT_PROVIDER_API_KEY, and COPILOT_PROVIDER_BEARER_TOKEN may use ${{ secrets.* }} references under strict mode. Other COPILOT_PROVIDER_* variables are non-sensitive and can be plain strings.
  • Network: A literal COPILOT_PROVIDER_BASE_URL is added to the AWF allow-list automatically for the agent run and the threat-detection step. Threat detection also uses it as its API target, even when engine.api-target and GITHUB_COPILOT_BASE_URL are unset. A ${{ secrets.* }} or ${{ vars.* }} value is resolved by AWF at runtime, which allows exactly that provider host for both runs. Do not add broad entries such as openai.azure.com to network.allowed. A network.allowed entry alone does not bypass this check.
  • AWF version: Runtime resolution requires AWF v0.25.41 or later, the default. With an older pinned sandbox.agent.version, compilation fails in all modes because the host cannot be verified. To fix this, remove sandbox.agent.version and sandbox.agent.checksums-sha256 to use the bundled default, upgrade to a supported version with a matching trusted checksum, or use a literal provider URL.

BYOK does not automatically bypass model-alias resolution. For providers without a /models route, set engine.model-catalog: false to pass the configured model name through verbatim; see Model aliases.

VariableRequiredDescription
COPILOT_PROVIDER_BASE_URL✓ for BYOKBase URL of the external provider (e.g. https://api.openai.com/v1 or https://RESOURCE.openai.azure.com/openai/v1 for Azure Foundry OpenAI)
COPILOT_MODEL✓ for BYOKModel to use (e.g. claude-sonnet-4, gpt-4o); required by most providers
COPILOT_PROVIDER_API_KEYOptionalAPI key for cloud providers (OpenAI, Anthropic, etc.); not needed for local providers
COPILOT_PROVIDER_BEARER_TOKENOptionalBearer-token alternative to COPILOT_PROVIDER_API_KEY; takes precedence when set
COPILOT_PROVIDER_TYPEOptionalProvider format: openai (default), azure, or anthropic
COPILOT_PROVIDER_WIRE_APIOptionalWire API variant: completions (default) or responses (for GPT-5 series)
COPILOT_PROVIDER_MODEL_IDOptionalWell-known model ID for agent configuration and token limits; defaults to COPILOT_MODEL
COPILOT_PROVIDER_WIRE_MODELOptionalModel name sent to the provider (e.g. an Azure deployment name or gateway alias); defaults to COPILOT_MODEL
COPILOT_PROVIDER_MAX_PROMPT_TOKENSOptionalOverride the maximum prompt token limit (otherwise resolved from model catalog)
COPILOT_PROVIDER_MAX_OUTPUT_TOKENSOptionalOverride the maximum output token limit

Example:

engine:
id: copilot
env:
COPILOT_PROVIDER_BASE_URL: ${{ secrets.PROVIDER_BASE_URL }} # REQUIRED — activates BYOK
COPILOT_MODEL: claude-sonnet-4 # REQUIRED for most providers
COPILOT_PROVIDER_API_KEY: ${{ secrets.PROVIDER_API_KEY }} # OPTIONAL for local providers
COPILOT_PROVIDER_TYPE: anthropic # OPTIONAL — default: openai
network:
allowed:
- defaults

Use the resource’s /openai/v1 endpoint with API-key or GitHub OIDC authentication. Keep engine.model on the advertised model ID and set COPILOT_PROVIDER_WIRE_MODEL when the deployment name differs. See Azure OpenAI BYOK for complete configurations, Responses API selection, and troubleshooting.

Set engine.copilot-sdk: true to run a local Copilot sidecar and SDK driver instead of the default CLI-only flow.

For Node.js and TypeScript drivers, use the object form to pin a specific SDK version independently of engine.version, which still controls the CLI:

engine:
id: copilot
copilot-sdk:
version: "1.0.16"
sha256: "<64 lowercase hex digits>"

Check in package.json and package-lock.json under .github/aw/copilot-sdk/<version>/<variant>/, where <variant> is node for the built-in or Node.js driver and typescript for an explicit ts-node command. Both files must pin @microsoft/copilot-sdk to that exact version. Use an npm v3 lockfile with canonical npm registry URLs and SHA-512 integrity for every dependency. The SDK install step needs jq and a checkout that includes these files.

When migrating an existing pin to the new npm package, regenerate the lockfile and update sha256. Custom JavaScript and TypeScript drivers must also use the new package name and v2 API; see the Copilot SDK driver specification.

From the project directory, calculate the frontmatter checksum over the manifest bytes, a NUL byte, and the lockfile bytes:

Terminal window
{ cat package.json && printf '\0' && cat package-lock.json; } | shasum -a 256 -b

Use the first field of the output. Keep both files byte-for-byte stable across checkouts (for example, enforce LF with .gitattributes). The installer verifies the digest, then runs npm ci with lifecycle scripts disabled, without changing your package files. engine.cooldown does not apply to these locked dependencies. copilot-sdk: true still uses the bundled graph. Custom graphs are already checked into the repository, so gh aw compile --dependabot does not copy them into the generated inventory.

The built-in driver registers native MCP servers from converter-owned RUNNER_TEMP/gh-aw/mcp-config/copilot-sdk.json, not the user-managed CLI catalog. tools.cli-proxy servers remain CLI-only. A SHA-256 integrity value is bound to the run, attempt, and job; missing, malformed, changed, linked, or stale catalogs fail before inference. This does not protect against a compromised runner able to replace both catalog and trusted environment.

The built-in SDK driver loads inline sub-agents and repository .github/agents/*.agent.md files that the activation job staged as custom agents. It does not discover agents from the execution checkout, including custom checkouts. If activation skips repository checkout, only staged inline agents are available. The standalone driver loads staged definitions only and does not fall back to its current directory. The driver qualifies session and sub-agent models against the AWF model catalog. GPT and Claude agents can use different wire APIs in the same session because Copilot models use separate Responses and Chat Completions providers, depending on their supported endpoints. Sub-agent activity and final model results, including BYOK status, are recorded in usage/aw_session.jsonl.

In SDK and CLI mode, the harness resolves each sub-agent’s model: before Copilot starts, including on routed runs. It uses gh-aw model aliases (such as small and large), checks the live AWF model catalog, and records each result as a model.resolution event whose role is the agent name. medium is not an alias and is treated as a literal model ID. A sub-agent without model: inherits the main model and has no resolution record.

Inline sub-agents (## agent: blocks) fail closed. If a model cannot be resolved, is missing from the live catalog, or does not qualify in SDK mode, the run fails before Copilot starts. Other repository .github/agents/*.agent.md files are often shared with VS Code, so an unresolvable model there is recorded as status: failed and logged as a warning instead of stopping the run. In CLI mode, that agent is used unchanged. In SDK mode, it inherits the session model. An inline sub-agent overrides a repository agent with the same name.

In CLI mode, when the resolved ID differs from the declared model:, the harness writes a copy of the agent file to Copilot CLI’s personal agents directory (${COPILOT_HOME:-$HOME/.copilot}/agents/). The copy keeps the same file name and changes only model:. A personal agent overrides the repository agent with the same ID, so checkout files are never modified. Sub-agent resolution is skipped in the threat-detection phase.

Use top-level max-tool-denials to stop SDK inference after repeated tool denials (default 5). For Copilot, it requires engine.copilot-sdk: true.

When a run produces no safe output, the diagnostic report reads built-in SDK driver exit code 79 as a main-session model verification failure, and 80 as a session failure after a workflow tool permission denial. Code 80 alone does not prove max-tool-denials was reached; the report adds that detail only when the matching guard event exists. These meanings apply only to the Copilot engine; other engines may reuse the same codes.

Use top-level max-tool-calls to set a positive run-wide limit on tool dispatches. The built-in SDK driver’s pre-tool hook reserves budget before execution, so failed and denied calls count, concurrent calls cannot overspend, and SDK subagent calls share the same count. When the budget is exhausted, further calls are rejected with an explanatory reason and a guard.tool_call_budget_exceeded run event.

Aggregate max-tool-calls requires SDK mode and the built-in driver and harness. CLI mode and custom drivers or harnesses reject it. Pi has separate support for this budget. It differs from tools.github.allowed[].max-calls, which is a per-tool MCP Gateway limit that does not cover local tools such as bash.

Use engine.driver to replace the built-in copilot_sdk_driver.cjs implementation. On the Copilot engine, setting engine.driver also enables engine.copilot-sdk: true:

engine:
id: copilot
driver: .github/drivers/custom-copilot-driver.js
max-tool-denials: 8
engine:
id: copilot
copilot-sdk: true
max-tool-calls: 100

engine.driver must be a relative path from the workspace root (no absolute paths, .., backslashes, or shell metacharacters). It supports:

  • script filenames ending with .js, .cjs, .mjs, .py, .ts, .mts, or .rb
  • bare command names without an extension (resolved from PATH)
  • inline source blocks using exactly one of node:, python:, go:, or java:

Inline driver sources are materialized into runtime files under ${GITHUB_WORKSPACE}/.gh-aw/copilot-sdk/ before execution. This lets you write a complete Copilot SDK driver inline in workflow frontmatter:

engine:
id: copilot
driver:
python: |
import sys
print("hello from inline driver", file=sys.stderr)

See Copilot SDK Driver Specification for the full driver contract.

The specification defines the driver environment contract. In SDK mode, gh-aw injects these required runtime values:

  • GH_AW_PROMPT
  • COPILOT_SDK_URI
  • COPILOT_CONNECTION_TOKEN

COPILOT_MODEL is required and must name the model (for example gpt-4o or claude-sonnet-4). Drivers MUST fail fast when it is not set.

The driver should consume these runtime controls:

  • COPILOT_SDK_SEND_TIMEOUT_MS
  • COPILOT_SDK_LOG_LEVEL

gh-aw usually injects COPILOT_SDK_SEND_TIMEOUT_MS from workflow timeout-minutes (via GH_AW_TIMEOUT_MINUTES), with safety headroom. Override it in engine.env only when you need a custom send timeout. COPILOT_SDK_LOG_LEVEL is a host-provided control and should be honored when gh-aw passes it to the driver process.

Do not set COPILOT_CONNECTION_TOKEN manually. The harness generates it per run and passes the same token to the sidecar and the driver process.

engine:
id: copilot
driver: .github/drivers/my_driver.ts
model: gpt-5
env:
COPILOT_SDK_SEND_TIMEOUT_MS: "900000"
COPILOT_SDK_LOG_LEVEL: info

SDK sessions retain model.call_finished and durable native events, including file-edit details and human-response provenance. Live tool.shell_output chunks are excluded from artifacts/stderr to avoid leaking secrets split across chunks. A finished model dispatch is not workflow completion. See the unified session specification for event and accounting contracts.