Skip to content

JS/TS

langchain/langgraph-sdkDocs


langchain/langgraph-sdk

Modules

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client

client

Index

Classes

Interfaces

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client / AssistantsClient

Class: AssistantsClient

Extends

Constructors

new AssistantsClient()

new AssistantsClient(config?): AssistantsClient

Parameters

config?: ClientConfig

Returns

AssistantsClient

Inherited from

BaseClient.constructor

Defined in

client.mts:38

Properties

apiUrl

protected apiUrl: string

Inherited from

BaseClient.apiUrl

Defined in

client.mts:34


asyncCaller

protected asyncCaller: AsyncCaller

Inherited from

BaseClient.asyncCaller

Defined in

client.mts:30


defaultHeaders

protected defaultHeaders: Record\<string, undefined | null | string>

Inherited from

BaseClient.defaultHeaders

Defined in

client.mts:36


timeoutMs

protected timeoutMs: number

Inherited from

BaseClient.timeoutMs

Defined in

client.mts:32

Methods

create()

create(payload): Promise\<Assistant>

Create a new assistant.

Parameters

payload

Payload for creating an assistant.

payload.config?: Config

payload.graphId: string

payload.metadata?: Metadata

Returns

Promise\<Assistant>

The created assistant.

Defined in

client.mts:141


delete()

delete(assistantId): Promise\<void>

Delete an assistant.

Parameters

assistantId: string

ID of the assistant.

Returns

Promise\<void>

Defined in

client.mts:185


fetch()

protected fetch\<T>(path, options?): Promise\<T>

Type Parameters

T

Parameters

path: string

options?: RequestInit & object

Returns

Promise\<T>

Inherited from

BaseClient.fetch

Defined in

client.mts:90


get()

get(assistantId): Promise\<Assistant>

Get an assistant by ID.

Parameters

assistantId: string

The ID of the assistant.

Returns

Promise\<Assistant>

Assistant

Defined in

client.mts:114


getGraph()

getGraph(assistantId): Promise\<AssistantGraph>

Get the JSON representation of the graph assigned to a runnable

Parameters

assistantId: string

The ID of the assistant.

Returns

Promise\<AssistantGraph>

Serialized graph

Defined in

client.mts:123


getSchemas()

getSchemas(assistantId): Promise\<GraphSchema>

Get the state and config schema of the graph assigned to a runnable

Parameters

assistantId: string

The ID of the assistant.

Returns

Promise\<GraphSchema>

Graph schema

Defined in

client.mts:132


prepareFetchOptions()

protected prepareFetchOptions(path, options?): [URL, RequestInit]

Parameters

path: string

options?: RequestInit & object

Returns

[URL, RequestInit]

Inherited from

BaseClient.prepareFetchOptions

Defined in

client.mts:50


search(query?): Promise\<Assistant[]>

List assistants.

Parameters

query?

Query options.

query.limit?: number

query.metadata?: Metadata

query.offset?: number

Returns

Promise\<Assistant[]>

List of assistants.

Defined in

client.mts:196


update()

update(assistantId, payload): Promise\<Assistant>

Update an assistant.

Parameters

assistantId: string

ID of the assistant.

payload

Payload for updating the assistant.

payload.config?: Config

payload.graphId: string

payload.metadata?: Metadata

Returns

Promise\<Assistant>

The updated assistant.

Defined in

client.mts:162

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client / BaseClient

Class: BaseClient

Extended by

Constructors

new BaseClient()

new BaseClient(config?): BaseClient

Parameters

config?: ClientConfig

Returns

BaseClient

Defined in

client.mts:38

Properties

apiUrl

protected apiUrl: string

Defined in

client.mts:34


asyncCaller

protected asyncCaller: AsyncCaller

Defined in

client.mts:30


defaultHeaders

protected defaultHeaders: Record\<string, undefined | null | string>

Defined in

client.mts:36


timeoutMs

protected timeoutMs: number

Defined in

client.mts:32

Methods

fetch()

protected fetch\<T>(path, options?): Promise\<T>

Type Parameters

T

Parameters

path: string

options?: RequestInit & object

Returns

Promise\<T>

Defined in

client.mts:90


prepareFetchOptions()

protected prepareFetchOptions(path, options?): [URL, RequestInit]

Parameters

path: string

options?: RequestInit & object

Returns

[URL, RequestInit]

Defined in

client.mts:50

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client / Client

Class: Client

Constructors

new Client()

