LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    LangGraph Store
    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
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdk_syncruns
    Module●Since v0.3

    runs

    Synchronous client for managing runs in LangGraph.

    Attributes

    Classes

    Type Aliases

    View source on GitHub
    attribute
    All: Literal['*']
    attribute
    BulkCancelRunsStatus: Literal['pending', 'running', 'all']
    attribute
    CancelAction: Literal['interrupt', 'rollback']
    attribute
    DisconnectMode: Literal['cancel', 'continue']
    attribute
    Durability: Literal['sync', 'async', 'exit']
    attribute
    IfNotExists: Literal['create', 'reject']
    attribute
    MultitaskStrategy: Literal['reject', 'interrupt', 'rollback', 'enqueue']
    attribute
    OnCompletionBehavior: Literal['delete', 'keep']
    attribute
    RunSelectField: Literal['run_id', 'thread_id', 'assistant_id', 'created_at', 'updated_at', 'status', 'metadata', 'kwargs', 'multitask_strategy']
    attribute
    RunStatus: Literal['pending', 'running', 'error', 'success', 'timeout', 'interrupted']
    attribute
    StreamMode: Literal['values', 'messages', 'updates', 'events', 'tasks', 'checkpoints', 'debug', 'custom', 'messages-tuple']
    attribute
    StreamVersion: Literal['v1', 'v2']
    class
    SyncHttpClient
    class
    Checkpoint
    class
    Command
    class
    Config
    class
    LangSmithTracing
    class
    Run
    class
    RunCreate
    class
    RunCreateMetadata
    class
    StreamPart
    class
    SyncRunsClient
    typeAlias
    Context: TypeAlias
    typeAlias
    Input: TypeAlias
    typeAlias
    QueryParamTypes: Mapping[str, PrimitiveData | Sequence[PrimitiveData]] | list[tuple[str, PrimitiveData]] | tuple[tuple[str, PrimitiveData], ...] | str | bytes
    typeAlias
    StreamPartV2

    Represents a wildcard or 'all' selector.

    Filter runs by status when bulk-cancelling:

    • "pending": Cancel only pending runs.
    • "running": Cancel only running runs.
    • "all": Cancel all runs regardless of status.

    Action to take when cancelling the run.

    • "interrupt": Simply cancel the run.
    • "rollback": Cancel the run. Then delete the run and associated checkpoints.

    Specifies behavior on disconnection:

    • "cancel": Cancel the operation on disconnection.
    • "continue": Continue the operation even if disconnected.

    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.

    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.

    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.

    Defines action after completion:

    • "delete": Delete resources after completion.
    • "keep": Retain resources after completion.

    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.

    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.

    Stream format version.

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

    Handle synchronous requests to the LangGraph API.

    Provides error messaging and content handling enhancements above the underlying httpx client, mirroring the interface of HttpClient but for sync usage.

    Represents a checkpoint in the execution process.

    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.

    Configuration options for a call.

    Configuration for LangSmith tracing.

    Represents a single execution run.

    Defines the parameters for initiating a background run.

    Metadata for a run creation request.

    Represents a part of a stream response.

    Discriminated union of all v2 stream part types.

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

    Synchronous client for managing runs in LangGraph.

    This class provides methods to create, retrieve, and manage runs, which represent individual executions of graphs.

    Example
    client = get_sync_client(url="http://localhost:2024")
    run = client.runs.create(thread_id="thread_123", assistant_id="asst_456")