Picking between LangChain JavaScript (JS), the Vercel AI software development kit (SDK), and the OpenAI SDK is one of the first decisions you make when adding artificial intelligence (AI) features to a JavaScript application, and it is easy to get wrong because the three tools occupy different layers of the stack.
Key differences include agents, retrieval-augmented generation (RAG), which grounds model responses in your own documents, streaming, edge compatibility, adoption, and Model Context Protocol (MCP) support, an open standard for connecting AI agents to external tools and data. Edge runtimes are lightweight execution environments designed to run code closer to users. LangChain 1.0, Vercel AI SDK 7, and OpenAI SDK 7 shipped recently, and several long-standing assumptions about them no longer hold.
In brief:
- LangChain JS (v1.5.10) is the orchestration layer:
LangChain createAgent, built-in middleware, and compositional RAG. Its core packages now run in edge environments; somefs-dependent integrations remain Node-only. - Vercel AI SDK (v7) is the model and user interface (UI) toolkit:
useChat,ToolLoopAgent, and 44 first-party providers. Version 7 uses ECMAScript modules (ESM) only and requires Node.js runtime 22+. - OpenAI SDK (v7.5.0) has the widest adoption at roughly 29 million weekly Node Package Manager (npm) downloads. The companion
@openai/agentspackage adds a built-in agent loop, replacing the need to write manual agent loops. - You can combine them in one stack: an official
@ai-sdk/langchainadapter bridges LangChain streams into AI SDK UIs, while LangChain, Vercel AI SDK, and OpenAI Agents SDK now support MCP.
LangChain vs Vercel AI SDK vs OpenAI SDK at a glance
| Feature | LangChain JS | Vercel AI SDK | OpenAI SDK |
|---|---|---|---|
| Current version | LangChain 1.5.10 | AI SDK 7.0.74 | OpenAI SDK 7.5.0 |
| Weekly npm downloads | ~2.4M downloads | ~18.5M downloads | ~29M downloads |
| GitHub stars | ~18.1k stars | ~26.3k stars | ~11.1k stars |
| Node.js requirement | 20.x–24.x | 22+ (ESM-only) | 22+ |
| Provider integrations | ~27 chat models | 44 first-party, 50+ community | OpenAI compatibility |
| Edge runtime | ✅ Core supported; fs-based integrations excluded | ✅ Supported | ✅ Supported since v4 |
| Agent loop | ✅ createAgent | ✅ ToolLoopAgent | ✅ via @openai/agents |
| RAG | Compositional building blocks | Embedding primitives + adapters | Managed file_search or manual |
Version and adoption figures come from the official package and repository pages. The AI SDK comparison examines the bottom rows in more detail.
The OpenAI SDK is a provider client, while the Vercel AI SDK combines model abstraction with a UI toolkit. LangChain handles orchestration and retrieval. You can also combine them; the LangChain stream adapter converts LangChain and LangGraph streams into AI SDK UIMessageStream objects for rendering with useChat.
What each SDK does best
LangChain JS: orchestration and retrieval
LangChain 1.0 reached GA in October 2025, and the current API centers on createAgent. The older createReactAgent from @langchain/langgraph uses a deprecated agent API, so if you are following pre-2026 tutorials, you may need to translate.
import { createAgent, tool } from "langchain";
import * as z from "zod";
const getWeather = tool(({ city }) => `It's always sunny in ${city}!`, {
name: "get_weather",
description: "Get the weather for a given city",
schema: z.object({ city: z.string() }),
});
const agent = createAgent({
model: "google-genai:gemini-3.6-flash",
tools: [getWeather],
});The middleware system includes tool retry, model fallback, summarization, personally identifiable information (PII) detection, and human-in-the-loop as built-in middleware. The official guidance since the 1.0 release: follow LangChain orchestration docs. Multi-agent patterns come from separate packages such as the LangGraph supervisor.
An AI FAQ tutorial and a ChatGPT clone tutorial provide working examples with a content management system (CMS) backend.
Vercel AI SDK: streaming UI and provider abstraction
Version 7 shipped in June 2026 with real breaking changes. The v7 migration guide covers ESM-only distribution, Node.js 22+, system renamed to instructions, and onFinish renamed to onEnd.
If you are upgrading from v5 or earlier, you will also need to account for maxSteps becoming stopWhen per the v5 migration guide, and generateObject/streamObject being deprecated in v6 in favor of generateText with an output setting per the v6 migration guide.
The UI layer remains the SDK's strongest argument. The current useChat uses a transport-based architecture:
'use client';
import { useChat } from '@ai-sdk/react';
import { DefaultChatTransport } from 'ai';
const { messages, sendMessage, status } = useChat({
transport: new DefaultChatTransport({ api: '/api/chat' }),
});Messages render through the parts property, which handles text, tool invocations, and tool results, and status exposes four states: 'submitted', 'streaming', 'ready', and 'error' (chatbot docs). An AI chatbot tutorial shows this pattern against a real content API, and a Strapi plugin tutorial covers integrating the Vercel AI SDK into a Next.js 16 project.
The providers page lists 44 first-party providers, including audio and transcription services such as ElevenLabs, Deepgram, and AssemblyAI, plus 50+ community providers. Switching providers means changing a model identifier while streaming and tool-calling code stays put, and createProviderRegistry supports failover.
OpenAI SDK and the Agents SDK: direct access with real primitives
The core openai package is the direct provider layer: typed API access to OpenAI Responses and Chat Completions, with around 29 million weekly downloads, roughly 12x LangChain's count. OpenAI recommends the Responses API for new integrations; it streams typed events (response.created, response.output_text.delta, response.completed) rather than raw delta chunks:
const stream = await openai.responses.create({
model: 'gpt-5.1',
input: [{ role: 'user', content: 'Say "double bubble bath" ten times fast.' }],
stream: true,
});Consider the gpt-5.1 model for new code; gpt-5 and o3 have deprecated status.
OpenAI describes @openai/agents (Agents SDK v0.17.0) as a production-ready, lightweight package designed to build agentic AI apps. It includes what its docs call a large language model (LLM) workflow: a built-in agent loop that handles tool invocation, sends results back to the LLM, and continues until the task is complete.
The package also includes handoffs between agents, input and output guardrails, sessions, built-in tracing, and voice agents. One caveat: the 0.Y.Z versioning signals the SDK is still evolving rapidly per its own release docs, so pinning versions carefully helps.
Agents and human-in-the-loop compared
Each SDK now ships an agent abstraction, and the meaningful differences are in loop control and approval workflows.
LangChain JS handles approvals through human-in-the-loop middleware: an interruptOn policy pauses on designated tool calls and supports 'approve', 'edit', 'reject', and 'respond' decisions. A checkpointer is required to persist state across interrupts.
Vercel AI SDK recommends ToolLoopAgent for agent loops, with stopWhen and a default of isStepCount(20) per the v6 migration docs for loop control. Approvals now go through toolApproval; the older needsApproval flag is deprecated. For long-running work, WorkflowAgent provides durable execution where human approval survives suspension.
OpenAI Agents SDK runs its loop through run() with a default maxTurns of 10, models multi-agent coordination as handoff tools (for example, transfer_to_refund_agent), and lists human-in-the-loop among its built-in features.
If you need checkpointed graph resumption, LangGraph.js provides it.
RAG: compositional, adapter-based, or managed
LangChain JS stays compositional: document loaders, text splitters (RecursiveCharacterTextSplitter is the recommended default), embeddings, vector stores, and retrievers assemble into pipelines, with createRetrievalChain available via @langchain/classic (retrieval docs). This gives the most control over chunking and retrieval strategy at the cost of assembly work.
Vercel AI SDK provides embed() and embedMany() primitives and a middleware pattern for injecting retrieved context, but no built-in vector-store adapter layer. You bring your own store; this vector database guide compares Pinecone, Qdrant, Pgvector, and others.
OpenAI provides managed RAG. The Responses API file_search tool is managed by OpenAI and handles automatic execution, retrieval, and output generation, with uploaded files automatically chunked (800 tokens by default, 400 overlap) and embedded. That is the fastest path when your documents live in OpenAI's vector stores; custom pipelines remain possible through the lower-level Retrieval API. The Strapi RAG tutorial covers a self-managed approach.
Edge runtime compatibility: the old advice is wrong
Two claims that circulated widely, including in the earlier version of this article, are now false.
First, LangChain JS supports edge runtimes at the core. The GitHub issue that documented the blocker was closed in April 2023, and LangChain's environments announcement confirmed support for Cloudflare Workers, Vercel/Next.js edge, Deno, and Supabase Edge Functions. The surviving caveat is integration-level: packages that touch the filesystem, such as the HNSWLib vector-store integration, remain Node-only. Cloudflare has softened even that; Workers with recent compatibility dates support virtual node:fs.
Second, the openai-edge workaround is obsolete. The official OpenAI SDK has used fetch since v4.0.0 in 2023, and its npm page declares itself redundant. Current runtime support covers Node.js 22–24, Deno, Bun, Cloudflare Workers, and Vercel Edge Runtime.
The Vercel AI SDK works across supported runtimes via ReadableStream, and Cloudflare maintains an official Workers AI provider.
Platform changes add another constraint. In Next.js 16.3, runtime = 'edge' is no longer supported in the App Router; routes run on Node.js by default, while Edge Functions persist outside Next.js. Vercel's Fluid Compute, the default for new projects, gives functions a five-minute default duration, which matters for long streaming responses. Vercel reports near-zero cold starts for 99.37% of requests under Fluid Compute.
Node.js 22 and adoption signals
Runtime requirements tightened together: OpenAI SDK v7 and Vercel AI SDK v7 both require Node.js 22, with the OpenAI changelog noting that Node 20 hit EOL in April 2026, and AI SDK v7 dropped CommonJS entirely. LangChain JS supports Node 20.x–24.x. If your deployment target pins an older Node version, that alone narrows your options.
On adoption, weekly npm downloads run roughly 29M for openai, 18.5M for ai, and 2.4M for langchain, while GitHub stars flip the order: vercel/ai at ~26.3k, langchain-ai/langchainjs at ~18.1k, openai/openai-node at ~11.1k.
MCP support is now a selection criterion
The Model Context Protocol, an open standard for connecting AI agents to external tools and data, updated on 2026-07-28 to remove protocol sessions.
Vercel AI SDK offers MCP tool support, recommending Streamable Hypertext Transfer Protocol (HTTP) for production and stdio for local development only. It does not yet accept notifications from an MCP server.
LangChain JS ships @langchain/mcp-adapters with a MultiServerMCPClient that is stateless by default and creates a fresh session per invocation.
OpenAI Agents SDK supports MCP transports through the Responses API, plus Streamable HTTP and stdio; Server-Sent Events (SSE) is deprecated.
This matters for CMS-backed AI work because the Strapi MCP server, now in general availability (GA) with the Strapi MCP GA release, is free on any plan for Strapi v5.49.0+. It exposes create, read, update, and delete (CRUD), publish, and unpublish operations as agent tools, and it is opt-in: the MCP server is off by default and requires an Admin token, per the MCP server docs. A practical Claude Code walkthrough covers schema work and test-data generation.
Which AI SDK should you choose?
Start with the primary layer your application needs, then check runtime and provider constraints before adding another SDK.
Streaming chat UI in Next.js, React, Vue, or Svelte? Vercel AI SDK. useChat plus a transport handles connection management and rendering state, and 44 first-party providers keep model choice open.
Choose LangChain JS for multi-step orchestration, custom retrieval pipelines, or checkpointed multi-agent graphs. Use LangGraph.js when you need durable interrupts or supervisor patterns.
Choose the OpenAI SDK for OpenAI-only applications or managed RAG through file_search. Add @openai/agents when you need loops, handoffs, or guardrails without a broader orchestration framework.
Edge deployment? LangChain JS, Vercel AI SDK, and OpenAI SDK all qualify; check individual LangChain integrations for fs dependencies and confirm your platform's current edge runtime story rather than assuming App Router edge routes still work.
For a deeper look at how AI and headless CMS architectures work together, or a broader SDK usage guide, the Strapi blog covers both.
Pairing your AI framework with a Strapi backend
If your AI feature relies on managed content, Strapi, a headless CMS, can keep structured content and a headless backend independent of your framework choice. Strapi's architecture uses Representational State Transfer (REST) to generate REST API endpoints for each Content-Type by default, but Content API permissions are private by default and require configuration or authentication. Strapi 5 responses are flattened, and documents are addressed by documentId. GraphQL requires installing the @strapi/plugin-graphql plugin; this REST vs GraphQL guide covers when each fits an AI retrieval pipeline.
Strapi keeps structured content behind standard APIs or exposes it through the MCP server, so the content backend remains independent of the SDK that drives your agents. If you want to deploy your own Strapi instance, the Vercel integration page covers that path.





