AI Engines

An engine runs a workflow’s Markdown instructions with its configured tools, sandbox, and safe outputs. This page covers selection and shared settings; engine-specific settings are in the individual references.

EngineSelectionGet startedTechnical reference
GitHub Copilot (default)engine: copilot or omit engineCopilot setupCopilot reference
Claude Codeengine: claudeClaude setupClaude reference
OpenAI Codexengine: codexCodex setupCodex reference
Gemini CLI (deprecated)engine: geminiGemini setupGemini reference
Piengine: piPi setupPi reference
Agy (experimental)engine: agyAgy setupAgy reference

For imported engine definitions and third-party samples, see Custom AI engines. Switching engines may require different credentials, models, tools, and network rules.

The engine, inference provider, and enabled tools determine where repository context is processed. Before enabling a workflow, review provider terms, retention, accessible content, outbound destinations, and artifact access. Credentials are covered in Authentication.

FeatureCopilotClaudeCodexGeminiPiAgy
Top-level max-turnsYesYesYesYesYesNo
max-continuationsYesNoNoNoNoNo
tools.web-fetchBuilt-in MCPNative on Anthropic; built-in MCP on CopilotYesYesBuilt-in MCPCannot disable
Native tools.web-searchNoAnthropic onlyYesNoNoCannot disable
Native engine.agent selectionYesNoNoNoNoNo
engine.api-targetYesYesYesYesYesNo
engine.bareYesYesNoNoYesNo
Custom engine.harnessYesYesYesNoNoNo
Per-command bash allowlistYesYesNoYesYesNo
Native MCPYesYesYesYesYesProduction-conformance gated
Agent Plugins (plugins)YesYesYesNoNoNo
Artifact-backed engine.durableSession (CLI/SDK)SessionSessionSessionSession (CLI/SDK/RPC)Session

Codex can disable shell execution but cannot enforce a command allowlist. Agy rejects unsupported tool restrictions rather than ignoring them. See individual references for provider-specific web access, bare-mode behavior, and dynamic workflows.

max-turns defaults to 500 (legacy alias max-runs); max-ai-credits defaults to 1000. These are top-level fields, not engine properties. Agy supports credit/cache-miss limits but not max-turns. engine.max-turns is a deprecated Claude-only iteration limit. Agent Plugins remain experimental.

String form selects a built-in engine. Object form adds settings:

engine:
id: copilot
model: opus
env:
DEBUG_MODE: "true"
FieldContract
idBuilt-in ID, or the ID of an imported definition.
modelExact model ID, alias, or provider-prefixed selection; may also be top-level model.
versionOverride the compiler-pinned CLI version.
cooldownMinimum release age in nonnegative integer days; defaults to 3. Explicit 0 disables cooldown, including in strict mode.
envEngine-only runtime values; use top-level env for all steps. Scope and precedence apply.
argsOrdered native CLI arguments placed before the prompt. Agy rejects it.
commandReplacement executable that skips the engine installer, not AWF installation. Provision it in setup steps; Agy checks the verified version, and Copilot checksum pins cannot be combined with it.
api-targetEndpoint hostname, where supported; see below.
harnessReplacement wrapper or retry settings for Copilot, Claude, and Codex.
durableArtifact-backed session continuation with optional retention-days (1–90, default 7).

Engine-specific options such as agent, copilot-sdk, driver, dynamic-workflows, permission-mode, config, and extensions are documented in each engine reference. Agy rejects most overrides.

All built-in engines support artifact-backed continuation:

engine:
id: copilot
durable:
retention-days: 7

The compiler restores an explicit parent from aw_context, or otherwise the last successful run of the same workflow on the same branch. Reruns prefer a checkpoint from an earlier attempt of the same run. Retention follows repository and organization policy. Durable mode needs no memory tool and never dispatches another run.

