开发与测试
ai-coding-agents-provider-runtime
Designs provider runtimes for coding agents. Use when modeling model abstraction, streaming semantics, tool-call normalization, retries, or fallback routing.
vasilyu1983 · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add vasilyu1983/AI-Agents-public --skill ai-coding-agents-provider-runtime技能说明
name: ai-coding-agents-provider-runtime description: "Designs provider runtimes for coding agents. Use when modeling model abstraction, streaming semantics, tool-call normalization, retries, or fallback routing." compatibility: Portable core. Works on Claude Code and Codex. version: "1.1" last_validated: 2026-07-11
AI Coding Agents Provider Runtime
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.
ASCII Flow
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
Quick Reference
| 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 |
When To Use
- 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
- Add retry, timeout, or fallback policy for model requests
- Decide how context windows and prompt-cache constraints affect runtime behavior
Use Other Skills
| 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 |
Default Workflow
- Define the provider contract. Keep request shape, streaming events, tool calls, usage accounting, and error taxonomy behind one internal interface.
- Normalize partial output. Providers stream differently, so convert them into one local event model before the rest of the runtime sees them.
- Separate capability from policy. A provider may support long context, prompt caching, or tool calls, but the runtime still decides when to use them.
- Model context-window behavior explicitly. Decide how truncation, summarization, replay, and prompt-cache constraints affect agent turns and resume flows.
- Separate task budget from token budget. Long-running coding loops often need a workflow or task budget independent of per-request token accounting.
- Classify retries and recoveries. Transport failure, rate limiting, provider timeout, malformed tool output,
max_output_tokens, and policy refusal should not share the same retry behavior. - Design fallback routing deliberately. Fallbacks should preserve semantics where possible and degrade visibly when they cannot.
- Track provider usage. Cost, token counts, cache hits, and latency should be attributable per provider and per turn.
- Test cross-provider parity. Ensure the same agent workflow behaves acceptably across supported providers, not only the default one.
Host Rules
- Keep one internal message and event model even when upstream providers differ.
- Normalize tool-call arguments and structured outputs before downstream handling.
- Preserve provider-specific capabilities as optional flags, not hard-coded assumptions.
- Do not collapse
max_output_tokensinto a generic model failure if the runtime supports bounded recovery or continuation prompts. - Make task-budget pressure and token-budget pressure visible as different runtime concerns.
- Make fallback routing observable to the user and to telemetry.
- Avoid silent semantic drift when a fallback model cannot match the primary provider’s behavior.
- Keep retry logic bounded and class-specific.
Scratch-Rebuild Coverage
- Coverage strength: strong for provider abstraction, stream normalization, class-specific retries, and visible fallback routing instead of pretending providers are interchangeable
- Missing for faithful reproduction:
task-budget handling distinct from token accounting, bounded
max_output_tokensrecovery, and explicit continuation or recovery-message patterns are still too implicit - Required additions:
document task-budget-versus-token-budget behavior,
max_output_tokensrecovery as its own failure class, and the telemetry fields needed to explain when