Skip to main content

Provider Adapters

Drop-in adapters that wire CodeSpar sessions into your existing agent framework — Claude, OpenAI, Vercel AI SDK, LangChain, Mastra, and 7 more.

1 min read · updated

Provider Adapters

@codespar/sdkv0.3.0

CodeSpar ships a published adapter for every agent framework we've seen in production. Each one wires a CodeSpar Session into that framework's native tool-calling loop so you keep the framework's architecture, streaming, and state management — CodeSpar only adds the commerce tools.

// Two lines, any framework
const session = await codespar.create("user_123", { preset: "brazilian" });
const tools = adapter.tools(session);

LLM SDKs

Agent frameworks

Multi-agent frameworks

Protocol


What the adapters do

Every adapter does the same three things, translated into the framework's native shape:

  1. Tool discovery. adapter.tools(session) returns the session's tools (meta-tools + any server-specific tools) in the shape the framework expects — Tool[] for Claude, { name: fn } for LangChain, ZodSchema-backed for Vercel, etc.
  2. Tool execution. When the framework calls a tool, the adapter routes the call through session.execute(). Billing, audit, and multi-tenant isolation happen in the CodeSpar API — the adapter is a thin wrapper.
  3. Error mapping. CodeSpar's typed errors (needs_connection, insufficient_scope, provider_rate_limited) are mapped to whatever the framework expects so retries and fallbacks keep working.

The adapters are optional. If your framework isn't listed, you can use session.execute() directly — see Build Your Own Adapter.

Picking an adapter

Most teams pick based on what they already have.

You haveUse
An existing Claude appClaude adapter
An existing OpenAI appOpenAI adapter
A Vercel AI SDK frontendVercel adapter
Python + LangChainLangChain adapter
A multi-agent crewCrewAI / AutoGen
Claude Desktop / Cursor / ContinueMCP
Starting freshClaude adapter or Vercel adapter

Next steps

Edit on GitHub

Last updated on