createSession

Private development composition. Construction/observation perform no I/O. stop settles local ownership, not remote side effects. dispose is permanent: submits resolve aborted, subscriptions are inert, reads retain the final snapshot, stop/dispose are idempotent. checkStatus rejects after disposal or during a run; it only reads history and never creates another logical run.

import { createSession } from '@threadplane/langgraph';

Declaration · overload 1

export declare function createSession<T extends Record<string, FunctionToolDefinition>, D extends StateDeclaration | undefined = undefined>(options: Omit<SessionOptions, 'stateType'> & {
    readonly tools: T & CheckedTools<T>;
    readonly stateType?: D;
}): LangGraphSession<ToolContracts<T>, InferState<D>>;

Type parameters

T
Record<string, FunctionToolDefinition>
D
StateDeclaration | undefined Default: undefined

Parameters

options · required
Omit<SessionOptions, 'stateType'> & { readonly tools: T & CheckedTools<T>; readonly stateType?: D; }

Returns

LangGraphSession<ToolContracts<T>, InferState<D>>

Declaration · overload 2

export declare function createSession<D extends StateDeclaration | undefined = undefined>(options: Omit<SessionOptions, 'stateType'> & {
    readonly tools?: undefined;
    readonly stateType?: D;
}): LangGraphSession<Record<string, ToolContract>, InferState<D>>;

Type parameters

D
StateDeclaration | undefined Default: undefined

Parameters

options · required
Omit<SessionOptions, 'stateType'> & { readonly tools?: undefined; readonly stateType?: D; }

Returns

LangGraphSession<Record<string, ToolContract>, InferState<D>>