LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
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

LangGraph
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
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/langgraph-sdkuiStreamManagerfetchSubagentHistory
Method●Since v1.7

fetchSubagentHistory

Fetch and restore internal messages for reconstructed subagents from their subgraph checkpoints. Should be called after reconstructSubagents to restore the full subagent conversation after a page refresh.

Subagent messages are persisted in the LangGraph checkpointer under a subgraph-specific checkpoint_ns (e.g. tools:<uuid>). This method discovers the correct namespace by inspecting the main thread's intermediate history checkpoints, where each pending task's checkpoint.checkpoint_ns identifies the subgraph. Tasks are matched to tool calls by their Send index (task.path[1]), which corresponds to the order of tool calls in the AI message — no deepagent-specific metadata required.

Copy
fetchSubagentHistory(
  threads: __type,
  threadId: string,
  options: __type
): Promise<void>

Parameters

NameTypeDescription
threads*__type

Client with a getHistory method (e.g. client.threads)

threadId*string

The parent thread ID

options__type

Optional configuration

View source on GitHub