@threadplane/langgraphInterfacev0.3.7

SessionOptions

What createSession takes: the assistant, the thread and how to reach the backend.

import type { SessionOptions } from '@threadplane/langgraph';

Declaration

export interface SessionOptions  {
  readonly a2uiClientCapabilities?: A2uiClientCapabilities;
  readonly apiUrl?: string;
  readonly assistantId: string;
  readonly autoLoad?: boolean;
  readonly clientOptions?: LangGraphClientOptions;
  readonly continuationPolicy?: ClientToolContinuationPolicy;
  readonly developmentRuntime?: LangGraphDevelopmentRuntime | LangGraphDevelopmentRuntimeFactory;
  readonly devtools?: LangGraphDevtoolsSink;
  readonly executionStore?: ToolExecutionStore;
  readonly historyState?: boolean;
  readonly initialValues?: Readonly<Record<string, PlainValue>>;
  readonly onThreadId?: (threadId: string) => void;
  readonly rawMessages?: boolean;
  readonly restoreSubagents?: boolean;
  readonly scriptedRuns?: LangGraphScriptedRuns;
  readonly stateType?: StateDeclaration;
  readonly subagentToolNames?: readonly string[];
  readonly telemetry?: LangGraphTelemetrySink | false;
  readonly threadId?: string | null;
  readonly throttle?: number | false;
  readonly toMessage?: (message: unknown) => unknown;
  readonly transcriptNodeNames?: readonly string[];
  readonly transport?: AgentTransport;
}

Members

a2uiClientCapabilities

Generated UI capabilities to advertise to the graph. They are sent with every run that has input, under the a2ui_client_capabilities state key.

readonly a2uiClientCapabilities?: A2uiClientCapabilities;

apiUrl

The LangGraph API base the owned SDK transport calls. A supplied transport ignores it.

readonly apiUrl?: string;

assistantId

The assistant, or graph name, each run is created for.

readonly assistantId: string;

autoLoad

Read the thread's history as soon as the session is created, when it has a threadId and the transport can read history. snapshot.loading is then published while any history read is in flight, and a failed automatic read is published as an error. Omitted, creating a session makes no request.

readonly autoLoad?: boolean;

clientOptions

The owned SDK transport defaults maxRetries to 0: an ambiguous failed run-creation POST must not silently create another run. A supplied numeric maxRetries explicitly opts into SDK request retries. Custom transports own their retry policy; joining a known run is separate from replaying submit.

readonly clientOptions?: LangGraphClientOptions;

continuationPolicy

How many consecutive client-tool groups one submit runs automatically (default 10; 0 removes the limit). A blocked group's calls settle with a limit error and the run ends without another request.

readonly continuationPolicy?: ClientToolContinuationPolicy;

developmentRuntime

A development-install collector to keep informed, or a factory that builds one from what this package knows of its own installation. The host owns the collector; the session only calls it.

devtools

A development tool told which published fields each event changed.

readonly devtools?: LangGraphDevtoolsSink;

executionStore

Where client-tool executions are recorded, for a session created with tools.

readonly executionStore?: ToolExecutionStore;

historyState

Keep each loaded checkpoint's state. snapshot.checkpoints, snapshot.messageCheckpoints and snapshot.branchTree are then published from every history page, and the page is read again after each run that ends in success or a pause. snapshot.checkpoints is an empty list until the first page is read. Omitted, the states are not kept: a page's states can be large, and a session otherwise keeps only checkpoint metadata in snapshot.history.

readonly historyState?: boolean;

initialValues

The state snapshot.state holds until the backend reports one. It is published as given, without the stateType check, and never sent.

readonly initialValues?: Readonly<Record<string, PlainValue>>;

onThreadId

Called once with the id of the thread this session created. Never called when threadId is given. A throwing callback does not affect the run.

readonly onThreadId?: (threadId: string) => void;

rawMessages

Keep each message as LangGraph sent it. snapshot.langGraphMessages and snapshot.messageMetadata are then published. Omitted, they are not kept: the records are large and most views need only the transcript.

readonly rawMessages?: boolean;

restoreSubagents

Rebuild the tool-started child agents from the saved thread when history is loaded: their relation and status from the root's history, and their transcripts through transport.getChildState. Omitted, a history load publishes no child, as no child event replays.

readonly restoreSubagents?: boolean;

scriptedRuns

Development only: a source of scripted runs that stand in for the network.

readonly scriptedRuns?: LangGraphScriptedRuns;

stateType

The graph state's type: type<T>() to declare it, or a Standard Schema, such as a Zod object, to also check each state the backend reports. A state the schema rejects is withheld and described in snapshot.stateIssues.

readonly stateType?: StateDeclaration;

subagentToolNames

Names of the root tools that start a child agent; ['task'] when omitted. A child graph started by such a call, whose arguments carry a subagent_type, is related to it: see LangGraphSubgraph.delegation. Pass an empty list to relate nothing.

readonly subagentToolNames?: readonly string[];

telemetry

Receives the session's runtime telemetry events. false is the same as omitting it.

readonly telemetry?: LangGraphTelemetrySink | false;

threadId

The thread this session belongs to. Omit it, or pass null, to start an empty session that creates its thread on the first submit. That requires transport.createThread, which the owned SDK transport provides.

readonly threadId?: string | null;

throttle

The least time, in milliseconds, between two calls to a subscribe listener while a run streams. The snapshot is never delayed, the last change is always delivered, and a change that ends the run is delivered at once. Off when omitted, false or 0.

readonly throttle?: number | false;

toMessage

Converts each wire message, from a stream event or a saved checkpoint, of the root graph or a child, before the session reads it. Return the plain wire shape the session projects (type or role, id, content, tool_calls, tool_call_id). A message the function throws on is read as it was sent.

readonly toMessage?: (message: unknown) => unknown;

transcriptNodeNames

Node names whose streamed message chunks enter the transcript. Omit it to accept every root node. Use it when a graph has side-effect model nodes, such as title generation, whose output is not chat content. Messages a node writes to the graph state still arrive with that state, and child graphs are never affected: their messages belong to subgraphs.

readonly transcriptNodeNames?: readonly string[];

transport

A transport to use in place of the SDK transport the session would own.

readonly transport?: AgentTransport;