EnginePersisted stateContinuation
Copilot CLI and SDKNative session-state files and exact session IDCLI --session-id; SDK resumeSession
ClaudeProject transcripts, task state, and exact session IDCLI --resume <id>
CodexNative and archived rollout sessions and exact thread IDCLI exec resume <id>
GeminiNative temporary session storage and project registryPrompt points to restored session files
AgyNative conversation databasesPrompt points to restored session files
Pi CLI, SDK and RPCNative JSONL conversation sessionCLI/RPC --session; SDK SessionManager.open

Copilot, Claude, Codex, and Pi resume the exact recorded session with the current prompt, credentials, models, and tool policy. Gemini and Agy receive restoration metadata instead of a forced continuation argument. Restored history counts as metadata unless facts are verified against trusted sources, and restored text is never treated as an instruction.

Durable mode reuses potentially attacker-influenced history across runs. The untrusted-data guidance is advisory, not enforced isolation, and does not eliminate cross-run prompt injection.

Only session files are restored, not workspace edits, credentials, pending task phases, or exactly-once tool execution. Restored Copilot events are excluded from current-run capture and model verification. With no prior run or checkpoint, the first run starts a new session. Missing explicit-parent artifacts, corrupt sessions, and authorization failures remain errors; they never silently start an unrelated conversation.

Durable restore selects its parent as follows. A re-run attempt first restores its own earlier attempt’s checkpoint. A dispatch whose aw_context contains continuation_run_id restores that run, which must be a completed run of the same workflow, repository, and branch, and not a fork. Other aw_context fields such as run_id and parent_run_id describe the caller for lineage only; a dispatched run without continuation_run_id, such as one routed by a slash command, starts a new session. Runs without aw_context restore the latest successful run of the same workflow on the same branch. continuation_run_id is never relayed to further dispatches.

The unified session records durable.restore (restored, fresh, or failed) and, for Copilot, Claude, Codex, and Pi, durable.session (resumed or fresh). These records hold metadata only, and restoration alone does not prove native continuation for Gemini, Agy, or imported engines. Recording is best effort; missing records mean evidence is unavailable, not a fresh start or a failed restore. gh aw audit RUN --artifacts info,usage --json and gh aw health WORKFLOW --json --logs-dir DIRECTORY report this evidence; see the audit reference. Spans and durable session logs carry the checkpoint parent as gh-aw.durable.parent_run_id; fresh runs omit it.

Built-in durable mode rejects replacement commands, custom drivers, and harnesses. Pi’s SDK and RPC drivers remain supported. Ordinary CLI arguments work, but session selectors and persistence-disabling flags cannot override compiler-managed continuation. Copilot cannot override COPILOT_HOME. Pi has additional restrictions, and imported engines must declare their own durable files. Threat detection uses a separate fresh session.

Checkpoints are published after secret redaction and integrity validation. Copilot event payloads can be redacted before publication while preserving the session ID and event structure. The checkpoint is rejected if redaction changes other session files or cannot preserve the event structure. Cancellation or hard runner loss can prevent publication. Artifacts contain restorable session content that may expose sensitive history to anyone with artifact access, and redaction is heuristic. Enable durable mode only where that suits the repository’s artifact access and retention policies.

The compiler pins a CLI release. Override it with engine.version, then recompile:

engine:
id: copilot
version: "1.0.101"

Versions may use Actions expressions, passed through environment variables rather than shell interpolation. Copilot expressions must resolve to trusted cached releases or built-in manifest pins; other Copilot releases need a literal version and a checksum pin. Agy accepts only verified releases.

Compiler-managed engine installs use a 3-day minimum release age by default. Configure a different age with engine.cooldown:

engine:
id: copilot
cooldown: 7

The value must be a nonnegative integer number of days; booleans, strings, durations, and expressions are rejected. cooldown: 0 disables metadata lookups, warnings, and release-age enforcement, including in strict mode. Omitting the field keeps the default.

