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
  • Stream
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 UiUtilsServerStream
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-sdkindexAgentServerAdapter
Interface●Since v1.9

AgentServerAdapter

Copy
interface AgentServerAdapter

Bases

TransportAdapter

Properties

Methods

Inherited fromTransportAdapter

Properties

PthreadId: string
—

Thread ID this transport is bound to.

Methods

Mclose→ Promise<void>
—

Shuts down the transport and releases any underlying resources.

Mevents→ AsyncIterable<Message>
—

Streams incoming protocol messages from the remote peer.

View source on GitHub
Mopen→ Promise<void>
—

Opens the underlying connection (e.g. WebSocket handshake).

MopenEventStream→ EventStreamHandle
—

Opens an independent filtered SSE event stream.

Msend→ Promise<void | ErrorResponse | CommandResponse>
—

Sends a command and optionally returns an immediate response.

property
threadId: string
method
close→ Promise<void>
method
events→ AsyncIterable<Message>
method
getHistory→ Promise<ThreadState<ValuesType>[]>
method
getState→ Promise<ThreadState<ValuesType>>
method
open→ Promise<void>
method
openEventStream→ EventStreamHandle
method
send→ Promise<void | ErrorResponse | CommandResponse>

Public v1 name for TransportAdapter plus optional high-level capabilities. Renamed to reflect that this interface now denotes the full agent-server protocol contract (not merely wire transport): any object that satisfies it can back a useStream call. See plan-custom-transport.md §4 for the rollout.

The extra optional methods let adapters surface thread state and history without the framework needing to issue a parallel HTTP request — useStream.hydrate() calls getState?() when present and falls back to client.threads.getState otherwise. Adapters that don't know how to produce these values can simply omit them.

The legacy TransportAdapter export is retained for back-compat and resolves to the same structural type; new code should prefer AgentServerAdapter.

Thread ID this transport is bound to.

Shuts down the transport and releases any underlying resources.

Streams incoming protocol messages from the remote peer. Used by WebSocket transports where all events share one connection.

Get all past states for a thread.

Get state for a thread.

Opens the underlying connection (e.g. WebSocket handshake). For HTTP/SSE transports this is a no-op.

Opens an independent filtered SSE event stream. Each call creates a new server connection with the given filter. Returns undefined when the transport does not support per-subscription streams (e.g. WebSocket), in which case the caller should fall back to command-based subscriptions over events.

Replay contract. Implementations MUST buffer events emitted for the thread/run and replay them through every newly-opened stream whose filter matches. The SDK's shared-stream rotation relies on this: when a subscription's filter widens the union, the SDK opens a fresh stream and expects to receive the run's full history from seq=0 (deduplication is handled client-side via event_id). The SDK also defers the open until after run.start has committed the thread server-side to avoid a 404: Thread not found, which means events emitted during that window MUST be delivered to the late opener. The protocol v2 server implements this via a bounded per-run replay buffer; custom adapters should mirror that.

Sends a command and optionally returns an immediate response.