Best for
- Design multi-provider support for a coding-agent CLI
- Normalize tool-call and structured-output behavior across providers
- Review streaming token handling or partial message assembly
vasilyu1983/AI-Agents-public/frameworks/shared-skills/skills/ai-coding-agents-provider-runtime/SKILL.md
Designs provider runtimes for coding agents. Use when modeling model abstraction, streaming semantics, tool-call normalization, retries, or fallback routing.
Decision brief
Use this skill to design or review the model-provider layer inside a coding-agent runtime: provider abstraction, streaming semantics, tool-call protocol normalization, context-window strategy, retries, and fallback routing.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Declared | Source record | Install path and trigger |
| Claude Code | Declared | Source record | Install path and trigger |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/vasilyu1983/AI-Agents-public --skill "frameworks/shared-skills/skills/ai-coding-agents-provider-runtime"Inspect the Agent Skill "ai-coding-agents-provider-runtime" from https://github.com/vasilyu1983/AI-Agents-public/blob/53f6cb73ea53a2646e3e7d4665062ad66f3683ac/frameworks/shared-skills/skills/ai-coding-agents-provider-runtime/SKILL.md at commit 53f6cb73ea53a2646e3e7d4665062ad66f3683ac. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1. Define the provider contract. Keep request shape, streaming events, tool calls, usage accounting, and error taxonomy behind one internal interface. 2. Normalize partial output. Providers stream differently, so convert them into one local event model before the rest of the run…
Review the “ASCII Flow” section in the pinned source before continuing.
Review the “Quick Reference” section in the pinned source before continuing.
Design multi-provider support for a coding-agent CLI
Review the “Use Other Skills” section in the pinned source before continuing.
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 95/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 80 | Source | Repository attention, not individual Skill quality |
| Compatibility | 2 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Use this skill to design or review the model-provider layer inside a coding-agent runtime: provider abstraction, streaming semantics, tool-call protocol normalization, context-window strategy, retries, and fallback routing.
This skill owns the model-facing runtime surface for coding agents. It is the main missing layer when trying to generalize Claude Code-derived patterns toward Codex-class portability.
agent turn
|
v
provider selection
capability needs + model policy + cost/latency + context window
|
v
request normalization
messages + tools + structured outputs + cache hints + metadata
|
v
provider stream
tokens + tool calls + errors + usage events
|
v
runtime event model
normalized deltas + retries/fallbacks + final response
| Question | Read | Outcome |
|---|---|---|
| How should providers and streaming semantics be normalized? | references/provider-abstraction-and-stream-normalization.md | Stable provider interface, streaming event model, and tool-call normalization |
| How should retries, context windows, and fallback routing work? | references/context-window-retries-and-fallback-routing.md | Provider selection, truncation rules, retry classes, and fallback policy |
| How does OpenAI Codex check local OSS provider readiness? | references/openai-codex-local-oss-provider-readiness.md | Ollama/LM Studio readiness workflow, model presence, version gates, fetch/load diagnostics, and capability-driven selection |
| What exactly differs across Claude, OpenAI, Gemini, and Ollama today? | references/provider-capability-matrix.md | Feature-by-feature comparison (streaming, structured output, tool calls, vision, caching) plus a capability-flag interface and shim design notes |
| Need | Use Instead |
|---|---|
| Broader coding-agent architecture | ../ai-coding-agents/SKILL.md |
| Tool registry and tool execution | ../ai-coding-agents-tools/SKILL.md |
| Settings and policy precedence | ../ai-coding-agents-settings-policy/SKILL.md |
| Generic LLM provider strategy and serving | ../ai-llm/SKILL.md, ../ai-llm-inference/SKILL.md |
max_output_tokens, and policy refusal should not share the same retry behavior.max_output_tokens into a generic model failure if the runtime supports bounded recovery or continuation prompts.max_output_tokens recovery, and explicit continuation or recovery-message patterns are still too implicitmax_output_tokens recovery as its own failure class, and the telemetry fields needed to explain when a provider run recovered versus failed outrightmax_output_tokens as a generic hard failure when bounded recovery exists.max_output_tokens.if provider == x branches without a stable contract.These are the calls a senior reviewer makes that a checklist alone will not catch.
Provider interface, capability-flag matrix, and cross-provider parity suite earn their cost at the second production provider, not the first. A single well-tested adapter with a documented seam (where the interface will go) is the right amount of abstraction for a one-provider runtime; building the matrix for a hypothetical future provider is premature and adds real maintenance drag for no current benefit.Source: codex-rs/core/ (dispatch logic), codex-rs/chatgpt/ (ChatGPT account auth path); OpenAI migration guide https://developers.openai.com/api/docs/guides/migrate-to-responses
Responses API is now the recommended path for all new agentic work. The Assistants API is sunset as of August 26, 2026. Key reasons to prefer Responses API for coding-agent runtimes:
code_interpreter, file_search, remote MCP tools available without custom tool wiring.previous_response_id (or encrypted reasoning items when stateless) — Chat Completions has no equivalent, so non-reasoning-model workloads should not expect this improvement. Track cache-hit events as a separate telemetry dimension — they have different cost multipliers than uncached inference.Judgment call: the 40-80% figure is real but conditional — do not cite it when advising a runtime that only calls non-reasoning models. Verify which model family is in play before using this number to justify a migration.
Codex's core provider layer supports two distinct OpenAI dispatch paths:
| Path | Crate / module | Auth mechanism | Use case |
|---|---|---|---|
| Responses API | codex-rs/core/ | API key (OPENAI_API_KEY) | Recommended path for new agentic work; structured tool calls, streaming, built-in tools, prompt caching |
| ChatGPT account | codex-rs/chatgpt/ | Browser session / OAuth (ChatGPT account login via codex login) | Users who access OpenAI through ChatGPT Plus/Team, not a paid API key |
The codex-rs/chatgpt crate hosts first-party ChatGPT-account API surfaces (per its own README, "should be primarily built and maintained by OpenAI employees"); as the codebase has grown, session/OAuth token acquisition has moved toward a dedicated codex-rs/login crate rather than living entirely inside chatgpt. Either way, this path does not use the standard Authorization: Bearer <API_KEY> header — it authenticates from the ChatGPT session. The provider contract (streaming events, tool calls, usage) is normalized to the same internal event model by both paths — upstream consumers of the provider layer should not branch on which path ran. Codex's crate layout evolves quickly (dozens of crates now exist beyond the two discussed here); re-check the current tree before citing an exact file path.
Design rule: when adding a new OpenAI API surface (e.g. a new beta endpoint), decide at crate-selection time whether it belongs in the core Responses API path or requires a separate auth-specific crate. Do not add ChatGPT-account authentication logic to the core API path, and do not add Responses API logic to the chatgpt crate.
Goose (Rust; originally built by Block) broadens the provider-runtime surface beyond the Claude Code lineage. Block donated Goose to the newly formed Agentic AI Foundation (AAIF) at the Linux Foundation on April 7, 2026 — the same announcement bundled Anthropic's donation of the Model Context Protocol (MCP) and OpenAI's donation of AGENTS.md as separate, parallel contributions to the same foundation. Do not describe Anthropic or OpenAI as co-founders of Goose itself; they contributed different projects to AAIF, not to Goose's codebase. The repository moved to github.com/aaif-goose/goose. "Goose 2.0" (the project's own informal name for its April 2026 architecture overhaul) ships ACP as the default server interface (not a subcommand), which affects how ACP-delegated provider routing is framed below. Three patterns are worth importing.
Some providers (Ollama, older open-weights, some completion-only endpoints) do not expose a native function-calling contract. A toolshim is a provider-side adapter that synthesizes tool-call semantics on top of text generation: it prompts the model in a structured way, parses the output into normalized tool-call events, and emits them through the same internal event model as native function-calling providers.
supports_native_tool_calls: bool capability flag; when false, route through the shim adapter. The shim must emit the same streaming event shape, the same tool-call IDs, and the same malformed-tool-output retry class as native providers.An external coding agent (Claude Code, Codex, another Goose instance) reachable over Agent Client Protocol (ACP) stdio can be used as a provider. The local runtime sends a prompt and a tool schema; the remote agent does its own loop and returns completions plus structured tool events.
Provider contract as LLM vendors. Capability flags advertise which turns route to agents (long-horizon planning, complex multi-file edits) versus direct LLM calls.ai-coding-agents-remote-runtime). That is the reverse direction — there, your agent is the server to an editor. Here, the remote agent is your provider. Conflating the two produces double-stack approval bridges.acp:// provider URI scheme. Attribute usage, cost, and latency to the delegated-agent provider like any other row in the per-provider telemetry table. Falling back from an agent-provider to a bare-LLM provider is a semantic fallback and must be user-visible.A general-purpose coding-agent runtime should aspire to cover ≥12 providers, using the Goose 2.0 baseline (15+ providers) as the upper bound: Anthropic, OpenAI (Responses API), Google/Gemini (Gemini API + Vertex), Azure OpenAI, AWS Bedrock, OpenRouter, Ollama, LM Studio, plus ACP-delegated agents, and additional cloud or hosted providers. Gemini-specific notes: the Gemini API supports 1M-token context on long-context models, cachedContents for explicit context caching, and responseMimeType: "application/json" + responseSchema for structured output — all three matter for coding-agent workloads. The Gemini CLI (github.com/google-gemini/gemini-cli) is an open-source (Apache 2.0) TypeScript first-party reference implementation; Google discontinued its free consumer tier in June 2026 (source still builds and runs for enterprise-license or paid-API-key users) — if you use it as a design reference, do not assume free-tier auth is still a live entitlement path worth modeling. If your provider abstraction makes it expensive to add the 12th provider, the abstraction is wrong.
max_output_tokens recovery.references/provider-abstraction-and-stream-normalization.md — Provider interfaces, streaming event models, and tool-call normalizationreferences/context-window-retries-and-fallback-routing.md — Context-window policy, retry classes, and fallback routingreferences/openai-codex-local-oss-provider-readiness.md — OpenAI Codex local OSS provider readiness checks, model availability, version gates, and remediation classesreferences/provider-capability-matrix.md — Cross-provider feature matrix, shim design notes, and a capability-flag interface for Claude, OpenAI, Gemini, and Ollamadata/sources.json — Primary docs and implementation references for provider-runtime design../ai-coding-agents/SKILL.md../ai-coding-agents-tools/SKILL.md../ai-coding-agents-settings-policy/SKILL.md../ai-llm/SKILL.mdBefore applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
Frequently asked questions
Use this skill to design or review the model-provider layer inside a coding-agent runtime: provider abstraction, streaming semantics, tool-call protocol normalization, context-window strategy, retries, and fallback routing.
The source record exposes this install command: npx skills add https://github.com/vasilyu1983/AI-Agents-public --skill "frameworks/shared-skills/skills/ai-coding-agents-provider-runtime". Inspect the command and pinned source before running it.
The pinned source record declares support for: codex, claude code.
Alternatives
vasilyu1983/AI-Agents-public
Configures Claude Code hooks and Codex hooks.json/notify callbacks. Use when adding guardrails, preflight, audit trails, worktree automation, or budget enforcement.
vasilyu1983/AI-Agents-public
Guides iOS testing with XCTest, XCUITest, Swift Testing, simctl, and xcresult. Use when choosing destinations, controlling flakes, or parsing test artifacts for native apps.
vasilyu1983/AI-Agents-public
Guides multi-GPU pre-training: DDP, FSDP2, ZeRO, tensor/pipeline/expert parallelism, fp8/Muon. Use when scaling a run, training MoE, or reproducing GPT-2 on rented GPUs.
vasilyu1983/AI-Agents-public
Scans public GitHub repos for agent skills, dev practices, and code patterns. Use when enriching skills, setting team policy, or researching a build domain.