Create a thread
To run your graph and the state persisted, you must first create a thread.Empty thread
To create a new thread, use the LangGraph SDKcreate method. See the Python and JS SDK reference docs for more information.
- Python
- Javascript
- CURL
Copy thread
Alternatively, if you already have a thread in your application whose state you wish to copy, you can use thecopy method. This will create an independent thread whose history is identical to the original thread at the time of the operation. See the Python and JS SDK reference docs for more information.
- Python
- Javascript
- CURL
Prepopulated State
Finally, you can create a thread with an arbitrary pre-defined state by providing a list ofsupersteps into the create method. The supersteps describe a list of a sequence of state updates. For example:
- Python
- Javascript
- CURL
List threads
LangGraph SDK
To list threads, use the LangGraph SDKsearch method. This will list the threads in the application that match the provided filters. See the Python and JS SDK reference docs for more information.
Filter by thread status
Use thestatus field to filter threads based on their status. Supported values are idle, busy, interrupted, and error. See here for information on each status. For example, to view idle threads:
- Python
- Javascript
- CURL
Filter by metadata
Thesearch method allows you to filter on metadata:
- Python
- Javascript
- CURL
Sorting
The SDK also supports sorting threads bythread_id, status, created_at, and updated_at using the sort_by and sort_order params.
LangSmith UI
You can also view threads in a deployment via the LangSmith UI. Inside your deployment, select the “Threads” tab. This will load a table of all of the threads in your deployment. To filter by thread status, select a status in the top bar. To sort by a supported property, click on the arrow icon for the desired column.Inspect threads
LangGraph SDK
Get Thread
To view a specific thread given itsthread_id, use the get method:
- Python
- Javascript
- CURL
Inspect Thread State
To view the current state of a given thread, use theget_state method:
- Python
- Javascript
- CURL
- Python
- Javascript
- CURL
Inspect Full Thread History
To view a thread’s history, use theget_history method. This returns a list of every state the thread experienced. For more information see the Python and JS reference docs.
LangSmith UI
You can also view threads in a deployment via the LangSmith UI. Inside your deployment, select the “Threads” tab. This will load a table of all of the threads in your deployment. Select a thread to inspect its current state. To view its full history and for further debugging, open the thread in Studio.Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.