langgraph-api 0.0.14__py3-none-any.whl → 0.0.15__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.

@@ -13,7 +13,6 @@ from langgraph_api.api.threads import threads_routes
13
13
  from langgraph_api.auth.middleware import auth_middleware
14
14
  from langgraph_api.config import MIGRATIONS_PATH
15
15
  from langgraph_api.graph import js_bg_tasks
16
- from langgraph_api.js.remote import js_healthcheck
17
16
  from langgraph_api.validation import DOCS_HTML
18
17
  from langgraph_storage.database import connect, healthcheck
19
18
 
@@ -23,6 +22,8 @@ async def ok(request: Request):
23
22
  if check_db:
24
23
  await healthcheck()
25
24
  if js_bg_tasks:
25
+ from langgraph_api.js.remote import js_healthcheck
26
+
26
27
  await js_healthcheck()
27
28
  return JSONResponse({"ok": True})
28
29
 
@@ -8,7 +8,7 @@ from starlette.responses import Response
8
8
  from starlette.routing import BaseRoute
9
9
 
10
10
  from langgraph_api.graph import get_assistant_id, get_graph
11
- from langgraph_api.js.remote import RemotePregel
11
+ from langgraph_api.js.base import BaseRemotePregel
12
12
  from langgraph_api.route import ApiRequest, ApiResponse, ApiRoute
13
13
  from langgraph_api.serde import ajson_loads
14
14
  from langgraph_api.utils import fetchone, validate_uuid
@@ -138,7 +138,7 @@ async def get_assistant_graph(
138
138
  if xray <= 0:
139
139
  raise HTTPException(422, detail="Invalid xray value") from None
140
140
 
141
- if isinstance(graph, RemotePregel):
141
+ if isinstance(graph, BaseRemotePregel):
142
142
  drawable_graph = await graph.fetch_graph(xray=xray)
143
143
  return ApiResponse(drawable_graph.to_json())
144
144
  return ApiResponse(graph.get_graph(xray=xray).to_json())
@@ -158,7 +158,7 @@ async def get_assistant_subgraphs(
158
158
  async with get_graph(assistant["graph_id"], config) as graph:
159
159
  namespace = request.path_params.get("namespace")
160
160
 
161
- if isinstance(graph, RemotePregel):
161
+ if isinstance(graph, BaseRemotePregel):
162
162
  return ApiResponse(
163
163
  await graph.fetch_subgraphs(
164
164
  namespace=namespace,
@@ -191,7 +191,7 @@ async def get_assistant_schemas(
191
191
  assistant = await fetchone(assistant_)
192
192
  config = await ajson_loads(assistant["config"])
193
193
  async with get_graph(assistant["graph_id"], config) as graph:
194
- if isinstance(graph, RemotePregel):
194
+ if isinstance(graph, BaseRemotePregel):
195
195
  schemas = await graph.fetch_state_schema()
196
196
  return ApiResponse(
197
197
  {
langgraph_api/config.py CHANGED
@@ -28,6 +28,7 @@ BG_JOB_NO_DELAY = env("BG_JOB_NO_DELAY", cast=bool, default=False)
28
28
  N_JOBS_PER_WORKER = env("N_JOBS_PER_WORKER", cast=int, default=10)
29
29
  BG_JOB_TIMEOUT_SECS = env("BG_JOB_TIMEOUT_SECS", cast=float, default=3600)
30
30
  FF_CRONS_ENABLED = env("FF_CRONS_ENABLED", cast=bool, default=True)
31
+ FF_JS_ZEROMQ_ENABLED = env("FF_JS_ZEROMQ_ENABLED", cast=bool, default=False)
31
32
 
32
33
  # auth
33
34
 
langgraph_api/graph.py CHANGED
@@ -21,7 +21,7 @@ from langgraph.pregel import Pregel
21
21
  from langgraph.store.base import BaseStore
22
22
  from starlette.exceptions import HTTPException
23
23
 
24
- from langgraph_api.js.remote import RemotePregel
24
+ from langgraph_api.js.base import BaseRemotePregel
25
25
  from langgraph_api.schema import Config
26
26
 
27
27
  if TYPE_CHECKING:
@@ -63,7 +63,7 @@ async def register_graph(graph_id: str, graph: GraphValue, config: dict | None)
63
63
  @asynccontextmanager
64
64
  async def _generate_graph(value: Any) -> AsyncIterator[Any]:
65
65
  """Yield a graph object regardless of its type."""
66
- if isinstance(value, Pregel | RemotePregel):
66
+ if isinstance(value, Pregel | BaseRemotePregel):
67
67
  yield value
68
68
  elif hasattr(value, "__aenter__") and hasattr(value, "__aexit__"):
69
69
  async with value as ctx_value:
@@ -94,12 +94,12 @@ async def get_graph(
94
94
  async with _generate_graph(value) as graph_obj:
95
95
  if isinstance(graph_obj, Graph):
96
96
  graph_obj = graph_obj.compile()
97
- if not isinstance(graph_obj, Pregel | RemotePregel):
97
+ if not isinstance(graph_obj, Pregel | BaseRemotePregel):
98
98
  raise HTTPException(
99
99
  status_code=424,
100
100
  detail=f"Graph '{graph_id}' is not valid. Review graph registration.",
101
101
  )
102
- if isinstance(graph_obj, RemotePregel):
102
+ if isinstance(graph_obj, BaseRemotePregel):
103
103
  graph_obj.checkpointer = checkpointer
104
104
  graph_obj.name = graph_id
105
105
  yield graph_obj
@@ -228,20 +228,13 @@ async def collect_graphs_from_env(register: bool = False) -> None:
228
228
  RemotePregel,
229
229
  run_js_process,
230
230
  run_remote_checkpointer,
231
- run_remote_store,
232
231
  wait_until_js_ready,
233
232
  )
234
233
 
235
234
  js_bg_tasks.add(
236
235
  asyncio.create_task(
237
236
  run_remote_checkpointer(),
238
- name="remote-checkpointer",
239
- )
240
- )
241
- js_bg_tasks.add(
242
- asyncio.create_task(
243
- run_remote_store(),
244
- name="remote-store",
237
+ name="remote-socket-poller",
245
238
  )
246
239
  )
247
240
  js_bg_tasks.add(
@@ -256,7 +249,7 @@ async def collect_graphs_from_env(register: bool = False) -> None:
256
249
  await wait_until_js_ready()
257
250
 
258
251
  for spec in js_specs:
259
- graph = await RemotePregel.load(graph_id=spec.id)
252
+ graph = RemotePregel.load(graph_id=spec.id)
260
253
  if register:
261
254
  await register_graph(spec.id, graph, spec.config)
262
255
 
@@ -0,0 +1,9 @@
1
+ from langchain_core.runnables import Runnable
2
+
3
+
4
+ class BaseRemotePregel(Runnable):
5
+ # TODO: implement name overriding
6
+ name: str = "LangGraph"
7
+
8
+ # TODO: implement graph_id overriding
9
+ graph_id: str
@@ -1,3 +1,5 @@
1
+ /// <reference types="./global.d.ts" />
2
+
1
3
  import { z } from "zod";
2
4
  import * as fs from "node:fs/promises";
3
5
  import * as path from "node:path";