Literal versions, including compiler defaults, are checked during compilation: Copilot uses public GitHub release publication times; Claude, Codex, Pi, Gemini, and behavior-defined npm engines use public npm publication times. A release younger than the configured cooldown fails compilation. Metadata requests are unauthenticated, reject redirects, and have time and response-size limits. Publication times and lookup failures are cached for five minutes within the compiler process across workflows; each workflow’s cooldown is evaluated against the cached timestamp, not a cached pass/fail decision.

If metadata is unavailable or invalid, compilation continues with one warning per release per compiler instance asking for manual release-age validation before running. Offline authorization verification and in-memory editor compilation do not fetch or cache metadata and use the same warning behavior. Recompiling in a new compiler process retries failed lookups.

Claude, Codex, Pi, Gemini, and behavior-defined npm installs pass the age to npm via NPM_CONFIG_MIN_RELEASE_AGE, including microVM staging. npm enforces it with its built-in min-release-age setting, so runtime overrides need npm 11.10.0 or later.

Copilot literal releases do not repeat the release-age lookup at runtime. This avoids using an enterprise-scoped runner token for public release-age metadata. Tradeoff: when the compile-time lookup cannot complete (network failure, or offline, editor, or wasm compilation), the compiler only warns and the literal release installs with no runtime cooldown check, so verify the release age manually. Dynamic versions (Actions expressions or release tags such as latest) retain the runtime cooldown before cache activation or download; missing or invalid metadata fails installation. The installer’s reviewed default-version exemption still applies to dynamic resolutions. Checksum verification and pin requirements are unchanged.

The policy does not cover shell installers, engine.command executables, pre-agent steps, or extensions. Runtime dependency cooldowns use runtimes.<id>.cooldown (a boolean). Imported definitions that set behaviors.installation.cooldown are ignored; set engine.cooldown in the workflow instead.

api-target is a hostname, without protocol or path, and must be permitted by network.allowed:

engine:
id: copilot
api-target: api.acme.ghe.com
network:
allowed: [defaults, acme.ghe.com, api.acme.ghe.com]

For GHES Copilot, api.enterprise.githubcopilot.com is an endpoint-routing example only if the endpoint is available for your account and deployment; it is not a GHES support promise. Confirm licensing, policy, and firewall prerequisites in Copilot Engine Prerequisites on GHES. See GHE Cloud troubleshooting for data-residency setup. Agy does not support api-target.

Custom API Endpoints via Environment Variables

Section titled “Custom API Endpoints via Environment Variables”
EngineBase URL variable
CopilotGITHUB_COPILOT_BASE_URL
ClaudeANTHROPIC_BASE_URL
CodexOPENAI_BASE_URL
GeminiGEMINI_API_BASE_URL

Set the URL through engine.env and allow its domain in network.allowed. AWF derives the proxy target from it. Copilot’s api-target takes precedence over GITHUB_COPILOT_BASE_URL. Pi’s additional provider routing is in its reference.

For OPENAI_BASE_URL and ANTHROPIC_BASE_URL, model fallback is off by default so provider model IDs pass through; override with sandbox.agent.model-fallback. If proxy steering conflicts with the endpoint, set sandbox.agent.token-steering: false.

Copilot, Claude, and Codex accept a replacement harness provisioned in ${RUNNER_TEMP}/gh-aw/actions/, for example through pre-agent-steps:

engine:
id: copilot
harness:
use: custom_copilot_harness.cjs

use must start with a letter, digit, or underscore, end in .js, .cjs, or .mjs, and contain no directory separators, .., or shell metacharacters. Node 24 is provisioned automatically. A replacement owns its retry, timeout, prompt-delivery, and tool-policy behavior.

Harness Retry and Post-result Watchdog Policy

Section titled “Harness Retry and Post-result Watchdog Policy”

The built-in Copilot, Claude, and Codex harnesses accept:

