langgraph-api 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of langgraph-api might be problematic. Click here for more details.

Files changed (86) hide show
  1. LICENSE +93 -0
  2. langgraph_api/__init__.py +0 -0
  3. langgraph_api/api/__init__.py +63 -0
  4. langgraph_api/api/assistants.py +326 -0
  5. langgraph_api/api/meta.py +71 -0
  6. langgraph_api/api/openapi.py +32 -0
  7. langgraph_api/api/runs.py +463 -0
  8. langgraph_api/api/store.py +116 -0
  9. langgraph_api/api/threads.py +263 -0
  10. langgraph_api/asyncio.py +201 -0
  11. langgraph_api/auth/__init__.py +0 -0
  12. langgraph_api/auth/langsmith/__init__.py +0 -0
  13. langgraph_api/auth/langsmith/backend.py +67 -0
  14. langgraph_api/auth/langsmith/client.py +145 -0
  15. langgraph_api/auth/middleware.py +41 -0
  16. langgraph_api/auth/noop.py +14 -0
  17. langgraph_api/cli.py +209 -0
  18. langgraph_api/config.py +70 -0
  19. langgraph_api/cron_scheduler.py +60 -0
  20. langgraph_api/errors.py +52 -0
  21. langgraph_api/graph.py +314 -0
  22. langgraph_api/http.py +168 -0
  23. langgraph_api/http_logger.py +89 -0
  24. langgraph_api/js/.gitignore +2 -0
  25. langgraph_api/js/build.mts +49 -0
  26. langgraph_api/js/client.mts +849 -0
  27. langgraph_api/js/global.d.ts +6 -0
  28. langgraph_api/js/package.json +33 -0
  29. langgraph_api/js/remote.py +673 -0
  30. langgraph_api/js/server_sent_events.py +126 -0
  31. langgraph_api/js/src/graph.mts +88 -0
  32. langgraph_api/js/src/hooks.mjs +12 -0
  33. langgraph_api/js/src/parser/parser.mts +443 -0
  34. langgraph_api/js/src/parser/parser.worker.mjs +12 -0
  35. langgraph_api/js/src/schema/types.mts +2136 -0
  36. langgraph_api/js/src/schema/types.template.mts +74 -0
  37. langgraph_api/js/src/utils/importMap.mts +85 -0
  38. langgraph_api/js/src/utils/pythonSchemas.mts +28 -0
  39. langgraph_api/js/src/utils/serde.mts +21 -0
  40. langgraph_api/js/tests/api.test.mts +1566 -0
  41. langgraph_api/js/tests/compose-postgres.yml +56 -0
  42. langgraph_api/js/tests/graphs/.gitignore +1 -0
  43. langgraph_api/js/tests/graphs/agent.mts +127 -0
  44. langgraph_api/js/tests/graphs/error.mts +17 -0
  45. langgraph_api/js/tests/graphs/langgraph.json +8 -0
  46. langgraph_api/js/tests/graphs/nested.mts +44 -0
  47. langgraph_api/js/tests/graphs/package.json +7 -0
  48. langgraph_api/js/tests/graphs/weather.mts +57 -0
  49. langgraph_api/js/tests/graphs/yarn.lock +159 -0
  50. langgraph_api/js/tests/parser.test.mts +870 -0
  51. langgraph_api/js/tests/utils.mts +17 -0
  52. langgraph_api/js/yarn.lock +1340 -0
  53. langgraph_api/lifespan.py +41 -0
  54. langgraph_api/logging.py +121 -0
  55. langgraph_api/metadata.py +101 -0
  56. langgraph_api/models/__init__.py +0 -0
  57. langgraph_api/models/run.py +229 -0
  58. langgraph_api/patch.py +42 -0
  59. langgraph_api/queue.py +245 -0
  60. langgraph_api/route.py +118 -0
  61. langgraph_api/schema.py +190 -0
  62. langgraph_api/serde.py +124 -0
  63. langgraph_api/server.py +48 -0
  64. langgraph_api/sse.py +118 -0
  65. langgraph_api/state.py +67 -0
  66. langgraph_api/stream.py +289 -0
  67. langgraph_api/utils.py +60 -0
  68. langgraph_api/validation.py +141 -0
  69. langgraph_api-0.0.1.dist-info/LICENSE +93 -0
  70. langgraph_api-0.0.1.dist-info/METADATA +26 -0
  71. langgraph_api-0.0.1.dist-info/RECORD +86 -0
  72. langgraph_api-0.0.1.dist-info/WHEEL +4 -0
  73. langgraph_api-0.0.1.dist-info/entry_points.txt +3 -0
  74. langgraph_license/__init__.py +0 -0
  75. langgraph_license/middleware.py +21 -0
  76. langgraph_license/validation.py +11 -0
  77. langgraph_storage/__init__.py +0 -0
  78. langgraph_storage/checkpoint.py +94 -0
  79. langgraph_storage/database.py +190 -0
  80. langgraph_storage/ops.py +1523 -0
  81. langgraph_storage/queue.py +108 -0
  82. langgraph_storage/retry.py +27 -0
  83. langgraph_storage/store.py +28 -0
  84. langgraph_storage/ttl_dict.py +54 -0
  85. logging.json +22 -0
  86. openapi.json +4304 -0
