1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 httpx,
11 httpx-sse,
12 orjson,
13
14 # passthru
15 writeScript,
16}:
17
18buildPythonPackage rec {
19 pname = "langgraph-sdk";
20 version = "0.1.43";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "langchain-ai";
25 repo = "langgraph";
26 tag = "sdk==${version}";
27 hash = "sha256-mG04V36Aa5Df5pUgr+xWej8i2XYx+O/N61sSzxwN9Go=";
28 };
29
30 sourceRoot = "${src.name}/libs/sdk-py";
31
32 build-system = [ poetry-core ];
33
34 dependencies = [
35 httpx
36 httpx-sse
37 orjson
38 ];
39
40 disabledTests = [ "test_aevaluate_results" ]; # Compares execution time to magic number
41
42 pythonImportsCheck = [ "langgraph_sdk" ];
43
44 passthru = {
45 updateScript = writeScript "update.sh" ''
46 #!/usr/bin/env nix-shell
47 #!nix-shell -i bash -p nix-update
48
49 set -eu -o pipefail +e
50 nix-update --commit --version-regex '(.*)' python3Packages.langgraph
51 nix-update --commit --version-regex 'sdk==(.*)' python3Packages.langgraph-sdk
52 nix-update --commit --version-regex 'checkpoint==(.*)' python3Packages.langgraph-checkpoint
53 nix-update --commit --version-regex 'checkpointduckdb==(.*)' python3Packages.langgraph-checkpoint-duckdb
54 nix-update --commit --version-regex 'checkpointpostgres==(.*)' python3Packages.langgraph-checkpoint-postgres
55 nix-update --commit --version-regex 'checkpointsqlite==(.*)' python3Packages.langgraph-checkpoint-sqlite
56 '';
57 };
58
59 meta = {
60 description = "SDK for interacting with the LangGraph Cloud REST API";
61 homepage = "https://github.com/langchain-ai/langgraphtree/main/libs/sdk-py";
62 changelog = "https://github.com/langchain-ai/langgraph/releases/tag/sdk==${version}";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ sarahec ];
65 };
66}