SDK for interacting with LangGraph API
Project Links
Meta
Requires Python: >=3.10
Classifiers
LangGraph Python SDK
This repository contains the Python SDK for interacting with the LangSmith Deployment REST API.
Quick Start
To get started with the Python SDK, install the package
pip install -U langgraph-sdk
You will need a running LangGraph API server. If you're running a server locally using langgraph-cli, SDK will automatically point at http://localhost:8123, otherwise
you would need to specify the server URL when creating a client.
from langgraph_sdk import get_client
# If you're using a remote server, initialize the client with `get_client(url=REMOTE_URL)`
client = get_client()
# List all assistants
assistants = await client.assistants.search()
# We auto-create an assistant for each graph you register in config.
agent = assistants[0]
# Start a new thread
thread = await client.threads.create()
# Start a streaming run
input = {"messages": [{"role": "human", "content": "what's the weather in la"}]}
async for chunk in client.runs.stream(thread['thread_id'], agent['assistant_id'], input=input):
print(chunk)
Known Limitations
- WebSocket transport requires
websockets>=14and is only available on the async client (AsyncThreadStream). The sync client (SyncThreadStream) uses SSE exclusively. thread.extensions[name]opens a new subscription each time the same name is accessed. Assign the projection to a variable and reuse it within a single session rather than re-indexing across multiple iterations.- Sync streaming drives the lifecycle watcher in a background thread. Long-lived sync sessions will hold that thread open until the context manager exits.
- Reconnect attempts are limited to 5 by default for both the shared SSE fan-out and the lifecycle watcher. Persistent network partitions will surface as
RuntimeErroron in-flight projections.
Thread-Centric Streaming (v3)
client.threads.stream() returns a context manager that owns the SSE session for one
thread. Typed projections — values snapshots, message streams, tool calls, custom
events — all share the same underlying connection.
from langgraph_sdk import get_client
import asyncio
client = get_client()
async with client.threads.stream(
thread_id="my-thread",
assistant_id="agent",
) as thread:
await thread.run.start(input={"messages": [{"role": "user", "content": "hi"}]})
# Start all consumers concurrently so they share one SSE connection.
async def get_messages():
return [s async for s in thread.messages]
async def get_tool_calls():
return [c async for c in thread.tool_calls]
messages, tool_calls = await asyncio.gather(get_messages(), get_tool_calls())
for stream in messages:
print(await stream.text) # accumulated text
final = await thread.output # terminal state values
0.4.2
Jun 01, 2026
0.4.1
Jun 01, 2026
0.4.0
May 28, 2026
0.3.15
May 22, 2026
0.3.14
May 05, 2026
0.3.13
Apr 07, 2026
0.3.12
Mar 18, 2026
0.3.11
Mar 11, 2026
0.3.10
Mar 09, 2026
0.3.9
Feb 24, 2026
0.3.8
Feb 19, 2026
0.3.7
Feb 18, 2026
0.3.6
Feb 14, 2026
0.3.5
Feb 10, 2026
0.3.4
Feb 06, 2026
0.3.3
Jan 13, 2026
0.3.2
Jan 09, 2026
0.3.1
Dec 18, 2025
0.3.0
Dec 12, 2025
0.2.15
Dec 09, 2025
0.2.14
Dec 06, 2025
0.2.12
Dec 02, 2025
0.2.10
Nov 24, 2025
0.2.9
Sep 20, 2025
0.2.8
Sep 17, 2025
0.2.7
Sep 16, 2025
0.2.6
Sep 04, 2025
0.2.5
Sep 03, 2025
0.2.4
Aug 28, 2025
0.2.3
Aug 21, 2025
0.2.2
Aug 18, 2025
0.2.1
Aug 18, 2025
0.2.0
Jul 22, 2025
0.2.0a1
Jul 22, 2025
0.1.74
Jul 21, 2025
0.1.73
Jul 14, 2025
0.1.72
Jun 27, 2025
0.1.71
Jun 26, 2025
0.1.70
May 21, 2025
0.1.69
May 13, 2025
0.1.66
Apr 30, 2025
0.1.65
Apr 30, 2025
0.1.64
Apr 30, 2025
0.1.63
Apr 22, 2025
0.1.62
Apr 21, 2025
0.1.61
Apr 03, 2025
0.1.60
Mar 27, 2025
0.1.59
Mar 25, 2025
0.1.58
Mar 19, 2025
0.1.57
Mar 13, 2025
0.1.56
Mar 12, 2025
0.1.55
Mar 06, 2025
0.1.53
Feb 20, 2025
0.1.51
Jan 09, 2025
0.1.50
Jan 09, 2025
0.1.48
Dec 18, 2024
0.1.47
Dec 17, 2024
0.1.46
Dec 16, 2024
0.1.45
Dec 14, 2024
0.1.44
Dec 12, 2024
0.1.43
Dec 05, 2024
0.1.42
Dec 03, 2024
0.1.40
Nov 28, 2024
0.1.39
Nov 28, 2024
0.1.38
Nov 28, 2024
0.1.37
Nov 27, 2024
0.1.36
Nov 14, 2024
0.1.35
Oct 28, 2024
0.1.34
Oct 25, 2024
0.1.33
Oct 14, 2024
0.1.32
Oct 01, 2024
0.1.31
Sep 23, 2024
0.1.30
Aug 30, 2024
0.1.29
Aug 26, 2024
0.1.28
Aug 21, 2024
0.1.27
Aug 03, 2024
0.1.26
Jul 15, 2024
0.1.25
Jun 26, 2024
0.1.24
Jun 26, 2024
0.1.23
Jun 19, 2024
0.1.22
Jun 19, 2024
0.1.21
Jun 18, 2024
0.1.20
Jun 12, 2024
0.1.18
Jun 07, 2024
0.1.17
Jun 07, 2024
0.1.16
May 31, 2024
0.1.14
May 31, 2024
0.1.12
May 27, 2024
0.1.11
May 22, 2024
0.1.10
May 17, 2024
0.1.9
May 16, 2024
0.1.8
May 11, 2024
0.1.7
May 09, 2024
0.1.6
May 09, 2024
0.1.5
May 08, 2024
0.1.4
May 08, 2024
0.1.3
May 08, 2024
0.1.2
May 08, 2024
0.1.1
May 03, 2024
0.1.0
May 02, 2024
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
httpx
(>=0.25.2)
langchain-core
(<2,>=1.4.0)
langchain-protocol
(>=0.0.15)
orjson
(>=3.11.5)
websockets
(<16,>=14)