Skip to main content
The following pages provide reference implementations for running LangChain agents in production on JavaScript frameworks and hosting platforms. Each example in the deployment cookbook repository is a full-stack chat app with streaming UI, subagents, and thread history, deployed on a different platform using the same Agent Streaming Protocol. Use these guides when you need to ship an agent-backed product: copy the stack that matches your hosting environment, swap in your own tools and models, and upgrade persistence when you move beyond a single instance.

Examples

Pair with LangSmith Deployment

The agent runs as a LangSmith Deployment, and a separate web app streams from the Agent Server API.
https://mintcdn.com/langchain-5e9cc07a-preview-opensw-1783454697-4d4e2b4/96syU4wCbJ5oNlH9/images/providers/light/langchain.svg?fit=max&auto=format&n=96syU4wCbJ5oNlH9&q=85&s=6837257628f328fdc3fbe551123957d4

LangSmith + Vite

Agent graph on LangSmith Deployment; Vite + React UI streams from the Agent Server API.

Embed in your web framework

The agent runs inside the framework’s route handlers and ships as one deployable app to the host platform.
https://mintcdn.com/langchain-5e9cc07a-preview-opensw-1783454697-4d4e2b4/96syU4wCbJ5oNlH9/images/providers/light/nextjs.svg?fit=max&auto=format&n=96syU4wCbJ5oNlH9&q=85&s=e449f2690cc9225a41de4d0b9272d2c8

Next.js

App Router route handlers implement the protocol under /api/threads/.... Deploy to Vercel with one click.
https://mintcdn.com/langchain-5e9cc07a-preview-opensw-1783454697-4d4e2b4/96syU4wCbJ5oNlH9/images/providers/light/svelte.svg?fit=max&auto=format&n=96syU4wCbJ5oNlH9&q=85&s=0ec0f52ba41114853542db88e91ebc84

SvelteKit

SvelteKit server routes on Cloudflare Workers with @langchain/svelte and per-thread Durable Objects for SSE replay.
https://mintcdn.com/langchain-5e9cc07a-preview-opensw-1783454697-4d4e2b4/96syU4wCbJ5oNlH9/images/providers/light/nuxt.svg?fit=max&auto=format&n=96syU4wCbJ5oNlH9&q=85&s=ac1d7388bf43626b151b2340bd13f84c

Nuxt

Nitro route handlers and @langchain/vue composables in a single deployable Nuxt 4 app.
https://mintcdn.com/langchain-5e9cc07a-preview-opensw-1783454697-4d4e2b4/96syU4wCbJ5oNlH9/images/providers/light/cloudflare.svg?fit=max&auto=format&n=96syU4wCbJ5oNlH9&q=85&s=6b572eb3a3c86eb407a5ae871c51fa32

Cloudflare Workers

Vite + React SPA and Hono API on one Worker with Workers Assets and Durable Objects.
https://mintcdn.com/langchain-5e9cc07a-preview-opensw-1783454697-4d4e2b4/96syU4wCbJ5oNlH9/images/providers/light/deno.svg?fit=max&auto=format&n=96syU4wCbJ5oNlH9&q=85&s=8516fef1355d8348b1227d4af72f8101

Deno Deploy

Deno.serve + Hono serves the protocol API and a Vite-built React SPA from one entrypoint.
Each cookbook example shares the same demo agent: a coordinator that delegates to researcher and math-whiz subagents with mock tools, so you can compare hosting choices without changing application behavior.

What goes into an agent deployment

Every example follows the same shape. The framework and hosting change; the responsibilities do not.

Agent runtime

The agent itself, typically a LangGraph graph or deepagents coordinator, with tools, optional subagents, and middleware. It is compiled with a checkpointer so conversation state survives across turns. Examples start with an in-memory MemorySaver for simplicity; production deployments swap in Redis (@langchain/langgraph-checkpoint-redis), Postgres (@langchain/langgraph-checkpoint-postgres), SQLite (@langchain/langgraph-checkpoint-sqlite), or platform-specific storage.

Protocol server

HTTP route handlers implement the Agent Streaming Protocol under /api/threads/....

Minimum (streaming chat)

These three endpoints are enough to run a single-threaded streaming chat with HttpAgentServerAdapter:
MethodPathPurpose
POST/api/threads/:threadId/commandsAccept commands (run.start, …) and start runs
POST/api/threads/:threadId/streamSSE stream of protocol events for a run
GET / POST/api/threads/:threadId/stateRead and bootstrap checkpointed thread state

Thread sidebar (all examples)

Every example also implements endpoints for the thread-history sidebar:
MethodPathPurpose
GET/api/threadsList threads known to the checkpointer
DELETE/api/threads/:threadIdDelete a thread’s session and checkpoints
POST/api/threads/:threadId/historyPaginated checkpoint history

Session and run management

Server-side logic tracks active runs, bridges commands to the agent, and fans out live events over SSE. A registry or session store lets clients reconnect to in-flight streams. On serverless or multi-instance hosts, this layer must be shared or colocated with the checkpointer.

Chat frontend

A browser UI wired to the protocol through HttpAgentServerAdapter, from @langchain/react, @langchain/vue, @langchain/svelte, or @langchain/angular. The client bootstraps thread state, submits messages, consumes the SSE stream, and renders tokens, tool calls, reasoning, and subagent activity. These bindings ship no components of their own. Hooks like useStream return plain reactive state (messages, tool calls, loading flags, thread metadata) that you wire to whatever visual layer you prefer. For adapter patterns and trade-offs, see the frontend integrations overview.

See also