Vercel AI SDK
A TypeScript toolkit for building AI features in web apps.
Unified model API, streaming text and structured output, tool calling and React hooks for chat UIs.
AI & agents
The AI SDK is a TypeScript toolkit focused on calling models, streaming to UIs and tool calling in web apps; LangChain is an agent framework with broad integrations, retrieval and agent harnesses in Python and TypeScript.
A TypeScript toolkit for building AI features in web apps.
Unified model API, streaming text and structured output, tool calling and React hooks for chat UIs.
An agent framework with standard interfaces to models, tools and retrieval.
create_agent with middleware, document loaders, vector stores and many integrations, in Python and TypeScript.
| Aspect | Vercel AI SDK | LangChain |
|---|---|---|
| Languages | TypeScript | Python and TypeScript |
| Focus | Model calls and streaming UI | Agents, retrieval, integrations |
| UI hooks | Yes (useChat) | No (bring your own) |
| Integrations | Model providers | Models, vector stores, loaders, tools |
| Best for | Chat and AI features in web apps | Agents and RAG pipelines |
The AI SDK is a TypeScript toolkit for calling models, streaming results to a UI and running tool calls inside web apps. LangChain is a broader agent framework in Python and TypeScript, with standard interfaces for models, tools, retrieval and many third-party integrations. One focuses on the app layer. The other focuses on agent and pipeline logic.
Choose the AI SDK when you are building chat or AI features in a TypeScript web app, such as Next.js, and need streaming to the browser with little code. It gives you a unified model API, structured output, tool calling and the useChat hook. It fits best when the AI logic is fairly direct and the UI experience matters most.
Choose LangChain when you need agents with middleware, retrieval pipelines, document loaders, vector store integrations or a Python backend. It also helps when you want LangGraph for durable, stateful orchestration and LangSmith for tracing. It suits backend-heavy systems where the UI is a separate concern.
Yes, and many teams do. A common split is LangChain or LangGraph on the backend for agent logic and retrieval, with the AI SDK on the frontend for streaming chat UI through useChat. The AI SDK ships a LangChain adapter that converts LangChain streams into its UI message stream format.
In the AI SDK, streamText returns a result you can turn directly into a UI message stream response, which useChat reads on the client. LangChain supports streaming tokens and agent steps through its stream methods, but you must wire the transport and client rendering yourself. So the AI SDK covers streaming from end to end, while LangChain covers only the server side.
The AI SDK defines tools with the tool() helper, a Zod or JSON schema and an execute function, and runs multi-step loops controlled by stopWhen. LangChain defines tools with its tool decorator or function and binds them to models or agents. LangChain also offers many prebuilt tool integrations. Both rely on the provider's native function calling underneath.
LangChain is usually better for RAG. It provides document loaders, text splitters, embedding wrappers, retrievers and many vector store integrations out of the box. The AI SDK offers embed and embedMany, but you build chunking, storage and retrieval yourself or with other libraries. That is fine for simple cases but means more work.
No. The AI SDK is open source and runs in any Node.js or compatible runtime, including other cloud platforms and self-hosted servers. Vercel offers an optional AI Gateway and hosting, but the SDK works with providers like OpenAI, Anthropic and Google directly through their provider packages.
The AI SDK supports agent loops through multi-step tool calling, and AI SDK 6 adds an Agent abstraction for reusable agents. LangChain v1 centres on create_agent, built on LangGraph, with middleware for summarisation, human approval and other behaviour. For complex, stateful or long-running agents, LangChain and LangGraph offer more built-in machinery.
The AI SDK is TypeScript only, so it fits teams with JavaScript backends and frontends. LangChain has both Python and TypeScript versions, and the Python one has the larger ecosystem. If your ML or data team works in Python, LangChain fits more naturally. If your whole stack is TypeScript, either works.
Practise every comparison in your dashboard.
Start learning