LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdkschema
    Module●Since v0.1

    schema

    Data models for interacting with the LangGraph API.

    Attributes

    attribute
    RunStatus: Literal['pending', 'running', 'error', 'success', 'timeout', 'interrupted']

    Represents the status of a run:

    • "pending": The run is waiting to start.
    • "running": The run is currently executing.
    • "error": The run encountered an error and stopped.
    • "success": The run completed successfully.
    • "timeout": The run exceeded its time limit.
    • "interrupted": The run was manually stopped or interrupted.
    attribute
    ThreadStatus: Literal['idle', 'busy', 'interrupted', 'error']

    Represents the status of a thread:

    • "idle": The thread is not currently processing any task.
    • "busy": The thread is actively processing a task.
    • "interrupted": The thread's execution was interrupted.
    • "error": An exception occurred during task processing.
    attribute
    ThreadStreamMode: Literal['run_modes', 'lifecycle', 'state_update']

    Defines the mode of streaming:

    • "run_modes": Stream the same events as the runs on thread, as well as run_done events.
    • "lifecycle": Stream only run start/end events.
    • "state_update": Stream state updates on the thread.
    attribute
    StreamMode: Literal['values', 'messages', 'updates', 'events', 'tasks', 'checkpoints', 'debug', 'custom', 'messages-tuple']

    Defines the mode of streaming:

    • "values": Stream only the values.
    • "messages": Stream complete messages.
    • "updates": Stream updates to the state.
    • "events": Stream events occurring during execution.
    • "checkpoints": Stream checkpoints as they are created.
    • "tasks": Stream task start and finish events.
    • "debug": Stream detailed debug information.
    • "custom": Stream custom events.
    attribute
    DisconnectMode: Literal['cancel', 'continue']

    Specifies behavior on disconnection:

    • "cancel": Cancel the operation on disconnection.
    • "continue": Continue the operation even if disconnected.
    attribute
    MultitaskStrategy: Literal['reject', 'interrupt', 'rollback', 'enqueue']

    Defines how to handle multiple tasks:

    • "reject": Reject new tasks when busy.
    • "interrupt": Interrupt current task for new ones.
    • "rollback": Roll back current task and start new one.
    • "enqueue": Queue new tasks for later execution.
    attribute
    OnConflictBehavior: Literal['raise', 'do_nothing']

    Specifies behavior on conflict:

    • "raise": Raise an exception when a conflict occurs.
    • "do_nothing": Ignore conflicts and proceed.
    attribute
    OnCompletionBehavior: Literal['delete', 'keep']

    Defines action after completion:

    • "delete": Delete resources after completion.
    • "keep": Retain resources after completion.
    attribute
    Durability: Literal['sync', 'async', 'exit']

    Durability mode for the graph execution.

    • "sync": Changes are persisted synchronously before the next step starts.
    • "async": Changes are persisted asynchronously while the next step executes.
    • "exit": Changes are persisted only when the graph exits.
    attribute
    All: Literal['*']

    Represents a wildcard or 'all' selector.

    attribute
    IfNotExists: Literal['create', 'reject']

    Specifies behavior if the thread doesn't exist:

    • "create": Create a new thread if it doesn't exist.
    • "reject": Reject the operation if the thread doesn't exist.
    attribute
    PruneStrategy: Literal['delete', 'keep_latest']

    Strategy for pruning threads:

    • "delete": Remove threads entirely.
    • "keep_latest": Prune old checkpoints but keep threads and their latest state.
    attribute
    CancelAction: Literal['interrupt', 'rollback']

    Action to take when cancelling the run.

    • "interrupt": Simply cancel the run.
    • "rollback": Cancel the run. Then delete the run and associated checkpoints.
    attribute
    BulkCancelRunsStatus: Literal['pending', 'running', 'all']

    Filter runs by status when bulk-cancelling:

    • "pending": Cancel only pending runs.
    • "running": Cancel only running runs.
    • "all": Cancel all runs regardless of status.
    attribute
    AssistantSortBy: Literal['assistant_id', 'graph_id', 'name', 'created_at', 'updated_at']

    The field to sort by.

    attribute
    ThreadSortBy: Literal['thread_id', 'status', 'created_at', 'updated_at', 'state_updated_at']

    The field to sort by.

    attribute
    CronSortBy: Literal['cron_id', 'assistant_id', 'thread_id', 'created_at', 'updated_at', 'next_run_date', 'end_time']

    The field to sort by.

    attribute
    SortOrder: Literal['asc', 'desc']

    The order to sort by.

    attribute
    Subgraphs: dict[str, GraphSchema]
    attribute
    AssistantSelectField: Literal['assistant_id', 'graph_id', 'name', 'description', 'config', 'context', 'created_at', 'updated_at', 'metadata', 'version']
    attribute
    ThreadSelectField: Literal['thread_id', 'created_at', 'updated_at', 'metadata', 'config', 'context', 'status', 'values', 'interrupts']
    attribute
    RunSelectField: Literal['run_id', 'thread_id', 'assistant_id', 'created_at', 'updated_at', 'status', 'metadata', 'kwargs', 'multitask_strategy']
    attribute
    CronSelectField: Literal['cron_id', 'assistant_id', 'thread_id', 'end_time', 'schedule', 'timezone', 'created_at', 'updated_at', 'user_id', 'payload', 'next_run_date', 'metadata', 'now', 'on_run_completed', 'enabled']
    attribute
    StreamVersion: Literal['v1', 'v2']

    Stream format version.

    • "v1": Traditional format — raw SSE StreamPart NamedTuples.
    • "v2": Each event is a typed dict with type, ns, and data keys.

    Classes

    class
    LangSmithTracing

    Configuration for LangSmith tracing.

    class
    Config

    Configuration options for a call.

    class
    Checkpoint

    Represents a checkpoint in the execution process.

    class
    GraphSchema

    Defines the structure and properties of a graph.

    class
    AssistantBase

    Base model for an assistant.

    class
    AssistantVersion

    Represents a specific version of an assistant.

    class
    Assistant

    Represents an assistant with additional properties.

    class
    AssistantsSearchResponse

    Paginated response for assistant search results.

    class
    Interrupt

    Represents an interruption in the execution flow.

    class
    Thread

    Represents a conversation thread.

    class
    ThreadTask

    Represents a task within a thread.

    class
    ThreadState

    Represents the state of a thread.

    class
    ThreadUpdateStateResponse

    Represents the response from updating a thread's state.

    class
    Run

    Represents a single execution run.

    class
    Cron

    Represents a scheduled task.

    class
    CronUpdate

    Payload for updating a cron job. All fields are optional.

    class
    RunCreate

    Defines the parameters for initiating a background run.

    class
    Item

    Represents a single document or data entry in the graph's Store.

    Items are used to store cross-thread memories.

    class
    ListNamespaceResponse

    Response structure for listing namespaces.

    class
    SearchItem

    Item with an optional relevance score from search operations.

    class
    SearchItemsResponse

    Response structure for searching items.

    class
    StreamPart

    Represents a part of a stream response.

    class
    TaskPayload

    Payload for a task start event.

    class
    TaskResultPayload

    Payload for a task result event.

    class
    CheckpointTaskPayload

    A task entry within a CheckpointPayload.

    The keys present depend on the task's state:

    • Error: id, name, error, state
    • Has result: id, name, result, interrupts, state
    • Pending: id, name, interrupts, state
    class
    CheckpointPayload

    Payload for a checkpoint event.

    class
    RunMetadataPayload

    Payload for the metadata control event.

    class
    ValuesStreamPart

    Stream part emitted for stream_mode="values".

    class
    UpdatesStreamPart

    Stream part emitted for stream_mode="updates".

    class
    MessagesPartialStreamPart

    Stream part emitted for partial message chunks (messages/partial).

    class
    MessagesCompleteStreamPart

    Stream part emitted for complete messages (messages/complete).

    class
    MessagesMetadataStreamPart

    Stream part emitted for message metadata (messages/metadata).

    class
    MessagesTupleStreamPart

    Stream part emitted for stream_mode="messages" (raw message+metadata pair).

    class
    CustomStreamPart

    Stream part emitted for stream_mode="custom".

    class
    CheckpointsStreamPart

    Stream part emitted for stream_mode="checkpoints".

    class
    TasksStreamPart

    Stream part emitted for stream_mode="tasks".

    class
    DebugStreamPart

    Stream part emitted for stream_mode="debug".

    class
    MetadataStreamPart

    Control event with run_id and other run metadata.

    class
    Send

    Represents a message to be sent to a specific node in the graph.

    This type is used to explicitly send messages to nodes in the graph, typically used within Command objects to control graph execution flow.

    class
    Command

    Represents one or more commands to control graph execution flow and state.

    This type defines the control commands that can be returned by nodes to influence graph execution. It lets you navigate to other nodes, update graph state, and resume from interruptions.

    class
    RunCreateMetadata

    Metadata for a run creation request.

    Type Aliases

    typeAlias
    Json: dict[str, Any] | None

    Represents a JSON-like structure, which can be None or a dictionary with string keys and any values.

    typeAlias
    PrimitiveData
    typeAlias
    QueryParamTypes: Mapping[str, PrimitiveData | Sequence[PrimitiveData]] | list[tuple[str, PrimitiveData]] | tuple[tuple[str, PrimitiveData], ...] | str | bytes
    typeAlias
    DebugPayload

    Wrapper payload for debug events. Discriminate on type.

    typeAlias
    StreamPartV2

    Discriminated union of all v2 stream part types.

    Use part["type"] to narrow the type.

    typeAlias
    Input: TypeAlias
    typeAlias
    Context: TypeAlias
    View source on GitHub