diff --git a/pkgs/development/python-modules/langgraph-prebuilt/default.nix b/pkgs/development/python-modules/langgraph-prebuilt/default.nix new file mode 100644 index 000000000000..73a1d6ade3ad --- /dev/null +++ b/pkgs/development/python-modules/langgraph-prebuilt/default.nix @@ -0,0 +1,104 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + poetry-core, + + # dependencies + langchain-core, + langgraph-checkpoint, + + # tests + langgraph-checkpoint-postgres, + langgraph-checkpoint-sqlite, + postgresql, + postgresqlTestHook, + psycopg-pool, + psycopg, + pytest-asyncio, + pytest-mock, + pytestCheckHook, + + # passthru + nix-update-script, +}: +# langgraph-prebuilt isn't meant to be a standalone package but is bundled into langgraph at build time. +# It exists so the langgraph team can iterate on it without having to rebuild langgraph. +buildPythonPackage rec { + pname = "langgraph-prebuilt"; + version = "0.1.8"; + pyproject = true; + + src = fetchFromGitHub { + owner = "langchain-ai"; + repo = "langgraph"; + tag = "prebuilt==${version}"; + hash = "sha256-mYcj7HRbB5H6G0CVLOICKgdtR5Wlv9WeTIBjQJqlhOE="; + }; + + sourceRoot = "${src.name}/libs/prebuilt"; + + build-system = [ poetry-core ]; + + dependencies = [ + langchain-core + langgraph-checkpoint + ]; + + skipPythonImportsCheck = true; # This will be packaged with langgraph + + # postgresql doesn't play nicely with the darwin sandbox: + # FATAL: could not create shared memory segment: Operation not permitted + doCheck = !stdenv.hostPlatform.isDarwin; + + nativeCheckInputs = [ + pytestCheckHook + postgresql + postgresqlTestHook + ]; + + checkInputs = [ + langgraph-checkpoint + langgraph-checkpoint-postgres + langgraph-checkpoint-sqlite + psycopg + psycopg-pool + pytest-asyncio + pytest-mock + ]; + + preCheck = '' + export PYTHONPATH=${src}/libs/langgraph:$PYTHONPATH + ''; + + pytestFlagsArray = [ + "-W" + "ignore::pytest.PytestDeprecationWarning" + "-W" + "ignore::DeprecationWarning" + ]; + + disabledTestPaths = [ + # psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5442 failed: Connection refused + # Is the server running on that host and accepting TCP/IP connections? + "tests/test_react_agent.py" + ]; + + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "prebuilt==(\\d+\\.\\d+\\.\\d+)" + ]; + }; + + meta = { + description = "Prebuilt agents add-on for Langgraph. Should always be bundled with langgraph"; + homepage = "https://github.com/langchain-ai/langgraph"; + changelog = "https://github.com/langchain-ai/langgraph/releases/tag/${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ sarahec ]; + }; +} diff --git a/pkgs/development/python-modules/langgraph/default.nix b/pkgs/development/python-modules/langgraph/default.nix index f99b92d1de14..8cd814b4af6d 100644 --- a/pkgs/development/python-modules/langgraph/default.nix +++ b/pkgs/development/python-modules/langgraph/default.nix @@ -10,7 +10,9 @@ # dependencies langchain-core, langgraph-checkpoint, + langgraph-prebuilt, langgraph-sdk, + xxhash, # tests aiosqlite, @@ -33,80 +35,16 @@ postgresql, postgresqlTestHook, }: -let - # langgraph-prebuilt isn't meant to be a standalone package but is bundled into langgraph at build time. - # It exists so the langgraph team can iterate on it without having to rebuild langgraph. - langgraph-prebuilt = buildPythonPackage rec { - pname = "langgraph-prebuilt"; - version = "0.1.1"; - pyproject = true; - - src = fetchFromGitHub { - owner = "langchain-ai"; - repo = "langgraph"; - tag = "prebuilt==${version}"; - hash = "sha256-Kyyr4BSrUReC6jBp4LItuS/JNSzGK5IUaPl7UaLse78="; - }; - - sourceRoot = "${src.name}/libs/prebuilt"; - - build-system = [ poetry-core ]; - - dependencies = [ - langchain-core - langgraph-checkpoint - ]; - - skipPythonImportsCheck = true; # This will be packaged with langgraph - - # postgresql doesn't play nicely with the darwin sandbox: - # FATAL: could not create shared memory segment: Operation not permitted - doCheck = !stdenv.hostPlatform.isDarwin; - - nativeCheckInputs = [ - pytestCheckHook - postgresql - postgresqlTestHook - ]; - - checkInputs = [ - langgraph-checkpoint - langgraph-checkpoint-postgres - langgraph-checkpoint-sqlite - psycopg - psycopg-pool - pytest-asyncio - pytest-mock - ]; - - preCheck = '' - export PYTHONPATH=${src}/libs/langgraph:$PYTHONPATH - ''; - - pytestFlagsArray = [ - "-W" - "ignore::pytest.PytestDeprecationWarning" - "-W" - "ignore::DeprecationWarning" - ]; - - disabledTestPaths = [ - # psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5442 failed: Connection refused - # Is the server running on that host and accepting TCP/IP connections? - "tests/test_react_agent.py" - ]; - }; -in buildPythonPackage rec { pname = "langgraph"; - version = "0.3.2"; + version = "0.3.24"; pyproject = true; src = fetchFromGitHub { owner = "langchain-ai"; repo = "langgraph"; tag = "${version}"; - hash = "sha256-EawVIzG+db2k6/tQyUHCF6SzlO77QTXsYRUm3XpLu/c="; + hash = "sha256-NlTpBXBeADlIHQDlt0muJEuoKOgXiAtAo8GoU5CsvZo="; }; postgresqlTestSetupPost = '' @@ -123,6 +61,7 @@ buildPythonPackage rec { langgraph-checkpoint langgraph-prebuilt langgraph-sdk + xxhash ]; pythonImportsCheck = [ "langgraph" ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7270fd25d512..00c6bc450949 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7464,6 +7464,8 @@ self: super: with self; { langgraph-cli = callPackage ../development/python-modules/langgraph-cli { }; + langgraph-prebuilt = callPackage ../development/python-modules/langgraph-prebuilt { }; + langgraph-sdk = callPackage ../development/python-modules/langgraph-sdk { }; langid = callPackage ../development/python-modules/langid { };