Get a synchronous LangGraphClient instance.
get_sync_client(
*,
url: str | None = None,
api_key: str | None = NOT_PROVIDED,
headers: Mapping[str, str] | None = None,
timeout: TimeoutTypes | None = None
) -> SyncLangGraphClientReturns: SyncLangGraphClient: The top-level synchronous client for accessing AssistantsClient, ThreadsClient, RunsClient, and CronClient.
from langgraph_sdk import get_sync_client
# get top-level synchronous LangGraphClient
client = get_sync_client(url="http://localhost:8123")
# example usage: client.<model>.<method_name>()
assistant = client.assistants.get(assistant_id="some_uuid")from langgraph_sdk import get_sync_client
# Don't load API key from environment variables
client = get_sync_client(
url="http://localhost:8123",
api_key=None
)| Name | Type | Description |
|---|---|---|
url | str | None | Default: NoneThe URL of the LangGraph API. |
api_key | str | None | Default: NOT_PROVIDEDAPI key for authentication. Can be:
|
headers | Mapping[str, str] | None | Default: NoneOptional custom headers |
timeout | TimeoutTypes | None | Default: NoneOptional timeout configuration for the HTTP client. Accepts an httpx.Timeout instance, a float (seconds), or a tuple of timeouts. Tuple format is (connect, read, write, pool) If not provided, defaults to connect=5s, read=300s, write=300s, and pool=5s. |