new Client(config?): Client

Parameters

config?: ClientConfig

Returns

Client

Defined in

client.mts:675

Properties

assistants

assistants: AssistantsClient

The client for interacting with assistants.

Defined in

client.mts:663


runs

runs: RunsClient

The client for interacting with runs.

Defined in

client.mts:673


threads

threads: ThreadsClient

The client for interacting with threads.

Defined in

client.mts:668

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client / RunsClient

Class: RunsClient

Extends

Constructors

new RunsClient()

new RunsClient(config?): RunsClient

Parameters

config?: ClientConfig

Returns

RunsClient

Inherited from

BaseClient.constructor

Defined in

client.mts:38

Properties

apiUrl

protected apiUrl: string

Inherited from

BaseClient.apiUrl

Defined in

client.mts:34


asyncCaller

protected asyncCaller: AsyncCaller

Inherited from

BaseClient.asyncCaller

Defined in

client.mts:30


defaultHeaders

protected defaultHeaders: Record\<string, undefined | null | string>

Inherited from

BaseClient.defaultHeaders

Defined in

client.mts:36


timeoutMs

protected timeoutMs: number

Inherited from

BaseClient.timeoutMs

Defined in

client.mts:32

Methods

cancel()

cancel(threadId, runId, wait): Promise\<void>

Cancel a run.

Parameters

threadId: string

The ID of the thread.

runId: string

The ID of the run.

wait: boolean = false

Whether to block when canceling

Returns

Promise\<void>

Defined in

client.mts:621


create()

create(threadId, assistantId, payload?): Promise\<Run>

Create a run.

Parameters

threadId: string

The ID of the thread.

assistantId: string

Assistant ID to use for this run.

payload?: RunsCreatePayload

Payload for creating a run.

Returns

Promise\<Run>

The created run.

Defined in

client.mts:502


delete()

delete(threadId, runId): Promise\<void>

Delete a run.

Parameters

threadId: string

The ID of the thread.

runId: string

The ID of the run.

Returns

Promise\<void>

Defined in

client.mts:652


fetch()

protected fetch\<T>(path, options?): Promise\<T>

Type Parameters

T

Parameters

path: string

options?: RequestInit & object

Returns

Promise\<T>

Inherited from

BaseClient.fetch

Defined in

client.mts:90


get()

get(threadId, runId): Promise\<Run>

Get a run by ID.

Parameters

threadId: string

The ID of the thread.

runId: string

The ID of the run.

Returns

Promise\<Run>

The run.

Defined in

client.mts:609


join()

join(threadId, runId): Promise\<void>

Block until a run is done.

Parameters

threadId: string

The ID of the thread.

runId: string

The ID of the run.

Returns

Promise\<void>

Defined in

client.mts:641


list()

list(threadId, options?): Promise\<Run[]>

List all runs for a thread.

Parameters

threadId: string

The ID of the thread.

options?

Filtering and pagination options.

options.limit?: number

Maximum number of runs to return. Defaults to 10

options.offset?: number

Offset to start from. Defaults to 0.

Returns

Promise\<Run[]>

List of runs.

Defined in

client.mts:578


prepareFetchOptions()

protected prepareFetchOptions(path, options?): [URL, RequestInit]

Parameters

path: string

options?: RequestInit & object

Returns

[URL, RequestInit]

Inherited from

BaseClient.prepareFetchOptions

Defined in

client.mts:50


stream()

Create a run and stream the results.

Param

The ID of the thread.

Param

Assistant ID to use for this run.

Param

Payload for creating a run.

stream(threadId, assistantId, payload)

stream(threadId, assistantId, payload?): AsyncGenerator\<object, any, unknown>

Create a run and stream the results.

Parameters

threadId: null

assistantId: string

payload?: Omit\<RunsStreamPayload, "multitaskStrategy">

Returns

AsyncGenerator\<object, any, unknown>

# data

data: any

# event

event: StreamEvent

Defined in

client.mts:401

stream(threadId, assistantId, payload)

stream(threadId, assistantId, payload?): AsyncGenerator\<object, any, unknown>

Create a run and stream the results.

Parameters

threadId: string

assistantId: string

payload?: RunsStreamPayload

Returns

AsyncGenerator\<object, any, unknown>

# data

data: any

# event

event: StreamEvent

Defined in

client.mts:410


wait()

Create a run and wait for it to complete.

Param

The ID of the thread.

Param

Assistant ID to use for this run.

Param

Payload for creating a run.

