LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    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

    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph-sdk_syncclientget_sync_client
    Functionā—Since v0.3

    get_sync_client

    Copy
    get_sync_client(
      *,
      url: str | None = None,
      api_key: str | None =

    Used in Docs

    • How to interact with a deployment using RemoteGraph
    • LangSmith Deployment
    View source on GitHub
    NOT_PROVIDED
    ,
    headers
    :
    Mapping
    [
    str
    ,
    str
    ]
    |
    None
    =
    None
    ,
    timeout
    :
    TimeoutTypes
    |
    None
    =
    None
    )
    ->
    SyncLangGraphClient

    Parameters

    NameTypeDescription
    urlstr | None
    Default:None

    The URL of the LangGraph API.

    api_keystr | None
    Default:NOT_PROVIDED

    API key for authentication. Can be:

    • A string: use this exact API key
    • None: explicitly skip loading from environment variables
    • Not provided (default): auto-load from environment in this order:
      1. LANGGRAPH_API_KEY
      2. LANGSMITH_API_KEY
      3. LANGCHAIN_API_KEY
    headersMapping[str, str] | None
    Default:None
    timeoutTimeoutTypes | None
    Default:None

    Get a synchronous LangGraphClient instance.

    Returns: SyncLangGraphClient: The top-level synchronous client for accessing AssistantsClient, ThreadsClient, RunsClient, and CronClient.

    Example
    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")
    Skip auto-loading API key from environment:
    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
    )

    Optional custom headers

    Optional 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.