js-nuxt in the deployment cookbook.
Deploy
- Vercel
- Netlify
- Node
1
Import the repository
Click Deploy with Vercel below, or import 
langchain-ai/deployment-cookbook manually.2
Configure the project
Set Root Directory to
js-nuxt and add OPENAI_API_KEY in project settings.3
Deploy
Deploy the project. Nuxt detects Vercel automatically and builds Nitro server routes for the Agent Streaming Protocol API.
Required API endpoints
The app exposes the Agent Streaming Protocol under/api/threads/.... Nitro route handlers live in server/api/threads/.
Minimum (streaming chat)
These three endpoints are enough to run a single-threaded streaming chat with@langchain/vue’s HttpAgentServerAdapter:
The client bootstraps a thread with
GET /state (and POST /state on 404) so hydration does not 404 before the first message is sent.
Optional (thread sidebar)
This example also implements endpoints for the thread-history sidebar. Omit them if your UI does not need multi-thread management:Request flow
- Bootstrap thread state (
GET/POST /state). - On submit, the SDK sends
run.startto/commandsand receives arun_id. - The SDK subscribes to
/stream(SSE) for replay + live protocol events. - Subagent (
task) runs emit namespaced events surfaced asstream.subagents.
Nitro backend design
The agent’s checkpointer is the single source of truth for threads. There is no client-side cache: the sidebar is always fetched from the server, and restarting the server clears every thread.
Production persistence
Out of the box, the agent uses an in-memoryMemorySaver checkpointer (server/agent/index.ts) and a process-local session map (server/utils/runtime.ts). That works for local dev and single-instance servers, but on serverless or multi-instance hosts conversation state is not durable across cold starts or replicas.
For production, swap in a durable checkpointer:
Replace
MemorySaver in server/agent/index.ts and pass the new checkpointer to createDeepAgent. The Nitro route handlers and server/utils/threads.ts helpers stay the same.
You will also want a shared session/replay store in server/utils/runtime.ts so SSE reconnection works across serverless invocations.
For more information, see checkpointer libraries and add memory / persistence.
Local development
Project layout
Project structure
Project structure
server/agent/— deep agent (createDeepAgent) withresearcherandmath-whizsubagents, mock tools, andstripReasoningReplaymiddleware.server/utils/— protocol server logic:session.ts(SSE runs),threads.ts(checkpointer-backed state),serialize.ts,runtime.ts.server/api/threads/— Nitro route handlers for the protocol endpoints above.app/components/— Vue chat UI (ChatApp,Chat,ThreadHistory,SubagentList,MessageReasoning, …) using@langchain/vue.app/utils/threads.ts— server-driven thread helpers and LangGraph SDK bootstrap.
Backend details
Backend details
server/agent/index.ts— coordinator uses a reasoning model over the Responses API; tool-using subagents use chat-completions (to avoid reasoning item replay through the checkpointer).server/agent/middleware.ts— rebuilds prior assistant messages fromcontent+tool_callsso stale reasoning ids are never replayed to the Responses API.server/utils/session.ts—LocalThreadSessionbuffers protocol events and fans matching frames out over SSE viamatchesSubscription.server/api/threads/index.get.ts—GET /api/threads, the checkpointer-backed thread list.server/api/threads/[threadId]/…— handlers forcommands,stream,state(GET/POST),history, andDELETE.
Frontend details
Frontend details
app/components/ChatThread.vue— builds theHttpAgentServerAdapterand callsprovideStream({ transport, threadId }).app/components/Chat.vue— message view with composer and per-subagent detail view (with breadcrumb).app/components/SubagentList.vue/SubagentDetail.vue— inline subagent cards and scoped subagent chat (useMessagesbound to namespace).app/components/MessageReasoning.vue— collapsible “Thinking” block for reasoning summaries.
See also
- Frameworks and platforms overview
- Agent Streaming Protocol
react-custom-backend— original Vite + Hono reference for a custom protocol server@langchain/vue—useStream,provideStream, and selector composables- Frontend overview
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