wait(threadId, assistantId, payload)

wait(threadId, assistantId, payload?): Promise\<DefaultValues>

Create a run and wait for it to complete.

Parameters

threadId: null

assistantId: string

payload?: Omit\<RunsStreamPayload, "multitaskStrategy">

Returns

Promise\<DefaultValues>

Defined in

client.mts:526

wait(threadId, assistantId, payload)

wait(threadId, assistantId, payload?): Promise\<DefaultValues>

Create a run and wait for it to complete.

Parameters

threadId: string

assistantId: string

payload?: RunsStreamPayload

Returns

Promise\<DefaultValues>

Defined in

client.mts:532

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client / ThreadsClient

Class: ThreadsClient

Extends

Constructors

new ThreadsClient()

new ThreadsClient(config?): ThreadsClient

Parameters

config?: ClientConfig

Returns

ThreadsClient

Inherited from

BaseClient.constructor

Defined in

client.mts:38

Properties

apiUrl

protected apiUrl: string

Inherited from

BaseClient.apiUrl

Defined in

client.mts:34


asyncCaller

protected asyncCaller: AsyncCaller

Inherited from

BaseClient.asyncCaller

Defined in

client.mts:30


defaultHeaders

protected defaultHeaders: Record\<string, undefined | null | string>

Inherited from

BaseClient.defaultHeaders

Defined in

client.mts:36


timeoutMs

protected timeoutMs: number

Inherited from

BaseClient.timeoutMs

Defined in

client.mts:32

Methods

create()

create(payload?): Promise\<Thread>

Create a new thread.

Parameters

payload?

Payload for creating a thread.

payload.metadata?: Metadata

Metadata for the thread.

Returns

Promise\<Thread>

The created thread.

Defined in

client.mts:229


delete()

delete(threadId): Promise\<void>

Delete a thread.

Parameters

threadId: string

ID of the thread.

Returns

Promise\<void>

Defined in

client.mts:268


fetch()

protected fetch\<T>(path, options?): Promise\<T>

Type Parameters

T

Parameters

path: string

options?: RequestInit & object

Returns

Promise\<T>

Inherited from

BaseClient.fetch

Defined in

client.mts:90


get()

get(threadId): Promise\<Thread>

Get a thread by ID.

Parameters

threadId: string

ID of the thread.

Returns

Promise\<Thread>

The thread.

Defined in

client.mts:219


getHistory()

getHistory\<ValuesType>(threadId, options?): Promise\<ThreadState\<ValuesType>[]>

Get all past states for a thread.

Type Parameters

ValuesType = DefaultValues

Parameters

threadId: string

ID of the thread.

options?

Additional options.

options.before?: Config

options.limit?: number

options.metadata?: Metadata

Returns

Promise\<ThreadState\<ValuesType>[]>

List of thread states.

Defined in

client.mts:378


getState()

getState\<ValuesType>(threadId, checkpointId?): Promise\<ThreadState\<ValuesType>>

Get state for a thread.

Type Parameters

ValuesType = DefaultValues

Parameters

threadId: string

ID of the thread.

checkpointId?: string

Returns

Promise\<ThreadState\<ValuesType>>

Thread state.

Defined in

client.mts:311


patchState()

patchState(threadIdOrConfig, metadata): Promise\<void>

Patch the metadata of a thread.

Parameters

threadIdOrConfig: string | Config

Thread ID or config to patch the state of.

metadata: Metadata

Metadata to patch the state with.

Returns

Promise\<void>

Defined in

client.mts:348


prepareFetchOptions()

protected prepareFetchOptions(path, options?): [URL, RequestInit]

Parameters

path: string

options?: RequestInit & object

Returns

[URL, RequestInit]

Inherited from

BaseClient.prepareFetchOptions

Defined in

client.mts:50


search()

search(query?): Promise\<Thread[]>

List threads

Parameters

query?

Query options

query.limit?: number

Maximum number of threads to return. Defaults to 10

query.metadata?: Metadata

Metadata to filter threads by.

query.offset?: number

Offset to start from.

Returns

Promise\<Thread[]>

List of threads

Defined in

client.mts:280


update()

update(threadId, payload?): Promise\<Thread>

Update a thread.

Parameters

threadId: string

ID of the thread.

payload?

Payload for updating the thread.

payload.metadata?: Metadata

Metadata for the thread.

Returns

Promise\<Thread>

The updated thread.

Defined in

client.mts:248


updateState()