engine.harness fieldDefaultMeaning
max-retries3Retries after the initial attempt; 0 disables.
initial-delay-ms5000First retry delay.
backoff-multiplier2Exponential delay multiplier.
max-delay-ms60000Exponential backoff cap; does not cap provider Retry-After waits.
watchdog-timeout120Post-result idle timeout; literal integers are seconds.

All accept integers or Actions expressions. A watchdog expression must already be in milliseconds. Explicit engine.env.GH_AW_HARNESS_* values override these fields; see runtime tuning variables.

For every inference provider, including BYOK endpoints such as Azure AI Gateway, the Copilot, Claude, and Codex harnesses wait at least the duration of a valid HTTP 429 Retry-After header (seconds or HTTP-date) before a permitted retry. Claude and Codex use headers from structured terminal errors on stdout; other output does not provide retry timing. Provider waits are not limited by max-delay-ms. If the wait reaches the remaining step timeout budget (including the harness’s shutdown buffer) or exceeds the maximum timer delay (2147483647 milliseconds), they stop immediately with failure class rate_limit_wait_exceeded and the requested delay instead of retrying early. If the timeout is unset or invalid, waits exceeding 60 seconds are rejected as a fallback. For example, a 257-second wait is honored with the default backoff settings when sufficient time remains. Missing or invalid headers keep the existing retry policy, and terminal guards still apply. This does not enable model fallback on HTTP 429.

Pi, Gemini, Agy, and behavior-defined engines use the same retry loop with a conservative failure policy. They retry only HTTP 429 or rate-limit errors and transient failures (HTTP 5xx, connection resets, or timeouts) found in the last 8 KB of a failed attempt’s output, where terminal errors appear. They apply the same Retry-After bounds to a Retry-After header in that output tail when it accompanies an HTTP 429 or rate-limit error; a Retry-After header alone does not trigger a retry. They stop without retrying on authentication or guard failures, unrecognized failures, noop, or any failed attempt that recorded safe outputs. Retries are disabled when GH_AW_SAFE_OUTPUTS is unset, because safe-output side effects cannot be observed. Pi resumes a durable session when one exists; other engines start a fresh attempt. Agy rejects engine.harness, so it always uses the defaults.

The watchdog arms after a terminal safe output (not diagnostic reports such as report_incomplete) and resets on any stdout or stderr activity. It can end a quiet process that is still working and count that as success. Claude counts only current-attempt terminal outputs; its resume rules also apply.

Threat detection defaults to zero retries; configure its engine explicitly to change that. Model fallback below retries individual inference requests, not whole agent attempts.

Copilot, Claude, Codex, Pi, and Agy resolve aliases against the configured provider’s live AWF /reflect catalog before execution:

  • Built-in aliases (such as opus/small), workflow-defined models:, and their globs select the newest live match. Globs skip models AWF marks as not automatically selectable, such as a Decisions-only evaluation model; alias entries without *, such as evals, are unaffected.
  • A provider/ prefix restricts the lookup; otherwise the engine’s configured provider applies.
  • Exact live IDs take precedence over same-named aliases, and unrecognized IDs are not rewritten. Pi checks exact IDs before launch; Copilot, Claude, and Codex fail on the first unavailable-model request.
  • auto keeps its engine-specific meaning. In Copilot CLI mode, ?effort=low, ?effort=medium, and ?effort=high on a model ID or alias become --reasoning-effort after alias resolution. The CLI receives the model ID without the suffix. An explicit --reasoning-effort in engine.args takes precedence.
  • Missing matches fail with model_unavailable; incomplete discovery fails with catalog_unavailable.

Set engine.model-catalog: false (default true) for BYOK providers without a /models route, such as Azure AI Gateway. The configured model is then passed to the engine verbatim: aliases are not resolved, and a model ID that matches a built-in alias (such as gpt-5-mini) no longer fails with catalog_unavailable. Model routing also needs the catalogue, so the implicit routing default is not applied and model: router fails compilation. Threat detection inherits the workflow model; when none is set, it uses the engine’s main-agent default instead of the detection alias.

