LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Getting started
  • useStream
  • Selectors
  • Interrupts & headless tools
  • Subagents & subgraphs
  • Fork & edit from a checkpoint
  • Submission queue
  • Multimodal media
  • Transports
  • Suspense
  • provideStream & context
  • Type safety
  • Migrating to v1
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewGetting starteduseStreamSelectorsInterrupts & headless toolsSubagents & subgraphsFork & edit from a checkpointSubmission queueMultimodal mediaTransportsSuspenseprovideStream & contextType safetyMigrating to v1
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/vueUseStreamReturnrespond
Method●Since v1.0

respond

Resume a pending protocol interrupt by sending a response payload back to the interrupted namespace.

When options.interruptId is omitted, walks getThread()?.interrupts from newest to oldest and resumes the first not yet resolved by a prior respond() call. That may be a root or subgraph interrupt and is not necessarily interrupt (interrupts[0], root-only). Safe when exactly one interrupt is pending; otherwise pass an explicit options.interruptId (and options.namespace for subgraph interrupts).

The server validates namespace against the pending interrupt. Root interrupts use namespace: [] (default when omitted). For subgraph interrupts, copy namespace from getThread()?.interrupts.

Pass options.update (and/or options.goto) to apply a state update (and/or directed jump) in the same superstep as the resume — mapped to LangGraph's Command(resume, update, goto). The resumed run produces a single checkpoint reflecting both, so a HITL card can push its message into state at the moment it answers the interrupt (no separate state write, no intermediate checkpoint, no flicker). Messages may be plain dicts or @langchain/core BaseMessage instances (serialized like submit()).

Copy
respond(response: unknown, options: StreamRespondOptions<ConfigurableType>): Promise<void>

Parameters

NameTypeDescription
response*unknown
optionsStreamRespondOptions<ConfigurableType>

Example 1

Copy
// Single pending interrupt
await stream.respond({ approved: true });

Example 2

Copy
// Resolve the interrupt AND push the card's message into state atomically
await stream.respond({ approved: true }, {
  update: { messages: [{ type: "ai", content: "Approved by reviewer." }] },
});

Example 3

Copy
// `update` also accepts BaseMessage instances, like `submit()`
import { AIMessage } from "@langchain/core/messages";
await stream.respond({ approved: true }, {
  update: { messages: [new AIMessage("Approved by reviewer.")] },
});

Example 4

Copy
// Multiple root interrupts
for (const intr of stream.interrupts.value) {
  await stream.respond(decide(intr.value), { interruptId: intr.id! });
}

Example 5

Copy
// Subgraph interrupt — namespace from `getThread()`
const thread = stream.getThread();
for (const entry of thread?.interrupts ?? []) {
  await stream.respond(buildResponse(entry.payload), {
    interruptId: entry.interruptId,
    namespace: entry.namespace,
  });
}
View source on GitHub