
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@agentskit/adapters
Advanced tools
Profile: major-package
Connect to any LLM provider — and swap between them — without touching your app code.
Tags: ai · agents · llm · agentskit · openai · anthropic · claude · gemini · chatgpt · ollama · embeddings · providers
packages/adapters/.@agentskit/adapters is the provider layer: swap OpenAI, Anthropic, Gemini, Ollama, local models, and embedding providers without rewriting your agent.
Docs: package guide · agent handoff
ReadableStreamollama({ model: 'llama3.1' }) for fully offline agents with no API key requirednpm install @agentskit/adapters
import { anthropic } from '@agentskit/adapters'
import { createRuntime } from '@agentskit/runtime'
// Switch provider by swapping one import
const adapter = anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, model: 'claude-sonnet-4-6' })
// const adapter = openai({ apiKey: process.env.OPENAI_API_KEY, model: 'gpt-4o' })
// const adapter = ollama({ model: 'llama3.1' })
const runtime = createRuntime({ adapter })
const result = await runtime.run('Summarize the latest AI news')
console.log(result.content)
Use the same package for vector embeddings — wire openaiEmbedder, geminiEmbedder, or ollamaEmbedder into @agentskit/rag:
import { openaiEmbedder } from '@agentskit/adapters'
import { createRAG } from '@agentskit/rag'
import { fileVectorMemory } from '@agentskit/memory'
const rag = createRAG({
embed: openaiEmbedder({ apiKey: process.env.OPENAI_API_KEY! }),
store: fileVectorMemory({ path: './vectors' }),
})
ReadableStreamopenaiEmbedder, geminiEmbedder, ollamaEmbedder, deepseekEmbedder, grokEmbedder, kimiEmbedder, createOpenAICompatibleEmbedderAdapter contract v1 suite (ADR 0001); SDK-backed adapters have provider-specific contract and resilience coveragecreateAdapter()createRouter (cost/latency/classifier), createEnsembleAdapter (fan-out + merge), createFallbackAdapter (ordered try-next)done or error; terminal errors carry an Error in metadata.error.abort(reason) propagates to active fetch readers and SDK requests and terminates with the same error semantics.vercelAI consumes the Vercel AI SDK UI message stream v1 protocol, including its required response header and [DONE] marker.import { createRouter, anthropic, openai } from '@agentskit/adapters'
// Auto-pick cheapest capable candidate per request.
const router = createRouter({
candidates: [
{ id: 'haiku', adapter: anthropic({ model: 'claude-haiku-4-5' }), cost: 0.25 },
{ id: 'sonnet', adapter: anthropic({ model: 'claude-sonnet-4-6' }), cost: 3 },
{ id: 'gpt-mini', adapter: openai({ model: 'gpt-4o-mini' }), cost: 0.15 },
],
})
See Adapter router, Ensemble, and Fallback chain.
| Package | Role |
|---|---|
| @agentskit/core | Adapter, EmbedFn, types |
| @agentskit/runtime | Headless createRuntime |
| @agentskit/rag | createRAG + embedders |
| @agentskit/memory | Vector + chat memory backends |
Three built-in utilities let you test agents without hitting a real LLM.
mockAdapter — deterministic responsesimport { mockAdapter } from '@agentskit/adapters'
const adapter = mockAdapter({
response: [
{ type: 'text', content: 'Hello!' },
{ type: 'done' },
],
})
Pass a function to make responses request-aware, or pass an array of arrays to return different chunks on each call (sequenced mode). Use the optional history array to capture every request for assertions.
recordingAdapter + inMemorySink — capture real callsimport { recordingAdapter, inMemorySink, anthropic } from '@agentskit/adapters'
const sink = inMemorySink()
const adapter = recordingAdapter(
anthropic({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-6' }),
sink,
)
// Runs the real LLM and captures every chunk to sink.fixture
replayAdapter — replay captured fixturesimport { replayAdapter } from '@agentskit/adapters'
import fixture from './fixture.json'
const adapter = replayAdapter(fixture) // no network calls
Typical workflow: record once in dev → commit JSON fixture → replay in CI.
MIT — see LICENSE.
@agentskit/adaptersSee CONTRIBUTING.md and the monorepo LICENSE.
FAQs
Provider adapters for AgentsKit.
The npm package @agentskit/adapters receives a total of 701 weekly downloads. As such, @agentskit/adapters popularity was classified as not popular.
We found that @agentskit/adapters demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.