updateState\<ValuesType>(threadId, options): Promise\<void>

Add state to a thread.

Type Parameters

ValuesType = DefaultValues

Parameters

threadId: string

The ID of the thread.

options

options.asNode?: string

options.checkpointId?: string

options.values: ValuesType

Returns

Promise\<void>

Defined in

client.mts:328

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / client / ClientConfig

Interface: ClientConfig

Properties

apiUrl?

optional apiUrl: string

Defined in

client.mts:23


callerOptions?

optional callerOptions: AsyncCallerParams

Defined in

client.mts:24


defaultHeaders?

optional defaultHeaders: Record\<string, undefined | null | string>

Defined in

client.mts:26


timeoutMs?

optional timeoutMs: number

Defined in

client.mts:25

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema

schema

Index

Interfaces

Type Aliases

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / Assistant

Interface: Assistant

Properties

assistant_id

assistant_id: string

Defined in

schema.ts:55


config

config: Config

Defined in

schema.ts:57


created_at

created_at: string

Defined in

schema.ts:58


graph_id

graph_id: string

Defined in

schema.ts:56


metadata

metadata: Metadata

Defined in

schema.ts:60


updated_at

updated_at: string

Defined in

schema.ts:59

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / Config

Interface: Config

Properties

configurable

configurable: object

Runtime values for attributes previously made configurable on this Runnable.

Index Signature

[key: string]: unknown

thread_id?

optional thread_id: string

ID of the thread

thread_ts?

optional thread_ts: string

Timestamp of the state checkpoint

Defined in

schema.ts:21


recursion_limit?

optional recursion_limit: number

Maximum number of times a call can recurse. If not provided, defaults to 25.

Defined in

schema.ts:16


tags?

optional tags: string[]

Tags for this call and any sub-calls (eg. a Chain calling an LLM). You can use these to filter calls.

Defined in

schema.ts:10

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / GraphSchema

Interface: GraphSchema

Properties

config_schema

config_schema: JSONSchema7

The schema for the graph config

Defined in

schema.ts:49


graph_id

graph_id: string

The ID of the graph.

Defined in

schema.ts:39


state_schema

state_schema: JSONSchema7

The schema for the graph state

Defined in

schema.ts:44

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / Run

Interface: Run

Properties

assistant_id

assistant_id: string

Defined in

schema.ts:85


created_at

created_at: string

Defined in

schema.ts:86


metadata

metadata: Metadata

Defined in

schema.ts:95


run_id

run_id: string

Defined in

schema.ts:83


status

status: "pending" | "running" | "error" | "success" | "timeout" | "interrupted"

Defined in

schema.ts:88


thread_id

thread_id: string

Defined in

schema.ts:84


updated_at

updated_at: string

Defined in

schema.ts:87

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / Thread

Interface: Thread

Properties

created_at

created_at: string

Defined in

schema.ts:66


metadata

metadata: Metadata

Defined in

schema.ts:68


thread_id

thread_id: string

Defined in

schema.ts:65


updated_at

updated_at: string

Defined in

schema.ts:67

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / ThreadState

Interface: ThreadState\<ValuesType>

Type Parameters

ValuesType = DefaultValues

Properties

checkpoint_id

checkpoint_id: string

Defined in

schema.ts:76


created_at

created_at: Optional\<string>

Defined in

schema.ts:78


metadata

metadata: Metadata

Defined in

schema.ts:77


next

next: string[]

Defined in

schema.ts:75


parent_checkpoint_id

parent_checkpoint_id: Optional\<string>

Defined in

schema.ts:79


values

values: ValuesType

Defined in

schema.ts:74

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / AssistantGraph

Type Alias: AssistantGraph

AssistantGraph: Record\<string, Record\<string, unknown>[]>

Defined in

schema.ts:62

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / DefaultValues

Type Alias: DefaultValues

DefaultValues: Record\<string, unknown>[] | Record\<string, unknown>

Defined in

schema.ts:71

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / schema / Metadata

Type Alias: Metadata

Metadata: Optional\<Record\<string, unknown>>

Defined in

schema.ts:52

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types

types

Index

Interfaces

Type Aliases

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types / RunsCreatePayload

Interface: RunsCreatePayload

Extends

  • RunsInvokePayload

Properties

config?

optional config: Config

Additional configuration for the run.

Inherited from

RunsInvokePayload.config

Defined in

types.mts:30


input?

optional input: null | Record\<string, unknown>

