{"id":773,"library":"langgraph-sdk","title":"LangGraph SDK","description":"The LangGraph SDK (langgraph-sdk) is a Python client for interacting with the LangGraph API (also known as LangSmith Deployment REST API), allowing programmatic access to manage Assistants, Threads, Runs, and Cron jobs. Currently at version 0.3.12, it provides both synchronous and asynchronous clients, serving as a key interface for deploying and managing stateful AI agents orchestrated by the LangGraph framework. The library is part of the actively developed LangChain ecosystem.","status":"active","version":"0.3.12","language":"python","source_language":"en","source_url":"https://github.com/langchain-ai/langgraph/tree/main/libs/sdk-py","tags":["langchain","LLM","AI","orchestration","graph","agent","SDK","API client"],"install":[{"cmd":"pip install langgraph-sdk","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"Used to create an asynchronous client for interacting with the LangGraph API.","symbol":"get_client","correct":"from langgraph_sdk import get_client"},{"note":"Used to create a synchronous client for interacting with the LangGraph API.","symbol":"get_sync_client","correct":"from langgraph_sdk import get_sync_client"}],"quickstart":{"code":"import os\nimport asyncio\nfrom langgraph_sdk import get_client\n\n# Ensure the LangGraph API server is running and accessible.\n# By default, it looks for a server at http://localhost:8123\n# and LANGGRAPH_API_KEY in environment variables.\nLANGGRAPH_SERVER_URL = os.environ.get('LANGGRAPH_SERVER_URL', 'http://localhost:8123')\nLANGGRAPH_API_KEY = os.environ.get('LANGGRAPH_API_KEY', 'your_api_key_here') # Replace with actual key or set env var\n\nasync def main():\n    try:\n        client = get_client(url=LANGGRAPH_SERVER_URL, api_key=LANGGRAPH_API_KEY)\n        print(f\"Connected to LangGraph server at: {LANGGRAPH_SERVER_URL}\")\n\n        # List all assistants (agents/graphs deployed on the server)\n        assistants_page = await client.assistants.search(limit=10)\n        assistants = assistants_page.results # Access the results attribute\n\n        if assistants:\n            print(f\"Found {len(assistants)} assistants:\")\n            for assistant in assistants:\n                print(f\"  - ID: {assistant.assistant_id}, Name: {assistant.name}, Version: {assistant.public_version}\")\n            # Example: Get details of the first assistant\n            first_assistant = await client.assistants.get(assistant_id=assistants[0].assistant_id)\n            print(f\"\\nDetails for first assistant ({first_assistant.name}):\\n{first_assistant.model_dump_json(indent=2)}\")\n        else:\n            print(\"No assistants found on the server.\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Please ensure a LangGraph API server is running and accessible, and LANGGRAPH_API_KEY is correctly set.\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to initialize an asynchronous LangGraph client, connect to a running LangGraph API server (which can be local or remote), and then list the deployed assistants. It highlights the use of `get_client` and retrieving basic information about agents."},"warnings":[{"fix":"Ensure a LangGraph API server is deployed and running. Pass the correct server URL to `get_client(url='YOUR_SERVER_URL')` or set the `LANGGRAPH_SERVER_URL` environment variable.","message":"The `langgraph-sdk` acts as a client and requires a separate, running LangGraph API server to operate. It does not embed the server. If `langgraph-cli` is used locally, the SDK defaults to `http://localhost:8123`, otherwise the server URL must be explicitly provided during client initialization.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For asynchronous code, use `from langgraph_sdk import get_client` and `await` its methods. For synchronous code, use `from langgraph_sdk import get_sync_client` and call its methods directly.","message":"The primary `get_client()` function returns an asynchronous client. For synchronous operations, it is crucial to use `get_sync_client()` instead. Attempting to use the asynchronous client in a synchronous context without proper `await` calls or an event loop will lead to runtime errors or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Set the `LANGGRAPH_API_KEY` environment variable or explicitly provide the API key using `client = get_client(api_key='YOUR_KEY')` or disable it with `client = get_client(api_key=None)`.","message":"By default, `get_client()` (and `get_sync_client()`) attempts to load the API key from the `LANGGRAPH_API_KEY` environment variable. If the key is not set or you explicitly want to connect without an API key (e.g., for an unsecured local development server), you must pass `api_key=None` to the client constructor.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your LangGraph API server configuration to ensure `configurable_headers` are set as needed. Update any custom stream parsing logic to handle the new `ms-seq` event ID format, even if backward compatibility is currently in place, to future-proof your integration.","message":"Recent updates to the underlying LangGraph Agent Server API (which the SDK interacts with) have changed header handling. Headers previously included automatically in runs must now be explicitly allowed by setting `configurable_headers` in the server's configuration. Additionally, the format of stream event IDs for resumable streams has changed to `ms-seq`, although backward compatibility is currently maintained for older formats. This may require adjustments if relying on specific header propagation or event ID parsing.","severity":"breaking","affected_versions":"Agent Server versions v0.7.12 and above (approximately), SDK versions that interact with these server changes."},{"fix":"Install the missing dependency using `pip install typing_extensions`.","message":"The `langgraph-sdk` requires the `typing_extensions` package, but it was not found in the environment. This typically indicates a missing dependency that needs to be explicitly installed for the SDK to function.","severity":"breaking","affected_versions":"All `langgraph-sdk` versions that directly or indirectly depend on `typing_extensions` but do not list it as a mandatory installation requirement, or in environments where it's not otherwise present."}],"env_vars":null,"last_verified":"2026-05-12T18:53:17.605Z","next_check":"2026-06-27T00:00:00.000Z","problems":[{"fix":"Ensure the `LANGSMITH_API_KEY` environment variable is correctly set with a valid API key, or pass it directly when initializing the client, e.g., `client = get_client(api_key='your_api_key')`.","cause":"The provided API key is invalid or missing, preventing successful authentication with the LangGraph API.","error":"langgraph_sdk.errors.AuthenticationError"},{"fix":"Upgrade `langgraph-sdk` and `langgraph-api` to versions where this bug is resolved. If an upgrade is not immediately available, the suggested fix involves modifying `libs/sdk-py/langgraph_sdk/runtime.py` to add `previous: Any = field(default=None)` to `_ExecutionRuntime` and both `context: Any = field(default=None)` and `previous: Any = field(default=None)` to `_ReadRuntime`.","cause":"This is a known bug in specific `langgraph-sdk` and `langgraph-api` versions (including 0.3.12) where internal runtime objects are missing expected attributes during graph schema serialization.","error":"AttributeError: '_ExecutionRuntime' object has no attribute 'previous'"},{"fix":"Install the missing package using pip, for example: `pip install langchain-google-genai`. Ensure all necessary project dependencies are installed in the active virtual environment.","cause":"A required LangChain integration package, such as `langchain-google-genai` for using the Google Gemini LLM, is not installed in the Python environment where the LangGraph application is being run.","error":"ModuleNotFoundError: No module named 'langchain_google_genai'"},{"fix":"Verify that the `url` parameter provided to the `get_client` function or the `LANGGRAPH_API_URL` environment variable is correct. Ensure the LangGraph API server is running and accessible from your environment, and check for any network connectivity problems or firewall restrictions.","cause":"The `langgraph-sdk` client failed to establish a connection with the LangGraph API endpoint, which can be due to network issues, an incorrect API URL, or the API server being unreachable.","error":"langgraph_sdk.errors.APIConnectionError"}],"ecosystem":"pypi","meta_description":null,"install_score":90,"install_tag":"verified","quickstart_score":70,"quickstart_tag":"verified","pypi_latest":"0.3.14","cli_name":"","cli_version":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","installed_version":null,"pypi_latest":"0.3.14","is_stale":null,"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.28,"mem_mb":9.6,"disk_size":"23.3M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.33,"mem_mb":9.5,"disk_size":"23.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":2.7,"import_time_s":0.21,"mem_mb":9.6,"disk_size":"24M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.25,"mem_mb":9.5,"disk_size":"24M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.43,"mem_mb":10.8,"disk_size":"25.6M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.61,"mem_mb":10.8,"disk_size":"25.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":2.7,"import_time_s":0.38,"mem_mb":10.8,"disk_size":"26M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.39,"mem_mb":10.8,"disk_size":"26M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.6,"mem_mb":13.1,"disk_size":"17.3M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.66,"mem_mb":13.1,"disk_size":"17.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":2.4,"import_time_s":0.59,"mem_mb":13.1,"disk_size":"18M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.63,"mem_mb":13.1,"disk_size":"18M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"16.7M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":2.4,"import_time_s":null,"mem_mb":null,"disk_size":"17M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":1,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.25,"mem_mb":9.1,"disk_size":"22.2M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.24,"mem_mb":9.2,"disk_size":"22.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":3.2,"import_time_s":0.23,"mem_mb":9.1,"disk_size":"23M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"langgraph-sdk","exit_code":0,"wheel_type":null,"failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":0.37,"mem_mb":9.2,"disk_size":"23M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}