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.

@@ -447,7 +447,7 @@ describe("runs", () => {
447
447
  await sql`DELETE FROM store`;
448
448
  });
449
449
 
450
- it.skip.concurrent("list runs", async () => {
450
+ it.concurrent("list runs", async () => {
451
451
  const assistant = await client.assistants.create({ graphId: "agent" });
452
452
  const thread = await client.threads.create();
453
453
  await client.runs.wait(thread.thread_id, assistant.assistant_id, {
@@ -1650,3 +1650,37 @@ describe("errors", () => {
1650
1650
  expect(runState.status).toEqual("error");
1651
1651
  });
1652
1652
  });
1653
+
1654
+ describe("long running tasks", () => {
1655
+ it.concurrent.for([1000, 8000, 12000])(
1656
+ "long running task with %dms delay",
1657
+ { timeout: 15_000 },
1658
+ async (delay) => {
1659
+ const assistant = await client.assistants.create({ graphId: "delay" });
1660
+ const thread = await client.threads.create();
1661
+
1662
+ const run = await client.runs.create(
1663
+ thread.thread_id,
1664
+ assistant.assistant_id,
1665
+ {
1666
+ input: { messages: [], delay },
1667
+ config: globalConfig,
1668
+ }
1669
+ );
1670
+
1671
+ await client.runs.join(thread.thread_id, run.run_id);
1672
+
1673
+ const runState = await client.runs.get(thread.thread_id, run.run_id);
1674
+ expect(runState.status).toEqual("success");
1675
+
1676
+ const runResult = await client.threads.getState<{
1677
+ messages: BaseMessageLike[];
1678
+ delay: number;
1679
+ }>(thread.thread_id);
1680
+
1681
+ expect(runResult.values.messages).toMatchObject([
1682
+ { content: `finished after ${delay}ms` },
1683
+ ]);
1684
+ }
1685
+ );
1686
+ });
@@ -34,7 +34,7 @@ services:
34
34
  ADD . /deps/graphs
35
35
  WORKDIR /deps/graphs
36
36
  RUN yarn install --frozen-lockfile
37
- ENV LANGSERVE_GRAPHS='{"agent":"./agent.mts:graph", "nested": "./nested.mts:graph", "weather": "./weather.mts:graph", "error": "./error.mts:graph"}'
37
+ ENV LANGSERVE_GRAPHS='{"agent":"./agent.mts:graph", "nested": "./nested.mts:graph", "weather": "./weather.mts:graph", "error": "./error.mts:graph", "delay": "./delay.mts:graph"}'
38
38
  ENV LANGGRAPH_CONFIG='{"agent": {"configurable": {"model_name": "openai"}}}'
39
39
  RUN tsx /api/langgraph_api/js/build.mts
40
40
  depends_on:
@@ -54,3 +54,4 @@ services:
54
54
  DATABASE_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable
55
55
  N_JOBS_PER_WORKER: "2"
56
56
  LANGGRAPH_CLOUD_LICENSE_KEY: ${LANGGRAPH_CLOUD_LICENSE_KEY}
57
+ FF_JS_ZEROMQ_ENABLED: ${FF_JS_ZEROMQ_ENABLED}
@@ -0,0 +1,25 @@
1
+ import {
2
+ MessagesAnnotation,
3
+ StateGraph,
4
+ END,
5
+ START,
6
+ Annotation,
7
+ } from "@langchain/langgraph";
8
+
9
+ const StateSchema = Annotation.Root({
10
+ ...MessagesAnnotation.spec,
11
+ delay: Annotation<number>(),
12
+ });
13
+
14
+ const longRunning = async (
15
+ state: typeof StateSchema.State
16
+ ): Promise<typeof StateSchema.Update> => {
17
+ await new Promise((resolve) => setTimeout(resolve, state.delay));
18
+ return { messages: [`finished after ${state.delay}ms`] };
19
+ };
20
+
21
+ export const graph = new StateGraph(StateSchema)
22
+ .addNode("long_running", longRunning)
23
+ .addEdge(START, "long_running")
24
+ .addEdge("long_running", END)
25
+ .compile();
@@ -3,6 +3,7 @@
3
3
  "graphs": {
4
4
  "agent": "./agent.mts:graph",
5
5
  "subgraph": "./subgraph.mts:graph",
6
- "nested": "./nested.mts:graph"
6
+ "nested": "./nested.mts:graph",
7
+ "delay": "./delay.mts:graph"
7
8
  }
8
9
  }