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.0CodeSpar 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:
- 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. - 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. - 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 have | Use |
|---|---|
| An existing Claude app | Claude adapter |
| An existing OpenAI app | OpenAI adapter |
| A Vercel AI SDK frontend | Vercel adapter |
| Python + LangChain | LangChain adapter |
| A multi-agent crew | CrewAI / AutoGen |
| Claude Desktop / Cursor / Continue | MCP |
| Starting fresh | Claude adapter or Vercel adapter |
Next steps
Edit on GitHub
Last updated on