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

langgraph_api/config.py CHANGED
@@ -26,6 +26,7 @@ MIGRATIONS_PATH = env("MIGRATIONS_PATH", cast=str, default="/storage/migrations"
26
26
 
27
27
  # redis
28
28
  REDIS_URI = env("REDIS_URI", cast=str)
29
+ REDIS_CLUSTER = env("REDIS_CLUSTER", cast=bool, default=False)
29
30
  REDIS_MAX_CONNECTIONS = env("REDIS_MAX_CONNECTIONS", cast=int, default=500)
30
31
 
31
32
  # server
@@ -82,11 +83,8 @@ if CORS_CONFIG is not None and CORS_ALLOW_ORIGINS != "*":
82
83
 
83
84
  # queue
84
85
 
85
- BG_JOB_NO_DELAY = env("BG_JOB_NO_DELAY", cast=bool, default=None)
86
- BG_JOB_DELAY = env("BG_JOB_DELAY", cast=float, default=0.5)
87
- if BG_JOB_NO_DELAY is True:
88
- BG_JOB_DELAY = 0
89
-
86
+ BG_JOB_HEARTBEAT = 120 # seconds
87
+ BG_JOB_INTERVAL = 30 # seconds
90
88
 
91
89
  N_JOBS_PER_WORKER = env("N_JOBS_PER_WORKER", cast=int, default=10)
92
90
  BG_JOB_TIMEOUT_SECS = env("BG_JOB_TIMEOUT_SECS", cast=float, default=3600)
@@ -205,7 +205,7 @@ const handleStream = <T extends z.ZodType<any>>(
205
205
  try {
206
206
  for await (const data of handler({ graph_id: graphId, ...body })) {
207
207
  await stream.writeSSE({
208
- data: serialiseAsDict(data),
208
+ data: Buffer.from(serialiseAsDict(data)).toString("base64"),
209
209
  event: name,
210
210
  });
211
211
  }
@@ -216,7 +216,9 @@ const handleStream = <T extends z.ZodType<any>>(
216
216
 
217
217
  await stream.writeSSE({
218
218
  event: "error",
219
- data: serialiseAsDict(serializeError(error)),
219
+ data: Buffer.from(serialiseAsDict(serializeError(error))).toString(
220
+ "base64"
221
+ ),
220
222
  });
221
223
  }
222
224
  });
@@ -19,7 +19,7 @@
19
19
  "p-retry": "^6.2.0",
20
20
  "tsx": "^4.19.1",
21
21
  "typescript": "^5.5.4",
22
- "undici": "^6.19.7",
22
+ "undici": "^6.21.1",
23
23
  "uuid": "^10.0.0",
24
24
  "winston": "^3.15.0",
25
25
  "zeromq": "^6.3.0",
@@ -30,6 +30,6 @@
30
30
  "@types/node": "^22.2.0",
31
31
  "postgres": "^3.4.4",
32
32
  "prettier": "^3.3.3",
33
- "vitest": "^2.0.5"
33
+ "vitest": "^3.0.4"
34
34
  }
35
35
  }
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import base64
2
3
  import os
3
4
  import shutil
4
5
  from collections.abc import AsyncIterator
@@ -60,7 +61,7 @@ async def _client_stream(method: str, data: dict[str, Any]):
60
61
  data=orjson.dumps(body),
61
62
  ) as event_source:
62
63
  async for sse in event_source.aiter_sse():
63
- event = orjson.loads(sse["data"])
64
+ event = orjson.loads(base64.b64decode(sse["data"]))
64
65
  if sse["event"] == "error":
65
66
  raise RemoteException(event["error"], event["message"])
66
67
  yield event
@@ -60,7 +60,7 @@ describe("assistants", () => {
60
60
  expect(res).toMatchObject({ graph_id: graphId, config, metadata });
61
61
 
62
62
  await client.assistants.delete(res.assistant_id);
63
- expect(() => client.assistants.get(res.assistant_id)).rejects.toThrow(
63
+ await expect(() => client.assistants.get(res.assistant_id)).rejects.toThrow(
64
64
  "HTTP 404: Not Found"
65
65
  );
66
66
  });
@@ -129,7 +129,7 @@ describe("assistants", () => {
129
129
  });
130
130
 
131
131
  await client.assistants.delete(res.assistant_id);
132
- expect(() => client.assistants.get(res.assistant_id)).rejects.toThrow(
132
+ await expect(() => client.assistants.get(res.assistant_id)).rejects.toThrow(
133
133
  "HTTP 404: Not Found"
134
134
  );
135
135
  });