@@ -0,0 +1,141 @@
1
+ import pathlib
2
+
3
+ import jsonschema_rs
4
+ import orjson
5
+
6
+ with open(pathlib.Path(__file__).parent.parent / "openapi.json") as f:
7
+ openapi_str = f.read()
8
+
9
+ openapi = orjson.loads(openapi_str)
10
+
11
+ AssistantVersionsSearchRequest = jsonschema_rs.validator_for(
12
+ openapi["components"]["schemas"]["AssistantVersionsSearchRequest"]
13
+ )
14
+ AssistantSearchRequest = jsonschema_rs.validator_for(
15
+ openapi["components"]["schemas"]["AssistantSearchRequest"]
16
+ )
17
+ ThreadSearchRequest = jsonschema_rs.validator_for(
18
+ openapi["components"]["schemas"]["ThreadSearchRequest"]
19
+ )
20
+ AssistantCreate = jsonschema_rs.validator_for(
21
+ openapi["components"]["schemas"]["AssistantCreate"]
22
+ )
23
+ AssistantPatch = jsonschema_rs.validator_for(
24
+ openapi["components"]["schemas"]["AssistantPatch"]
25
+ )
26
+ AssistantVersionChange = jsonschema_rs.validator_for(
27
+ openapi["components"]["schemas"]["AssistantVersionChange"]
28
+ )
29
+ ThreadCreate = jsonschema_rs.validator_for(
30
+ openapi["components"]["schemas"]["ThreadCreate"]
31
+ )
32
+ ThreadPatch = jsonschema_rs.validator_for(
33
+ openapi["components"]["schemas"]["ThreadPatch"]
34
+ )
35
+ ThreadStateUpdate = jsonschema_rs.validator_for(
36
+ {
37
+ **openapi["components"]["schemas"]["ThreadStateUpdate"],
38
+ "components": {
39
+ "schemas": {
40
+ "CheckpointConfig": openapi["components"]["schemas"]["CheckpointConfig"]
41
+ }
42
+ },
43
+ }
44
+ )
45
+ ThreadStateCheckpointRequest = jsonschema_rs.validator_for(
46
+ {
47
+ **openapi["components"]["schemas"]["ThreadStateCheckpointRequest"],
48
+ "components": {
49
+ "schemas": {
50
+ "CheckpointConfig": openapi["components"]["schemas"]["CheckpointConfig"]
51
+ }
52
+ },
53
+ }
54
+ )
55
+ ThreadStateSearch = jsonschema_rs.validator_for(
56
+ {
57
+ **openapi["components"]["schemas"]["ThreadStateSearch"],
58
+ "components": {
59
+ "schemas": {
60
+ "CheckpointConfig": openapi["components"]["schemas"]["CheckpointConfig"]
61
+ }
62
+ },
63
+ }
64
+ )
65
+ RunCreateStateless = jsonschema_rs.validator_for(
66
+ {
67
+ **openapi["components"]["schemas"]["RunCreateStateless"],
68
+ "components": {
69
+ "schemas": {
70
+ "Command": openapi["components"]["schemas"]["Command"],
71
+ "Send": openapi["components"]["schemas"]["Send"],
72
+ }
73
+ },
74
+ }
75
+ )
76
+ RunBatchCreate = jsonschema_rs.validator_for(
77
+ {
78
+ **openapi["components"]["schemas"]["RunBatchCreate"],
79
+ "components": {
80
+ "schemas": {
81
+ "RunCreateStateless": openapi["components"]["schemas"][
82
+ "RunCreateStateless"
83
+ ],
84
+ "Command": openapi["components"]["schemas"]["Command"],
85
+ "Send": openapi["components"]["schemas"]["Send"],
86
+ }
87
+ },
88
+ }
89
+ )
90
+ RunCreateStateful = jsonschema_rs.validator_for(
91
+ {
92
+ **openapi["components"]["schemas"]["RunCreateStateful"],
93
+ "components": {
94
+ "schemas": {
95
+ "CheckpointConfig": openapi["components"]["schemas"][
96
+ "CheckpointConfig"
97
+ ],
98
+ "Command": openapi["components"]["schemas"]["Command"],
99
+ "Send": openapi["components"]["schemas"]["Send"],
100
+ }
101
+ },
102
+ }
103
+ )
104
+ CronCreate = jsonschema_rs.validator_for(openapi["components"]["schemas"]["CronCreate"])
105
+ CronSearch = jsonschema_rs.validator_for(openapi["components"]["schemas"]["CronSearch"])
106
+
107
+
108
+ # Stuff around storage/BaseStore API
109
+ StorePutRequest = jsonschema_rs.validator_for(
110
+ openapi["components"]["schemas"]["StorePutRequest"]
111
+ )
112
+ StoreSearchRequest = jsonschema_rs.validator_for(
113
+ openapi["components"]["schemas"]["StoreSearchRequest"]
114
+ )
115
+ StoreDeleteRequest = jsonschema_rs.validator_for(
116
+ openapi["components"]["schemas"]["StoreDeleteRequest"]
117
+ )
118
+ StoreListNamespacesRequest = jsonschema_rs.validator_for(
119
+ openapi["components"]["schemas"]["StoreListNamespacesRequest"]
120
+ )
121
+
122
+
123
+ DOCS_HTML = """<!doctype html>
124
+ <html>
125
+ <head>
126
+ <title>Scalar API Reference</title>
127
+ <meta charset="utf-8" />
128
+ <meta
129
+ name="viewport"
130
+ content="width=device-width, initial-scale=1" />
131
+ </head>
132
+ <body>
133
+ <script id="api-reference" data-url="/openapi.json"></script>
134
+ <script>
135
+ var configuration = {}
136
+ document.getElementById('api-reference').dataset.configuration =
137
+ JSON.stringify(configuration)
138
+ </script>
139
+ <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
140
+ </body>
141
+ </html>"""
@@ -0,0 +1,93 @@
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject to
14
+ the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor’s trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion
77
+ of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that
84
+ organization. **control** means ownership of substantially all the assets of an
85
+ entity, or the power to direct its management and policies by vote, contract, or
86
+ otherwise. Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.1
2
+ Name: langgraph-api
3
+ Version: 0.0.1
4
+ Summary:
5
+ License: Elastic-2.0
6
+ Author: Nuno Campos
7
+ Author-email: nuno@langchain.dev
8
+ Requires-Python: >=3.11.0,<4.0
9
+ Classifier: License :: Other/Proprietary License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: cryptography (>=43.0.3,<44.0.0)
14
+ Requires-Dist: httpx (>=0.27.0)
15
+ Requires-Dist: jsonschema-rs (>=0.25.0,<0.26.0)
16
+ Requires-Dist: langchain-core (>=0.2.38,<0.4.0)
17
+ Requires-Dist: langgraph (>=0.2.52)
18
+ Requires-Dist: langsmith (>=0.1.63,<0.2.0)
19
+ Requires-Dist: orjson (>=3.10.1)
20
+ Requires-Dist: pyjwt (>=2.9.0,<3.0.0)
21
+ Requires-Dist: sse-starlette (>=2.1.0,<3.0.0)
22
+ Requires-Dist: starlette (>=0.38.6)
23
+ Requires-Dist: structlog (>=24.4.0,<25.0.0)
24
+ Requires-Dist: tenacity (>=8.3.0,<9.0.0)
25
+ Requires-Dist: uvicorn (>=0.26.0)
26
+ Requires-Dist: watchfiles (>=0.13)
@@ -0,0 +1,86 @@
1
+ LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
2
+ langgraph_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ langgraph_api/api/__init__.py,sha256=tlMXuqnyJt99aSlUXwR-dS3w5X6sDDczJu4hbm2LP30,2057
4
+ langgraph_api/api/assistants.py,sha256=Nup-Sk6HKgYxJfDZQ0tZIVuUnD18gVd7wSiSairOyZE,11252
5
+ langgraph_api/api/meta.py,sha256=hueasWpTDQ6xYLo9Bzt2jhNH8XQRzreH8FTeFfnRoxQ,2700
6
+ langgraph_api/api/openapi.py,sha256=zvKMMebBP28hLPMNt1kTtFK17aV9Tz-ok2okEM45XjA,906
7
+ langgraph_api/api/runs.py,sha256=Z4PyBk11zvrbYxHeXy8uZimpc3LoAdpku3DEQa79IWU,15535
8
+ langgraph_api/api/store.py,sha256=ZQ1O9m24WDR0l8bJxgw6nBjDxaWUVXM1hoOR1acA9eg,4096
9
+ langgraph_api/api/threads.py,sha256=taU61XPcCEhBPCYPZcMDsgVDwwWUWJs8p-PrXFXWY48,8661
10
+ langgraph_api/asyncio.py,sha256=XiFEllu-Kg4zAO084npHPYOPnLQRire3V75XrVQYMxE,6023
11
+ langgraph_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ langgraph_api/auth/langsmith/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ langgraph_api/auth/langsmith/backend.py,sha256=uHeb5-h13NIjrX_LDAvfWYr3zpbJvlvbdUffch48hbM,2571
14
+ langgraph_api/auth/langsmith/client.py,sha256=eKchvAom7hdkUXauD8vHNceBDDUijrFgdTV8bKd7x4Q,3998
15
+ langgraph_api/auth/middleware.py,sha256=_gJTOskEaln4RUT2rVYdQGPJVAyAiq-orsL_eQ3CynE,1369
16
+ langgraph_api/auth/noop.py,sha256=vDJmzG2vArJxVzdHePvrJWahEa0dvGnhc2LEMMeiFz0,391
17
+ langgraph_api/cli.py,sha256=gpFhsGLeG8kFdG_gx5xBwZwuCdwct4HZqyKsFRCQm6E,6496
18
+ langgraph_api/config.py,sha256=cG6eO4P_SZ2pKedb2b4n4vnBHRQr0aiECvGvOA8ZlJA,2259
19
+ langgraph_api/cron_scheduler.py,sha256=DAzY2DsADzEpPVbG2BOSLTIufI93yeRswd71Aby_lV0,2257
20
+ langgraph_api/errors.py,sha256=Bu_i5drgNTyJcLiyrwVE_6-XrSU50BHf9TDpttki9wQ,1690
21
+ langgraph_api/graph.py,sha256=A9-l7cUvesyC3ymY_XFXxT02VG2kkoqbSYUDvjga5S0,9771
22
+ langgraph_api/http.py,sha256=XrbyxpjtfSvnaWWh5ZLGpgZmY83WoDCrP_1GPguNiXI,4712
23
+ langgraph_api/http_logger.py,sha256=Sxo_q-65tElauRvkzVLt9lJojgNdgtcHGBYD0IRyX7M,3146
24
+ langgraph_api/js/.gitignore,sha256=qAah3Fq0HWAlfRj5ktZyC6QRQIsAolGLRGcRukA1XJI,33
25
+ langgraph_api/js/build.mts,sha256=v4ZJFnfBJBuLn8g0q-Uab9sgNtcssXcFEI-CmMoiOBc,1301
26
+ langgraph_api/js/client.mts,sha256=nmWjL3Zs9jm8JoKPp8nrNNeRzwISTMqcZqqsDGx0SYE,24189
27
+ langgraph_api/js/global.d.ts,sha256=zR_zLYfpzyPfxpEFth5RgZoyfGulIXyZYPRf7cU0K0Y,106
28
+ langgraph_api/js/package.json,sha256=glTUiod6sTKOXoGX7C7XcUXLeB_6Xa0hIw7MmJq2EY8,792
29
+ langgraph_api/js/remote.py,sha256=n34B4X1sZW70vEF1hMQ4vn28BroZJt7_7BGaJ0TNeBU,23306
30
+ langgraph_api/js/server_sent_events.py,sha256=DLgXOHauemt7706vnfDUCG1GI3TidKycSizccdz9KgA,3702
31
+ langgraph_api/js/src/graph.mts,sha256=Gh2-TcCepeRhqMk8Bm1tWm5sv53y2FxgSclUTamnLNw,2636
32
+ langgraph_api/js/src/hooks.mjs,sha256=IfPwixktR6W5FA8yNmmBVDVAaqBA549WZKuj1uQedVY,511
33
+ langgraph_api/js/src/parser/parser.mts,sha256=wXre7teh8N8RYmGcyhZp4vMJd0kNnnFgoSGEyMVPzpQ,13007
34
+ langgraph_api/js/src/parser/parser.worker.mjs,sha256=2K6D0GlUmkk7LE39I8mryB8VZVE3-N9Cblji-ArPhFo,386
35
+ langgraph_api/js/src/schema/types.mts,sha256=SUj0vpvWVbID1mnGr2SUtumDBQkJ9zjfvJdoFP7DIzk,66536
36
+ langgraph_api/js/src/schema/types.template.mts,sha256=c-FA0Ykzp4KvPyYA6a-hDf60KdQRMyFEjmGVJyD2OPM,2011
37
+ langgraph_api/js/src/utils/importMap.mts,sha256=pX4TGOyUpuuWF82kXcxcv3-8mgusRezOGe6Uklm2O5A,1644
38
+ langgraph_api/js/src/utils/pythonSchemas.mts,sha256=98IW7Z_VP7L_CHNRMb3_MsiV3BgLE2JsWQY_PQcRR3o,685
39
+ langgraph_api/js/src/utils/serde.mts,sha256=5SO-wYPnPa8f-D6HQX5Oy3NX3nuziZM8vQMqc2tuxbk,531
40
+ langgraph_api/js/tests/api.test.mts,sha256=tuOZFGYgPld4kfm-S_SNXBwm3Ugp7h2PPuGLIyCjn24,49654
41
+ langgraph_api/js/tests/compose-postgres.yml,sha256=7VCpWUgPjCzybf6Gu6pT788sZsxUnTjhbmji6c33cVc,1639
42
+ langgraph_api/js/tests/graphs/.gitignore,sha256=26J8MarZNXh7snXD5eTpV3CPFTht5Znv8dtHYCLNfkw,12
43
+ langgraph_api/js/tests/graphs/agent.mts,sha256=_E0JUf1U_yXJeqOMEhl2QqbbdADZR4zpLhiZk8SEWRc,3686
44
+ langgraph_api/js/tests/graphs/error.mts,sha256=l4tk89449dj1BnEF_0ZcfPt0Ikk1gl8L1RaSnRfr3xo,487
45
+ langgraph_api/js/tests/graphs/langgraph.json,sha256=-wSU_9H2fraq7Tijq_dTuK8SBDYLHsnfrYgi2zYUK2o,155
46
+ langgraph_api/js/tests/graphs/nested.mts,sha256=4G7jSOSaFVQAza-_ARbK-Iai1biLlF2DIPDZXf7PLIY,1245
47
+ langgraph_api/js/tests/graphs/package.json,sha256=g6GuOmLghaTYMSFoAoYa7lrIZyPwOETKaJNec-yT9n8,118
48
+ langgraph_api/js/tests/graphs/weather.mts,sha256=A7mLK3xW8h5B-ZyJNAyX2M2fJJwzPJzXs4DYesJwreQ,1655
49
+ langgraph_api/js/tests/graphs/yarn.lock,sha256=6GvNkJgzMDmLiw13ilBXOyelM3YHwUFySTdSbtNBpY8,7255
50
+ langgraph_api/js/tests/parser.test.mts,sha256=3zAbboUNhI-cY3hj4Ssr7J-sQXCBTeeI1ItrkG0Ftuk,26257
51
+ langgraph_api/js/tests/utils.mts,sha256=2kTybJ3O7Yfe1q3ehDouqV54ibXkNzsPZ_wBZLJvY-4,421
52
+ langgraph_api/js/yarn.lock,sha256=sDKfB7VCWOapKFBT5IgF_wQKMYuu5q92WNHrlk9NGgc,65156
53
+ langgraph_api/lifespan.py,sha256=Uj7NV-NqxxD1fgx_umM9pVqclcy-VlqrIxDljyj2he0,1820
54
+ langgraph_api/logging.py,sha256=tiDNrEFwqaIdL5ywZv908OXlzzfXsPCws9GXeoFtBV8,3367
55
+ langgraph_api/metadata.py,sha256=mih2G7ScQxiqyUlbksVXkqR3Oo-pM1b6lXtzOsgR1sw,3044
56
+ langgraph_api/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
+ langgraph_api/models/run.py,sha256=nNhlG-l2P-DThFWYmCaar0UuPctadB9sH3CCWJfLqVc,8178
58
+ langgraph_api/patch.py,sha256=94ddcTSZJe22JcpjxiSNjFZdYVnmeoWjk4IX4iBSoyk,1249
59
+ langgraph_api/queue.py,sha256=m_LcZ_KZO1PVROQxlHXZDud7CYBroZv9M3oLJ4n_qYA,9456
60
+ langgraph_api/route.py,sha256=Dzje_dSigJramglqkt4ERT9-cb2xFli7dx25ZV6B6mI,4147
61
+ langgraph_api/schema.py,sha256=kEhwg9MUvlHKUDCvomRUts3ja53IlXHgz70H1_AXMvk,5138
62
+ langgraph_api/serde.py,sha256=VoJ7Z1IuqrQGXFzEP1qijAITtWCrmjtVqlCRuScjXJI,3533
63
+ langgraph_api/server.py,sha256=cCD2lVv0SZdgf0o797UfxUyjFwmoazJVCjl_j-8Ae7A,1523
64
+ langgraph_api/sse.py,sha256=2wNodCOP2eg7a9mpSu0S3FQ0CHk2BBV_vv0UtIgJIcc,4034
65
+ langgraph_api/state.py,sha256=8jx4IoTCOjTJuwzuXJKKFwo1VseHjNnw_CCq4x1SW14,2284
66
+ langgraph_api/stream.py,sha256=8VaGGUbh4BC_NJrAHeuPZgeLmRY0E8wNC0UkobLViqQ,11022
67
+ langgraph_api/utils.py,sha256=FI50tOFMVidV4-1TefouL1N-OJX41qD_fSEoWigTtf0,1575
68
+ langgraph_api/validation.py,sha256=McizHlz-Ez8Jhdbc79mbPSde7GIuf2Jlbjx2yv_l6dA,4475
69
+ langgraph_license/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
+ langgraph_license/middleware.py,sha256=_ODIYzQkymr6W9_Fp9wtf1kAQspnpsmr53xuzyF2GA0,612
71
+ langgraph_license/validation.py,sha256=th7OP0JZ8R8uf7vKRpfl0K3LOI0dyCKBPBxwdmgcDOk,202
72
+ langgraph_storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
+ langgraph_storage/checkpoint.py,sha256=9mJTKXo4LIatr0nD7AX2mU8p9q18XaRnSSi25kNQcGc,2691
74
+ langgraph_storage/database.py,sha256=0bB4y2rWBYiT4Jsmvbbsams4Q8G0CgEwPVwclz6iQrM,4924
75
+ langgraph_storage/ops.py,sha256=0btWlZnl7hl3KC7C9IIKzlsmUPilF-MQe4WwLVLymfs,51884
76
+ langgraph_storage/queue.py,sha256=6cTZ0ubHu3S1T43yxHMVOwsQsDaJupByiU0sTUFFls8,3261
77
+ langgraph_storage/retry.py,sha256=uvYFuXJ-T6S1QY1ZwkZHyZQbsvS-Ab68LSbzbUUSI2E,696
78
+ langgraph_storage/store.py,sha256=Z033CojJb6jMZbMu3VPtwR0bFdfyfdUS8dQSaXUASYU,731
79
+ langgraph_storage/ttl_dict.py,sha256=FlpEY8EANeXWKo_G5nmIotPquABZGyIJyk6HD9u6vqY,1533
80
+ logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
81
+ openapi.json,sha256=JaieC_zSdQ9bzqJYdHUfCOnNt0ALBWcdj7uVjRLh9M8,122950
82
+ langgraph_api-0.0.1.dist-info/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
83
+ langgraph_api-0.0.1.dist-info/METADATA,sha256=Q9T28mju11J_KEkHOBUGUlbg2ig5g1atanoHMKCpKKs,932
84
+ langgraph_api-0.0.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
85
+ langgraph_api-0.0.1.dist-info/entry_points.txt,sha256=3EYLgj89DfzqJHHYGxPH4A_fEtClvlRbWRUHaXO7hj4,77
86
+ langgraph_api-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ langgraph-verify-graphs=langgraph_api.graph:verify_graphs
3
+
File without changes
@@ -0,0 +1,21 @@
1
+ """Middleware for license validation."""
2
+
3
+ from typing import Any
4
+
5
+ from starlette.middleware.base import BaseHTTPMiddleware
6
+ from starlette.requests import Request
7
+ from starlette.responses import Response
8
+ from starlette.types import ASGIApp
9
+
10
+
11
+ class LicenseValidationMiddleware(BaseHTTPMiddleware):
12
+ """Noop license middleware"""
13
+
14
+ def __init__(self, app: ASGIApp):
15
+ """Initialize middleware."""
16
+ super().__init__(app)
17
+
18
+ async def dispatch(self, request: Request, call_next: Any) -> Response:
19
+ """Noop middleware."""
20
+ response = await call_next(request)
21
+ return response
@@ -0,0 +1,11 @@
1
+ """Noop license middleware"""
2
+
3
+
4
+ async def get_license_status() -> bool:
5
+ """Always return true"""
6
+ return True
7
+
8
+
9
+ def plus_features_enabled() -> bool:
10
+ """Always return true"""
11
+ return False
File without changes
@@ -0,0 +1,94 @@
1
+ import os
2
+ import uuid
3
+
4
+ from langchain_core.runnables import RunnableConfig
5
+ from langgraph.checkpoint.base import (
6
+ Checkpoint,
7
+ CheckpointMetadata,
8
+ CheckpointTuple,
9
+ SerializerProtocol,
10
+ )
11
+ from langgraph.checkpoint.memory import MemorySaver, PersistentDict
12
+
13
+ _EXCLUDED_KEYS = {"checkpoint_ns", "checkpoint_id", "run_id", "thread_id"}
14
+
15
+
16
+ class InMemorySaver(MemorySaver):
17
+ def __init__(
18
+ self,
19
+ *,
20
+ serde: SerializerProtocol | None = None,
21
+ ) -> None:
22
+ self.filename = os.path.join(".langgraph_api", ".langgraph_checkpoint.")
23
+ i = 0
24
+
25
+ def factory(*args):
26
+ nonlocal i
27
+ i += 1
28
+
29
+ thisfname = self.filename + str(i) + ".pckl"
30
+ d = PersistentDict(*args, filename=thisfname)
31
+ if not os.path.exists(".langgraph_api"):
32
+ os.mkdir(".langgraph_api")
33
+ try:
34
+ d.load()
35
+ except FileNotFoundError:
36
+ pass
37
+ return d
38
+
39
+ super().__init__(
40
+ serde=serde,
41
+ factory=factory,
42
+ )
43
+
44
+ def put(
45
+ self,
46
+ config: RunnableConfig,
47
+ checkpoint: Checkpoint,
48
+ metadata: CheckpointMetadata,
49
+ new_versions: dict[str, str | int | float],
50
+ ) -> RunnableConfig:
51
+ # TODO: Should this be done in OSS as well?
52
+ metadata = {
53
+ **{
54
+ k: v
55
+ for k, v in config["configurable"].items()
56
+ if not k.startswith("__") and k not in _EXCLUDED_KEYS
57
+ },
58
+ **config.get("metadata", {}),
59
+ **metadata,
60
+ }
61
+ if not isinstance(checkpoint["id"], uuid.UUID):
62
+ # Avoid type inconsistencies
63
+ checkpoint = checkpoint.copy()
64
+ checkpoint["id"] = str(checkpoint["id"])
65
+ return super().put(config, checkpoint, metadata, new_versions)
66
+
67
+ def get_tuple(self, config: RunnableConfig) -> CheckpointTuple | None:
68
+ if isinstance(config["configurable"].get("checkpoint_id"), uuid.UUID):
69
+ # Avoid type inconsistencies....
70
+ config = config.copy()
71
+
72
+ config["configurable"] = {
73
+ **config["configurable"],
74
+ "checkpoint_id": str(config["configurable"]["checkpoint_id"]),
75
+ }
76
+ return super().get_tuple(config)
77
+
78
+ def clear(self):
79
+ self.storage.clear()
80
+ self.writes.clear()
81
+ for suffix in ["1", "2"]:
82
+ file_path = f"{self.filename}{suffix}.pckl"
83
+ if os.path.exists(file_path):
84
+ os.remove(file_path)
85
+
86
+
87
+ MEMORY = InMemorySaver()
88
+
89
+
90
+ def Checkpointer(*args, **kwargs):
91
+ return MEMORY
92
+
93
+
94
+ __all__ = ["Checkpointer"]
@@ -0,0 +1,190 @@
1
+ import asyncio
2
+ import os
3
+ import threading
4
+ import uuid
5
+ from collections import defaultdict
6
+ from collections.abc import AsyncIterator
7
+ from contextlib import asynccontextmanager
8
+ from datetime import datetime
9
+ from typing import Any, NotRequired, TypedDict
10
+ from uuid import UUID
11
+
12
+ import structlog
13
+ from langgraph.checkpoint.memory import PersistentDict
14
+
15
+ from langgraph_api.utils import AsyncConnectionProto
16
+ from langgraph_storage.queue import start_queue, stop_queue
17
+
18
+ logger = structlog.stdlib.get_logger(__name__)
19
+
20
+
21
+ class Assistant(TypedDict):
22
+ assistant_id: UUID
23
+ graph_id: str
24
+ created_at: NotRequired[datetime]
25
+ updated_at: NotRequired[datetime]
26
+ config: dict[str, Any]
27
+ metadata: dict[str, Any]
28
+
29
+
30
+ class Thread(TypedDict):
31
+ thread_id: UUID
32
+ created_at: NotRequired[datetime]
33
+ updated_at: NotRequired[datetime]
34
+ metadata: dict[str, Any]
35
+ status: str
36
+
37
+
38
+ class Run(TypedDict):
39
+ run_id: UUID
40
+ thread_id: UUID
41
+ assistant_id: UUID
42
+ created_at: NotRequired[datetime]
43
+ updated_at: NotRequired[datetime]
44
+ metadata: dict[str, Any]
45
+ status: str
46
+
47
+
48
+ class RunEvent(TypedDict):
49
+ event_id: UUID
50
+ run_id: UUID
51
+ received_at: NotRequired[datetime]
52
+ span_id: UUID
53
+ event: str
54
+ name: str
55
+ tags: list[Any]
56
+ data: dict[str, Any]
57
+ metadata: dict[str, Any]
58
+
59
+
60
+ class AssistantVersion(TypedDict):
61
+ assistant_id: UUID
62
+ version: int
63
+ graph_id: str
64
+ config: dict[str, Any]
65
+ metadata: dict[str, Any]
66
+ created_at: NotRequired[datetime]
67
+
68
+
69
+ class GlobalStore(PersistentDict):
70
+ def __init__(self, *args: Any, filename: str, **kwargs: Any) -> None:
71
+ super().__init__(*args, filename=filename, **kwargs)
72
+ self.clear()
73
+
74
+ def clear(self):
75
+ assistants = self.get("assistants", [])
76
+ super().clear()
77
+ self["runs"] = []
78
+ self["threads"] = []
79
+ self["assistants"] = [
80
+ a for a in assistants if a["metadata"].get("created_by") == "system"
81
+ ]
82
+ self["assistant_versions"] = []
83
+
84
+
85
+ OPS_FILENAME = os.path.join(".langgraph_api", ".langgraph_ops.pckl")
86
+ RETRY_COUNTER_FILENAME = os.path.join(".langgraph_api", ".langgraph_retry_counter.pckl")
87
+
88
+
89
+ class InMemoryRetryCounter:
90
+ def __init__(self):
91
+ self._counters: dict[uuid.UUID, int] = PersistentDict(
92
+ int, filename=RETRY_COUNTER_FILENAME
93
+ )
94
+ self._locks: dict[uuid.UUID, asyncio.Lock] = defaultdict(asyncio.Lock)
95
+
96
+ async def increment(self, run_id: uuid.UUID) -> int:
97
+ async with self._locks[run_id]:
98
+ self._counters[run_id] += 1
99
+ return self._counters[run_id]
100
+
101
+ def close(self):
102
+ self._counters.close()
103
+
104
+
105
+ # Global retry counter for in-memory implementation
106
+ GLOBAL_RETRY_COUNTER = InMemoryRetryCounter()
107
+ GLOBAL_STORE = GlobalStore(filename=OPS_FILENAME)
108
+
109
+
110
+ class LockDict(defaultdict):
111
+ def __init__(self, *args, **kwargs):
112
+ self.__masterlock__ = threading.Lock()
113
+ super().__init__(*args, **kwargs)
114
+
115
+ def __getitem__(self, key):
116
+ with self.__masterlock__:
117
+ return super().__getitem__(key)
118
+
119
+
120
+ GLOBAL_LOCKS = LockDict(threading.Lock)
121
+
122
+
123
+ class InMemConnectionProto:
124
+ def __init__(self):
125
+ self.filename = OPS_FILENAME
126
+ self.store = GLOBAL_STORE
127
+ self.retry_counter = GLOBAL_RETRY_COUNTER
128
+ self.can_execute = False
129
+ self.locks = GLOBAL_LOCKS
130
+
131
+ @asynccontextmanager
132
+ async def pipeline(self):
133
+ yield None
134
+
135
+ async def execute(self, query: str, *args, **kwargs):
136
+ return None
137
+
138
+ def clear(self):
139
+ self.store.clear()
140
+ self.locks.clear()
141
+ keys = list(self.retry_counter._counters)
142
+ for key in keys:
143
+ del self.retry_counter._counters[key]
144
+ keys = list(self.retry_counter._locks)
145
+ for key in keys:
146
+ del self.retry_counter._locks[key]
147
+ if os.path.exists(self.filename):
148
+ os.remove(self.filename)
149
+
150
+
151
+ @asynccontextmanager
152
+ async def connect(*, __test__: bool = False) -> AsyncIterator[AsyncConnectionProto]:
153
+ yield InMemConnectionProto()
154
+
155
+
156
+ async def start_pool() -> None:
157
+ if not os.path.exists(".langgraph_api"):
158
+ os.mkdir(".langgraph_api")
159
+ if os.path.exists(OPS_FILENAME):
160
+ GLOBAL_STORE.load()
161
+ for k in ["runs", "threads", "assistants", "assistant_versions"]:
162
+ if not GLOBAL_STORE.get(k):
163
+ GLOBAL_STORE[k] = []
164
+ for k in ["crons"]:
165
+ if not GLOBAL_STORE.get(k):
166
+ GLOBAL_STORE[k] = {}
167
+ await start_queue()
168
+
169
+
170
+ async def stop_pool() -> None:
171
+ GLOBAL_STORE.close()
172
+ GLOBAL_RETRY_COUNTER.close()
173
+ from langgraph_storage.checkpoint import Checkpointer
174
+ from langgraph_storage.store import STORE
175
+
176
+ STORE.close()
177
+
178
+ async with Checkpointer():
179
+ pass
180
+ await stop_queue()
181
+
182
+
183
+ async def healthcheck() -> None:
184
+ # What could possibly go wrong?
185
+ pass
186
+
187
+
188
+ def pool_stats() -> dict[str, dict[str, int]]:
189
+ # TODO??
190
+ return {}