engine.copilot-sdk: true also needs the catalogue, so combining it with model-catalog: false fails compilation; use Copilot CLI mode instead.

Sub-agent models are also passed verbatim, without catalogue or endpoint checks; a Claude or Codex sub-agent model whose provider/ prefix names a different provider still fails.

Workflow-defined models: aliases are not resolved either: naming one passes the alias name to the engine as a literal model ID and logs a warning, so set a concrete model ID instead.

engine:
id: copilot
model: gpt-5-mini
model-catalog: false

Gemini and declarative engines pass model names through unchanged and warn about gh-aw aliases. AWF can independently rewrite unrecognized models on non-Copilot providers; disable sandbox.agent.model-fallback when exact routing is required.

Resolution produces model.resolution evidence in usage/aw_session.jsonl. See Model Aliases for the catalog and Model Routing for experimental per-run model/effort selection on Copilot-backed Copilot, Claude, Codex, and Pi, chosen with model: router (or router/economy, router/balanced, router/robust). Router values are not model names: router and router/* are reserved and can’t be used as aliases.

On GitHub Copilot inference, copilot, claude, codex, and pi workflows that set no model or routing use goal: cost and mode: auto, the same as model: router (Claude and Codex also require model-provider: github). Any explicit model (including a router value), engine.model, engine.model-routing, engine.fallback-models, or model engine.env variable, including from imports, keeps existing behavior, as do unsupported or uncertain configurations. A nonempty GH_AW_MODEL_AGENT_<ENGINE> or GH_AW_DEFAULT_MODEL_<ENGINE> variable overrides the default at run time for Copilot, Claude, and Codex. Opt out with top-level model-routing: false; see default routing.

engine:
id: copilot
model: grok-4.7
fallback-models: [gpt-5.6-luna, mai-code-1.1-flash]

All built-in engines accept ordered same-provider alternatives with AWF v0.28.31+ and a compatible API-proxy image. AWF retries the failed request without restarting the agent, keeping policy and budget checks. An explicit chain disables automatic middle-power substitution.

Fallback covers server errors, request timeouts, unsupported models, and model-availability HTTP 400 errors. Authentication failures, HTTP 429, policy/guardrail failures, cancellation, and job timeouts do not switch models. Exhausted chains fail the run.

Unqualified alternatives inherit the primary provider; prefixes must match it, and credentials follow that provider’s configuration. Cross-provider chains, fallback aliases, missing compatible AWF, and combinations with engine.model-routing fail compilation. Custom harnesses and drivers can use AWF fallback without implementing switching.

token-usage.jsonl records the serving model and model_fallback evidence, without changing harness retries or proving every alternative ran.

engine.bare: true (default false) disables ambient discovery in Copilot, Claude, and Pi. Copilot suppresses custom instructions; Claude keeps explicitly installed skills and plugins with a minimal tool set; Pi keeps managed infrastructure and explicitly loaded skills. See the individual references for restrictions.

SettingDefaultScope
timeout-minutes20Entire agent job.
tools.timeout60 seconds for Claude/CodexSupported tool operations; Codex native MCP calls, not shell commands.
tools.startup-timeout120 seconds for CodexMCP server startup; explicit Codex server config takes precedence.
max-turns500AWF invocation cap, except unsupported Agy.
max-continuationsUnsetCopilot autopilot continuation budget.

Claude receives top-level max-turns automatically; no duplicate CLAUDE_CODE_MAX_TURNS is needed. Copilot and Gemini retain native tool-limit behavior. See tool timeouts and long builds.

Repository engine-conformance-<id>.md workflows are manual smoke tests. They check file, shell, and MCP probes using recorded receipts, not an agent’s success claim. Missing credentials fail activation. Reports are kept for two days.

These tests do not establish security, model quality, SDK/driver coverage, or provider compliance with a requested model. Agy’s production gate is separate from its native authentication probe.

The following anchors retain links to sections moved from this page.