How to get thread_id and run_id in a specific node in the new langgraph release?

I used to use the config parameter to do *config["configurable"]["thread_id"] *
but now that parameter is gone the context does not include that info and I’d like to avoid passing that in the input when calling the graph, is there a way to natively get the current run and thread info within a node?

1 Like

You can access thread_id and run_id by declaring config: RunnableConfig in your node function signature. LangGraph automatically injects this parameter:

from langchain_core.runnables import RunnableConfig

def my_node(state, config: RunnableConfig):
    thread_id = config.configurable.get("thread_id")
    run_id = config.run_id
    return state

Important: Don’t use RunnableConfig.get() or get_config() these context variable methods are deprecated and can break in async flows or older Python versions. The automatic injection approach is the recommended modern way to access execution metadata within nodes.

The config parameter is automatically provided by LangGraph when you include it in your function signature, giving you access to all execution context without needing to pass it explicitly.