provider-abstraction

Defines boundaries for model-provider abstraction layers and opaque continuation state handling.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/dperussina/function2agent --skill provider-abstraction-dperussina
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: provider-abstraction
Source: https://github.com/dperussina/function2agent/tree/main/.cursor/skills/provider-abstraction
Command: npx skills add https://github.com/dperussina/function2agent --skill provider-abstraction-dperussina

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When building agents that work across Anthropic, OpenAI, Google, and xAI, teams must decide which API differences to normalize and which leak into core architecture. Getting this wrong causes silent degradation of multi-turn tool use, where dropped reasoning state produces worse agents with no visible error. ## Core Features & Use Cases - Two-tier design rule: Specifies a thin universal driver per provider with opinionated primitives on top, and enumerates which of 14 concerns are trivial to normalize versus which leak into core types. - Opaque continuation state contract: Provides a checklist for round-tripping provider-specific reasoning blobs (Anthropic thinking blocks, OpenAI reasoning items, Gemini thought signatures) without dropping, merging, or inspecting them. - Anti-pattern catalog: Documents measured failures of middleware frameworks like LiteLLM, hosted-tool normalization, and provider-specific budget units. - Use Case: When adding a second model provider to an agent system, use this Skill to decide what belongs in the adapter versus the core types, and to verify that opaque state survives serialization, checkpointing, and resume. ## Quick Start Ask the agent to review your provider adapter design against the provider-abstraction skill's normalize-versus-leaks table and opaque state checklist.

Frequently Asked Questions about provider-abstraction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a second model provider to my agent?▼

Write a thin driver per provider exposing send(messages, tools, opaque_state) and returning text, tool calls, opaque state, usage, and stop reason. Keep opinionated primitives in your own layer above it, and budget a few hundred lines per provider.

Should I use LiteLLM or an agent SDK as my abstraction layer?▼

The skill advises against middleware frameworks as your abstraction. A measured case showed a LiteLLM adapter under Google ADK referencing xAI's opaque reasoning field zero times, causing exactly the silent degradation the layer was adopted to prevent.

Why does multi-turn tool use degrade after switching providers?▼

Each provider requires round-tripping an opaque reasoning blob, and dropping it fails silently with no error. Store provider_state as an opaque field on every turn, never merge it across providers, and record provider identity so cross-provider resume is a detected error.

Can hosted tools be normalized into a unified tool interface?▼

No, hosted tool execution leaks hard and cannot be normalized across providers. Expose it as a per-provider capability flag, and if every tool call must be gated and auditable, either forbid hosted tools or accept explicit capability tiers.

Which provider should be the primary default for tool-centric agents?▼

For tool-centric, code-adjacent agent work, Anthropic is the recommended default due to deep MCP support, first-party context-management APIs, and well-documented harness reasoning. Budget for the refusal-and-fallback branch, which has no equivalent at the other labs.