Agent Runtimes vs Providers: Core Concepts
Learn how OpenClaw separates model providers, models, agent runtimes, and channels. This page clarifies the distinct layers for developers configuring agent loops.
Read this when
- You are choosing between OpenClaw, Codex, ACP, or another native agent runtime
- You are confused by provider/model/runtime labels in status or config
- You are documenting support parity for a native harness
An agent runtime is responsible for a single prepared model loop. It takes in the prompt, manages model output, executes native tool calls, and hands the completed turn back to OpenClaw.
Runtimes and providers are often mistaken for one another, since both appear around model configuration. In reality, they occupy separate layers:
| Layer | Examples | Meaning |
|---|---|---|
| Provider | anthropic, github-copilot, openai | Handles OpenClaw's authentication, model discovery, and model ref naming. |
| Model | claude-opus-4-6, gpt-5.6-sol | The specific model used for the agent turn. |
| Agent runtime | claude-cli, codex, copilot, openclaw | The low-level loop or backend that runs the prepared turn. |
| Channel | Discord, Slack, Telegram, WhatsApp | The entry and exit points for messages in OpenClaw. |
A harness is the implementation that supplies an agent runtime, in code terms. As an example, the bundled Codex harness provides the codex runtime. Public configuration relies on agentRuntime.id attached to provider or model entries; runtime keys scoped to the whole agent are deprecated and disregarded. openclaw doctor --fix clears out those old whole-agent runtime pins and converts legacy runtime model refs into canonical provider/model refs, adding model-scoped runtime policy where applicable.
Two runtime categories exist:
- Embedded harnesses operate within OpenClaw's prepared agent loop. This includes the built-in
openclawruntime and registered plugin harnesses likecodexandcopilot. - CLI backends spin up a local CLI process while preserving the canonical model ref. For instance,
anthropic/claude-opus-5paired with a model-scopedagentRuntime.id: "claude-cli"means "pick the Anthropic model, run it via Claude CLI."claude-cliis not an embedded harness id and should never be handed to AgentHarness selection.
The copilot harness is a separate, opt-in external plugin harness built for the GitHub Copilot CLI. See GitHub Copilot agent runtime for the user-facing comparison between PI, Codex, and GitHub Copilot agent runtime.
Codex surfaces
The Codex name appears across several distinct surfaces:
| Surface | OpenClaw name/config | What it does |
|---|---|---|
| Native Codex app-server runtime | openai/* model refs | Executes OpenAI embedded agent turns through Codex app-server. This is the standard setup for ChatGPT/Codex subscriptions. |
| Codex OAuth auth profiles | openai OAuth profiles | Holds the ChatGPT/Codex subscription credentials consumed by the Codex app-server harness. |
| Codex ACP adapter | runtime: "acp", agentId: "codex" | Operates Codex through the external ACP/acpx control plane. Reserve this for cases where ACP/acpx is explicitly requested. |
| Native Codex chat-control command set | /codex ... | Manages Codex app-server threads from chat, including binding, resuming, steering, stopping, and inspecting. |
| OpenAI Platform API route for non-agent surfaces | openai/* plus API-key auth | Direct OpenAI APIs covering images, embeddings, speech, and realtime. |
These surfaces are deliberately kept separate. Turning on the codex plugin exposes the native app-server capabilities; openclaw doctor --fix handles legacy Codex route repair and cleanup of stale session pins. Choosing openai/* for an agent model now translates to "run this through Codex," unless a non-agent OpenAI API surface is in play.
The typical ChatGPT/Codex subscription arrangement relies on Codex OAuth for authentication, while keeping the model ref as openai/* and picking the codex runtime:
{
agents: {
defaults: {
model: "openai/gpt-5.6-sol",
},
},
}
In this flow, OpenClaw picks an OpenAI model ref and then asks the Codex app-server runtime to handle the embedded agent turn. This does not imply "use API billing," nor does it turn the channel, model provider catalog, or OpenClaw session store into Codex.
With the bundled codex plugin active, prefer the native /codex command surface (/codex bind, /codex threads, /codex resume, /codex steer, /codex stop) for natural-language Codex control rather than ACP. ACP should be used for Codex only when the user explicitly requests ACP/acpx or is evaluating the ACP adapter path. External harnesses like Claude Code, Gemini CLI, OpenCode, and Cursor continue to rely on ACP.
Decision tree:
- Codex bind/control/thread/resume/steer/stop -> native
/codexcommand surface when the bundledcodexplugin is enabled. - Codex as the embedded runtime or the standard subscription-backed Codex agent experience ->
openai/<model>. - OpenClaw explicitly chosen for an OpenAI model -> retain the model ref as
openai/<model>and set provider/model runtime policy toagentRuntime.id: "openclaw". A selectedopenaiOAuth profile is routed internally through OpenClaw's Codex-auth transport. - Legacy Codex model refs in config -> fix with
openclaw doctor --fixtoopenai/<model>; doctor preserves the Codex auth route by inserting provider/model-scopedagentRuntime.id: "codex"where the old model ref implied it. Legacycodex-cli/*model refs repair to the sameopenai/<model>Codex app-server route; OpenClaw no longer ships a bundled Codex CLI backend. - ACP, acpx, or Codex ACP adapter explicitly requested ->
runtime: "acp"andagentId: "codex". - Claude Code, Gemini CLI, OpenCode, Cursor, Droid, or another external harness -> ACP/acpx, not the native sub-agent runtime.
| You mean... | Use... |
|---|---|
| Codex app-server chat/thread control | /codex ... from the bundled codex plugin |
| Codex app-server embedded agent runtime | openai/* agent model refs |
| OpenAI Codex OAuth | openai OAuth profiles |
| Claude Code or other external harness | ACP/acpx |
For the OpenAI-family prefix split, refer to OpenAI and Model providers. For the Codex runtime support contract, see Codex harness runtime.
Runtime ownership
How much of the loop each runtime takes on varies:
| Surface | OpenClaw embedded | Codex app-server |
|---|---|---|
| Model loop owner | OpenClaw, through the OpenClaw embedded runner | Codex app-server |
| Canonical thread state | OpenClaw transcript | Codex thread, plus OpenClaw transcript mirror |
| OpenClaw dynamic tools | Native OpenClaw tool loop | Bridged through the Codex adapter |
| Native shell and file tools | OpenClaw path | Codex-native tools, bridged through native hooks where supported |
| Context engine | Native OpenClaw context assembly | OpenClaw projects assembled context into the Codex turn |
| Compaction | OpenClaw or selected context engine | Codex-native compaction, with OpenClaw notifications and mirror maintenance |
| Channel delivery | OpenClaw | OpenClaw |
A design guideline applies: when OpenClaw controls a surface, standard plugin hook behavior is available. When the native runtime controls it, OpenClaw must rely on runtime events or native hooks. If canonical thread state sits with the native runtime, OpenClaw mirrors and projects context instead of rewriting internals it cannot support.
Runtime selection
Runtime resolution for an embedded setup happens after provider and model resolution, following this sequence:
- Model-scoped runtime policy takes precedence. It is defined in a configured provider model entry, or in
agents.defaults.models["provider/model"].agentRuntime/agents.entries.*.models["provider/model"].agentRuntime. A provider wildcard such asagents.defaults.models["vllm/*"].agentRuntimeis applied after exact model policy, so dynamically discovered provider models can share one runtime without overriding exact per-model exceptions. - Provider-scoped runtime policy:
models.providers.<provider>.agentRuntime. automode: registered plugin runtimes can claim supported provider/model pairs.- If nothing claims the turn in
automode, OpenClaw falls back toopenclawas the compatibility runtime. Use an explicit runtime id when the run must be strict.
Whole-session and whole-agent runtime pins are ignored: OPENCLAW_AGENT_RUNTIME,
session agentHarnessId/agentRuntimeOverride state, agents.defaults.agentRuntime,
and agents.entries.*.agentRuntime. Run openclaw doctor --fix to remove stale
whole-agent runtime config and convert legacy runtime model refs where intent
can be preserved.
Explicit provider/model plugin runtimes fail closed: agentRuntime.id: "codex"
on a provider or model means Codex, or a clear selection/runtime error, it is
never silently routed back to OpenClaw. Only auto may route an unmatched
turn to OpenClaw.
CLI backend aliases differ from embedded harness ids. Preferred Claude CLI form:
{
agents: {
defaults: {
model: "anthropic/claude-opus-5",
models: {
"anthropic/claude-opus-5": {
agentRuntime: { id: "claude-cli" },
},
},
},
},
}
Legacy refs such as claude-cli/claude-opus-4-7 are accepted as compatibility
input, but new config should keep the provider/model canonical and put the
execution backend in provider/model runtime policy. Run openclaw doctor --fix
to rewrite persisted legacy model selections, model-map keys, and explicit
modelPolicy.allow entries to that canonical shape.
Legacy codex-cli/* refs are different: doctor migrates them to openai/* so
they run through the Codex app-server harness instead of preserving a Codex
CLI backend.
auto mode is intentionally conservative for most providers. OpenAI agent
models are the exception: unset runtime and auto both resolve to the Codex
harness. Explicit OpenClaw runtime config remains an opt-in compatibility
route for openai/* agent turns; when paired with a selected openai OAuth
profile, OpenClaw routes that path internally through the Codex-auth
transport while keeping the public model ref as openai/*. Stale OpenAI
runtime session pins are ignored by runtime selection and can be cleaned with
openclaw doctor --fix.
If openclaw doctor warns that the codex plugin is enabled while legacy
Codex model refs remain in config, treat that as legacy route state and run
openclaw doctor --fix to rewrite it to openai/* with the Codex runtime.
GitHub Copilot agent runtime
The external @openclaw/copilot plugin registers an opt-in copilot runtime
backed by the GitHub Copilot CLI (@github/copilot-sdk). It claims the
canonical subscription github-copilot provider and is never selected by
auto. Opt in per-model or per-provider via agentRuntime.id:
{
agents: {
defaults: {
model: "github-copilot/gpt-5.5",
models: {
"github-copilot/gpt-5.5": {
agentRuntime: { id: "copilot" },
},
},
},
},
}
The plugin manifest declares the harness provider, runtime, CLI session key,
and auth profile prefix without requiring openclaw doctor to load plugin
code. For configuration, auth, transcript mirroring, compaction, the
declarative doctor contract, and the broader PI vs Codex vs Copilot SDK
decision, see GitHub Copilot agent runtime.
Compatibility contract
When a runtime is not OpenClaw, its docs should state which OpenClaw surfaces it supports:
| Question | Why it matters |
|---|---|
| Who owns the model loop? | Determines where retries, tool continuation, and final answer decisions happen. |
| Who owns canonical thread history? | Determines whether OpenClaw can edit history or only mirror it. |
| Do OpenClaw dynamic tools work? | Messaging, sessions, cron, and OpenClaw-owned tools rely on this. |
| Do dynamic tool hooks work? | Plugins expect before_tool_call, after_tool_call, and middleware around OpenClaw-owned tools. |
| Do native tool hooks work? | Shell, patch, and runtime-owned tools need native hook support for policy and observation. |
| Does the context engine lifecycle run? | Memory and context plugins depend on assemble, ingest, after-turn, and compaction lifecycle. |
| What compaction data is exposed? | Some plugins only need notifications; others need kept/dropped metadata. |
| What is intentionally unsupported? | Users should not assume OpenClaw equivalence where the native runtime owns more state. |
The Codex runtime support contract is documented in Codex harness runtime.
Status labels
Status output can show both Execution and Runtime labels. Read them as
diagnostics, not provider names:
- A model ref such as
openai/gpt-5.6-solis the selected provider/model. - A runtime id such as
codexis the loop executing the turn. - A channel label such as Telegram or Discord is where the conversation is happening.
If a run shows an unexpected runtime, inspect the selected provider/model runtime policy first. Legacy session runtime pins no longer decide routing.