Input to the run. Pass null to resume from the current state of the thread.

Inherited from

RunsInvokePayload.input

Defined in

types.mts:20


interruptAfter?

optional interruptAfter: string[]

Interrupt execution after leaving these nodes.

Inherited from

RunsInvokePayload.interruptAfter

Defined in

types.mts:40


interruptBefore?

optional interruptBefore: string[]

Interrupt execution before entering these nodes.

Inherited from

RunsInvokePayload.interruptBefore

Defined in

types.mts:35


metadata?

optional metadata: Metadata

Metadata for the run.

Inherited from

RunsInvokePayload.metadata

Defined in

types.mts:25


multitaskStrategy?

optional multitaskStrategy: MultitaskStrategy

Strategy to handle concurrent runs on the same thread. Only relevant if there is a pending/inflight run on the same thread. One of: - "reject": Reject the new run. - "interrupt": Interrupt the current run, keeping steps completed until now, and start a new one. - "rollback": Cancel and delete the existing run, rolling back the thread to the state before it had started, then start the new run. - "enqueue": Queue up the new run to start after the current run finishes.

Inherited from

RunsInvokePayload.multitaskStrategy

Defined in

types.mts:52


signal?

optional signal: AbortSignal

Abort controller signal to cancel the run.

Inherited from

RunsInvokePayload.signal

Defined in

types.mts:57


webhook?

optional webhook: string

Webhook to call when the run is complete.

Defined in

types.mts:83

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types / RunsStreamPayload

Interface: RunsStreamPayload

Extends

  • RunsInvokePayload

Properties

config?

optional config: Config

Additional configuration for the run.

Inherited from

RunsInvokePayload.config

Defined in

types.mts:30


feedbackKeys?

optional feedbackKeys: string[]

Pass one or more feedbackKeys if you want to request short-lived signed URLs for submitting feedback to LangSmith with this key for this run.

Defined in

types.mts:76


input?

optional input: null | Record\<string, unknown>

Input to the run. Pass null to resume from the current state of the thread.

Inherited from

RunsInvokePayload.input

Defined in

types.mts:20


interruptAfter?

optional interruptAfter: string[]

Interrupt execution after leaving these nodes.

Inherited from

RunsInvokePayload.interruptAfter

Defined in

types.mts:40


interruptBefore?

optional interruptBefore: string[]

Interrupt execution before entering these nodes.

Inherited from

RunsInvokePayload.interruptBefore

Defined in

types.mts:35


metadata?

optional metadata: Metadata

Metadata for the run.

Inherited from

RunsInvokePayload.metadata

Defined in

types.mts:25


multitaskStrategy?

optional multitaskStrategy: MultitaskStrategy

Strategy to handle concurrent runs on the same thread. Only relevant if there is a pending/inflight run on the same thread. One of: - "reject": Reject the new run. - "interrupt": Interrupt the current run, keeping steps completed until now, and start a new one. - "rollback": Cancel and delete the existing run, rolling back the thread to the state before it had started, then start the new run. - "enqueue": Queue up the new run to start after the current run finishes.

Inherited from

RunsInvokePayload.multitaskStrategy

Defined in

types.mts:52


signal?

optional signal: AbortSignal

Abort controller signal to cancel the run.

Inherited from

RunsInvokePayload.signal

Defined in

types.mts:57


streamMode?

optional streamMode: StreamMode | StreamMode[]

One of "values", "messages", "updates" or "events". - "values": Stream the thread state any time it changes. - "messages": Stream chat messages from thread state and calls to chat models, token-by-token where possible. - "updates": Stream the state updates returned by each node. - "events": Stream all events produced by the run. You can also access these afterwards using the client.runs.listEvents() method.

Defined in

types.mts:70

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types / MultitaskStrategy

Type Alias: MultitaskStrategy

MultitaskStrategy: "reject" | "interrupt" | "rollback" | "enqueue"

Defined in

types.mts:4

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types / RunsWaitPayload

Type Alias: RunsWaitPayload

RunsWaitPayload: RunsStreamPayload

Defined in

types.mts:86

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types / StreamEvent

Type Alias: StreamEvent

StreamEvent: "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | string & object

Defined in

types.mts:5

@langchain/langgraph-sdkDocs


@langchain/langgraph-sdk / types / StreamMode

Type Alias: StreamMode

StreamMode: "values" | "messages" | "updates" | "events" | "debug"

Defined in

types.mts:3

Comments