LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Graphs
    • Functional API
    • Pregel
    • Checkpointing
    • Storage
    • Caching
    • Types
    • Runtime
    • Config
    • Errors
    • Constants
    • Channels
    • Agents
    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

    OverviewGraphsFunctional APIPregelCheckpointingStorageCachingTypesRuntimeConfigErrorsConstantsChannelsAgents
    LangGraph Checkpoint
    LangGraph Store
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    PythonlanggraphpregelmainPregelinvoke
    Method●Since v0.6

    invoke

    Copy
    invoke(
      self,
      input: InputT | Command | None,
      config: RunnableConfig
    View source on GitHub
    |
    None
    =
    None
    ,
    *
    ,
    context
    :
    ContextT
    |
    None
    =
    None
    ,
    stream_mode
    :
    StreamMode
    =
    'values'
    ,
    print_mode
    :
    StreamMode
    |
    Sequence
    [
    StreamMode
    ]
    =
    (
    )
    ,
    output_keys
    :
    str
    |
    Sequence
    [
    str
    ]
    |
    None
    =
    None
    ,
    interrupt_before
    :
    All
    |
    Sequence
    [
    str
    ]
    |
    None
    =
    None
    ,
    interrupt_after
    :
    All
    |
    Sequence
    [
    str
    ]
    |
    None
    =
    None
    ,
    durability
    :
    Durability
    |
    None
    =
    None
    ,
    control
    :
    RunControl
    |
    None
    =
    None
    ,
    version
    :
    Literal
    [
    'v1'
    ,
    'v2'
    ]
    =
    'v1'
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    ->
    dict
    [
    str
    ,
    Any
    ]
    |
    Any

    Parameters

    NameTypeDescription
    input*InputT | Command | None

    The input data for the graph. It can be a dictionary or any other type.

    configRunnableConfig | None
    Default:None

    The configuration for the graph run.

    contextContextT | None
    Default:None
    stream_modeStreamMode
    Default:'values'
    print_modeStreamMode | Sequence[StreamMode]
    Default:()
    output_keysstr | Sequence[str] | None
    Default:None
    interrupt_beforeAll | Sequence[str] | None
    Default:None
    interrupt_afterAll | Sequence[str] | None
    Default:None
    durabilityDurability | None
    Default:None
    controlRunControl | None
    Default:None
    versionLiteral['v1', 'v2']
    Default:'v1'
    **kwargsAny
    Default:{}

    Run the graph with a single input and config.

    The static context to use for the run.

    The stream mode for the graph run.

    Accepts the same values as stream_mode, but only prints the output to the console, for debugging purposes.

    Does not affect the output of the graph in any way.

    The output keys to retrieve from the graph run.

    The nodes to interrupt the graph run before.

    The nodes to interrupt the graph run after.

    The durability mode for the graph execution, defaults to "async".

    Options are:

    • "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.

    Optional run control used to request cooperative drain.

    The streaming format version. "v1" (default) returns the traditional format, "v2" returns StreamPart typed dicts when stream_mode is not "values".

    Additional keyword arguments to pass to the graph run.