1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 hatchling, 9 10 # dependencies 11 langchain-core, 12 langgraph-checkpoint, 13 14 # tests 15 langgraph-checkpoint-postgres, 16 langgraph-checkpoint-sqlite, 17 postgresql, 18 postgresqlTestHook, 19 psycopg, 20 psycopg-pool, 21 pytest-asyncio, 22 pytest-mock, 23 pytestCheckHook, 24 syrupy, 25 xxhash, 26 27 # passthru 28 gitUpdater, 29}: 30# langgraph-prebuilt isn't meant to be a standalone package but is bundled into langgraph at build time. 31# It exists so the langgraph team can iterate on it without having to rebuild langgraph. 32buildPythonPackage rec { 33 pname = "langgraph-prebuilt"; 34 version = "0.6.4"; 35 pyproject = true; 36 37 src = fetchFromGitHub { 38 owner = "langchain-ai"; 39 repo = "langgraph"; 40 tag = "prebuilt==${version}"; 41 hash = "sha256-9jl16cKp3E7j79PXrr/3splrcJtfQQN7yFJ5sfa6c+I="; 42 }; 43 44 sourceRoot = "${src.name}/libs/prebuilt"; 45 46 build-system = [ hatchling ]; 47 48 dependencies = [ 49 langchain-core 50 langgraph-checkpoint 51 ]; 52 53 skipPythonImportsCheck = true; # This will be packaged with langgraph 54 55 # postgresql doesn't play nicely with the darwin sandbox: 56 # FATAL: could not create shared memory segment: Operation not permitted 57 doCheck = !stdenv.hostPlatform.isDarwin; 58 59 nativeCheckInputs = [ 60 langgraph-checkpoint 61 langgraph-checkpoint-postgres 62 langgraph-checkpoint-sqlite 63 postgresql 64 postgresqlTestHook 65 psycopg 66 psycopg-pool 67 pytest-asyncio 68 pytest-mock 69 pytestCheckHook 70 syrupy 71 xxhash 72 ]; 73 74 preCheck = '' 75 export PYTHONPATH=${src}/libs/langgraph:$PYTHONPATH 76 ''; 77 78 pytestFlags = [ 79 "-Wignore::pytest.PytestDeprecationWarning" 80 "-Wignore::DeprecationWarning" 81 ]; 82 83 disabledTestPaths = [ 84 # psycopg.OperationalError: connection failed: connection to server at "127.0.0.1", port 5442 failed: Connection refused 85 # Is the server running on that host and accepting TCP/IP connections? 86 "tests/test_react_agent.py" 87 88 # Utilities to import 89 "tests/conftest.py" 90 ]; 91 92 passthru = { 93 # python updater script sets the wrong tag 94 skipBulkUpdate = true; 95 updateScript = gitUpdater { 96 rev-prefix = "prebuilt=="; 97 }; 98 }; 99 100 meta = { 101 description = "Prebuilt agents add-on for Langgraph. Should always be bundled with langgraph"; 102 homepage = "https://github.com/langchain-ai/langgraph/tree/main/libs/prebuilt"; 103 changelog = "https://github.com/langchain-ai/langgraph/releases/tag/${src.tag}"; 104 license = lib.licenses.mit; 105 maintainers = with lib.maintainers; [ sarahec ]; 106 }; 107}