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.

@@ -3,8 +3,13 @@ import { describe, expect, test } from "vitest";
3
3
  import { SubgraphExtractor } from "../src/parser/parser.mjs";
4
4
  import dedent from "dedent";
5
5
 
6
- describe.concurrent("graph factories", () => {
7
- const common = dedent`
6
+ // TODO: investigate why Github Actions fails on timeout on these tests
7
+ const isParserSkipped = process.env.JS_PARSER_TESTS_SKIPPED === "true";
8
+
9
+ describe
10
+ .skipIf(isParserSkipped)
11
+ .concurrent("graph factories", { timeout: 10_000 }, () => {
12
+ const common = dedent`
8
13
  import { HumanMessage } from "@langchain/core/messages";
9
14
  import { MessagesAnnotation, StateGraph } from "@langchain/langgraph";
10
15
 
@@ -20,61 +25,63 @@ describe.concurrent("graph factories", () => {
20
25
  .addEdge("child", "__end__");
21
26
  `;
22
27
 
23
- const MessagesSchema = {
24
- type: "object",
25
- properties: {
26
- messages: {
27
- type: "array",
28
- items: { $ref: "#/definitions/BaseMessage" },
28
+ const MessagesSchema = {
29
+ type: "object",
30
+ properties: {
31
+ messages: {
32
+ type: "array",
33
+ items: { $ref: "#/definitions/BaseMessage" },
34
+ },
29
35
  },
30
- },
31
- definitions: {
32
- BaseMessage: {
33
- oneOf: expect.arrayContaining([
34
- { $ref: "#/definitions/BaseMessageChunk" },
35
- ]),
36
+ definitions: {
37
+ BaseMessage: {
38
+ oneOf: expect.arrayContaining([
39
+ { $ref: "#/definitions/BaseMessageChunk" },
40
+ ]),
41
+ },
36
42
  },
37
- },
38
- $schema: "http://json-schema.org/draft-07/schema#",
39
- };
40
-
41
- const ConfigSchema = {
42
- type: "object",
43
- $schema: "http://json-schema.org/draft-07/schema#",
44
- };
45
-
46
- test.concurrent.for([
47
- ["builder.compile()"], // CompiledGraph
48
- ["() => builder.compile()"], // () => CompiledGraph
49
- ["builder"], // Graph
50
- ["() => builder"], // () => Graph
51
-
52
- ["(async () => builder)()"], // Promise<CompiledGraph>
53
- ["async () => builder.compile()"], // () => Promise<CompiledGraph>
54
- ["(async () => builder)()"], // Promise<Graph>
55
- ["async () => builder"], // () => Promise<Graph>
56
- ])("%s", ([prop]) => {
57
- const schemas = SubgraphExtractor.extractSchemas(
58
- { contents: `${common}\n\nexport const graph = ${prop};` },
59
- "graph"
60
- );
43
+ $schema: "http://json-schema.org/draft-07/schema#",
44
+ };
61
45
 
62
- expect(schemas.graph.input).toMatchObject(MessagesSchema);
63
- expect(schemas.graph.output).toMatchObject(MessagesSchema);
64
- expect(schemas.graph.state).toMatchObject(MessagesSchema);
65
- expect(schemas.graph.config).toEqual(ConfigSchema);
46
+ const ConfigSchema = {
47
+ type: "object",
48
+ $schema: "http://json-schema.org/draft-07/schema#",
49
+ };
50
+
51
+ test.concurrent.for([
52
+ ["builder.compile()"], // CompiledGraph
53
+ ["() => builder.compile()"], // () => CompiledGraph
54
+ ["builder"], // Graph
55
+ ["() => builder"], // () => Graph
56
+
57
+ ["(async () => builder)()"], // Promise<CompiledGraph>
58
+ ["async () => builder.compile()"], // () => Promise<CompiledGraph>
59
+ ["(async () => builder)()"], // Promise<Graph>
60
+ ["async () => builder"], // () => Promise<Graph>
61
+ ])("%s", { timeout: 10_000 }, ([prop]) => {
62
+ const schemas = SubgraphExtractor.extractSchemas(
63
+ { contents: `${common}\n\nexport const graph = ${prop};` },
64
+ "graph"
65
+ );
66
+
67
+ expect(schemas.graph.input).toMatchObject(MessagesSchema);
68
+ expect(schemas.graph.output).toMatchObject(MessagesSchema);
69
+ expect(schemas.graph.state).toMatchObject(MessagesSchema);
70
+ expect(schemas.graph.config).toEqual(ConfigSchema);
71
+ });
66
72
  });
67
- });
68
73
 
69
- describe.concurrent("subgraphs", () => {
70
- test.concurrent.for([
71
- ["subgraph"],
72
- ["(state) => subgraph.invoke(state)"],
73
- ["async (state) => await subgraph.invoke(state)"],
74
- ])(`basic: %s`, ([nodeDef]) => {
75
- const schemas = SubgraphExtractor.extractSchemas(
76
- {
77
- contents: dedent`
74
+ describe
75
+ .skipIf(isParserSkipped)
76
+ .concurrent("subgraphs", { timeout: 10_000 }, () => {
77
+ test.concurrent.for([
78
+ ["subgraph"],
79
+ ["(state) => subgraph.invoke(state)"],
80
+ ["async (state) => await subgraph.invoke(state)"],
81
+ ])(`basic: %s`, { timeout: 10_000 }, ([nodeDef]) => {
82
+ const schemas = SubgraphExtractor.extractSchemas(
83
+ {
84
+ contents: dedent`
78
85
  import { HumanMessage } from "@langchain/core/messages";
79
86
  import {
80
87
  Annotation,
@@ -106,85 +113,85 @@ describe.concurrent("subgraphs", () => {
106
113
  .addEdge("child", "__end__")
107
114
  .compile();
108
115
  `,
109
- },
110
- "graph"
111
- );
112
- expect(schemas["graph|child"].input).toMatchObject({
113
- type: "object",
114
- properties: {
115
- kind: {
116
- type: "string",
117
- enum: expect.arrayContaining(["weather", "other"]),
118
- },
119
- messages: {
120
- type: "array",
121
- items: { $ref: "#/definitions/BaseMessage" },
122
116
  },
123
- },
124
- definitions: {
125
- BaseMessage: {
126
- oneOf: expect.arrayContaining([
127
- { $ref: "#/definitions/BaseMessageChunk" },
128
- ]),
129
- },
130
- },
131
- $schema: "http://json-schema.org/draft-07/schema#",
132
- });
133
-
134
- expect(schemas["graph|child"].output).toMatchObject({
135
- type: "object",
136
- properties: {
137
- kind: {
138
- type: "string",
139
- enum: expect.arrayContaining(["weather", "other"]),
140
- },
141
- messages: {
142
- type: "array",
143
- items: { $ref: "#/definitions/BaseMessage" },
144
- },
145
- },
146
- definitions: {
147
- BaseMessage: {
148
- oneOf: expect.arrayContaining([
149
- { $ref: "#/definitions/BaseMessageChunk" },
150
- ]),
151
- },
152
- },
153
- $schema: "http://json-schema.org/draft-07/schema#",
154
- });
155
-
156
- expect(schemas["graph|child"].state).toMatchObject({
157
- type: "object",
158
- properties: {
159
- kind: {
160
- type: "string",
161
- enum: expect.arrayContaining(["weather", "other"]),
162
- },
163
- messages: {
164
- type: "array",
165
- items: { $ref: "#/definitions/BaseMessage" },
166
- },
167
- },
168
- definitions: {
169
- BaseMessage: {
170
- oneOf: expect.arrayContaining([
171
- { $ref: "#/definitions/BaseMessageChunk" },
172
- ]),
173
- },
174
- },
175
- $schema: "http://json-schema.org/draft-07/schema#",
176
- });
177
-
178
- expect(schemas["graph|child"].config).toMatchObject({
179
- type: "object",
180
- $schema: "http://json-schema.org/draft-07/schema#",
117
+ "graph"
118
+ );
119
+ expect(schemas["graph|child"].input).toMatchObject({
120
+ type: "object",
121
+ properties: {
122
+ kind: {
123
+ type: "string",
124
+ enum: expect.arrayContaining(["weather", "other"]),
125
+ },
126
+ messages: {
127
+ type: "array",
128
+ items: { $ref: "#/definitions/BaseMessage" },
129
+ },
130
+ },
131
+ definitions: {
132
+ BaseMessage: {
133
+ oneOf: expect.arrayContaining([
134
+ { $ref: "#/definitions/BaseMessageChunk" },
135
+ ]),
136
+ },
137
+ },
138
+ $schema: "http://json-schema.org/draft-07/schema#",
139
+ });
140
+
141
+ expect(schemas["graph|child"].output).toMatchObject({
142
+ type: "object",
143
+ properties: {
144
+ kind: {
145
+ type: "string",
146
+ enum: expect.arrayContaining(["weather", "other"]),
147
+ },
148
+ messages: {
149
+ type: "array",
150
+ items: { $ref: "#/definitions/BaseMessage" },
151
+ },
152
+ },
153
+ definitions: {
154
+ BaseMessage: {
155
+ oneOf: expect.arrayContaining([
156
+ { $ref: "#/definitions/BaseMessageChunk" },
157
+ ]),
158
+ },
159
+ },
160
+ $schema: "http://json-schema.org/draft-07/schema#",
161
+ });
162
+
163
+ expect(schemas["graph|child"].state).toMatchObject({
164
+ type: "object",
165
+ properties: {
166
+ kind: {
167
+ type: "string",
168
+ enum: expect.arrayContaining(["weather", "other"]),
169
+ },
170
+ messages: {
171
+ type: "array",
172
+ items: { $ref: "#/definitions/BaseMessage" },
173
+ },
174
+ },
175
+ definitions: {
176
+ BaseMessage: {
177
+ oneOf: expect.arrayContaining([
178
+ { $ref: "#/definitions/BaseMessageChunk" },
179
+ ]),
180
+ },
181
+ },
182
+ $schema: "http://json-schema.org/draft-07/schema#",
183
+ });
184
+
185
+ expect(schemas["graph|child"].config).toMatchObject({
186
+ type: "object",
187
+ $schema: "http://json-schema.org/draft-07/schema#",
188
+ });
181
189
  });
182
- });
183
190
 
184
- test.concurrent("nested subgraphs", () => {
185
- const schemas = SubgraphExtractor.extractSchemas(
186
- {
187
- contents: dedent`
191
+ test.concurrent("nested subgraphs", { timeout: 10_000 }, () => {
192
+ const schemas = SubgraphExtractor.extractSchemas(
193
+ {
194
+ contents: dedent`
188
195
  import { HumanMessage } from "@langchain/core/messages";
189
196
  import {
190
197
  Annotation,
@@ -225,86 +232,89 @@ describe.concurrent("subgraphs", () => {
225
232
  .addEdge("parent_one", "parent_two")
226
233
  .compile();
227
234
  `,
228
- },
229
- "parent"
230
- );
231
-
232
- expect(Object.keys(schemas)).toEqual(
233
- expect.arrayContaining([
234
- "parent",
235
- "parent|parent_two",
236
- "parent|parent_two|child_two",
237
- ])
238
- );
239
-
240
- expect(schemas.parent.state).toMatchObject({
241
- type: "object",
242
- properties: {
243
- messages: {
244
- type: "array",
245
- items: { $ref: "#/definitions/BaseMessage" },
246
- },
247
- },
248
- definitions: {
249
- BaseMessage: {
250
- oneOf: expect.arrayContaining([
251
- { $ref: "#/definitions/BaseMessageChunk" },
252
- ]),
253
235
  },
254
- },
255
- $schema: "http://json-schema.org/draft-07/schema#",
256
- });
236
+ "parent"
237
+ );
257
238
 
258
- expect(schemas["parent|parent_two"].state).toMatchObject({
259
- type: "object",
260
- properties: {
261
- child: {
262
- type: "string",
263
- enum: expect.arrayContaining(["alpha", "beta"]),
264
- },
265
- messages: {
266
- type: "array",
267
- items: { $ref: "#/definitions/BaseMessage" },
268
- },
269
- },
270
- definitions: {
271
- BaseMessage: {
272
- oneOf: expect.arrayContaining([
273
- { $ref: "#/definitions/BaseMessageChunk" },
274
- ]),
275
- },
276
- },
277
- $schema: "http://json-schema.org/draft-07/schema#",
278
- });
239
+ expect(Object.keys(schemas)).toEqual(
240
+ expect.arrayContaining([
241
+ "parent",
242
+ "parent|parent_two",
243
+ "parent|parent_two|child_two",
244
+ ])
245
+ );
279
246
 
280
- expect(schemas["parent|parent_two|child_two"].state).toMatchObject({
281
- type: "object",
282
- properties: {
283
- subchild: {
284
- type: "string",
285
- enum: expect.arrayContaining(["one", "two"]),
286
- },
287
- messages: {
288
- type: "array",
289
- items: { $ref: "#/definitions/BaseMessage" },
290
- },
291
- },
292
- definitions: {
293
- BaseMessage: {
294
- oneOf: expect.arrayContaining([
295
- { $ref: "#/definitions/BaseMessageChunk" },
296
- ]),
297
- },
298
- },
299
- $schema: "http://json-schema.org/draft-07/schema#",
247
+ expect(schemas.parent.state).toMatchObject({
248
+ type: "object",
249
+ properties: {
250
+ messages: {
251
+ type: "array",
252
+ items: { $ref: "#/definitions/BaseMessage" },
253
+ },
254
+ },
255
+ definitions: {
256
+ BaseMessage: {
257
+ oneOf: expect.arrayContaining([
258
+ { $ref: "#/definitions/BaseMessageChunk" },
259
+ ]),
260
+ },
261
+ },
262
+ $schema: "http://json-schema.org/draft-07/schema#",
263
+ });
264
+
265
+ expect(schemas["parent|parent_two"].state).toMatchObject({
266
+ type: "object",
267
+ properties: {
268
+ child: {
269
+ type: "string",
270
+ enum: expect.arrayContaining(["alpha", "beta"]),
271
+ },
272
+ messages: {
273
+ type: "array",
274
+ items: { $ref: "#/definitions/BaseMessage" },
275
+ },
276
+ },
277
+ definitions: {
278
+ BaseMessage: {
279
+ oneOf: expect.arrayContaining([
280
+ { $ref: "#/definitions/BaseMessageChunk" },
281
+ ]),
282
+ },
283
+ },
284
+ $schema: "http://json-schema.org/draft-07/schema#",
285
+ });
286
+
287
+ expect(schemas["parent|parent_two|child_two"].state).toMatchObject({
288
+ type: "object",
289
+ properties: {
290
+ subchild: {
291
+ type: "string",
292
+ enum: expect.arrayContaining(["one", "two"]),
293
+ },
294
+ messages: {
295
+ type: "array",
296
+ items: { $ref: "#/definitions/BaseMessage" },
297
+ },
298
+ },
299
+ definitions: {
300
+ BaseMessage: {
301
+ oneOf: expect.arrayContaining([
302
+ { $ref: "#/definitions/BaseMessageChunk" },
303
+ ]),
304
+ },
305
+ },
306
+ $schema: "http://json-schema.org/draft-07/schema#",
307
+ });
300
308
  });
301
- });
302
309
 
303
- test.concurrent("multiple subgraphs within a single node", () => {
304
- expect(() => {
305
- SubgraphExtractor.extractSchemas(
306
- {
307
- contents: dedent`
310
+ test.concurrent(
311
+ "multiple subgraphs within a single node",
312
+ { timeout: 10_000 },
313
+ () => {
314
+ expect(() => {
315
+ SubgraphExtractor.extractSchemas(
316
+ {
317
+ contents: dedent`
308
318
  import { HumanMessage } from "@langchain/core/messages";
309
319
  import {
310
320
  Annotation,
@@ -350,19 +360,20 @@ describe.concurrent("subgraphs", () => {
350
360
  .addEdge("parent_one", "parent_two")
351
361
  .compile();
352
362
  `,
353
- },
354
- "parent",
355
- { strict: true }
356
- );
357
- }).toThrowError(
358
- `Multiple unique subgraph invocations found for "parent|parent_one"`
363
+ },
364
+ "parent",
365
+ { strict: true }
366
+ );
367
+ }).toThrowError(
368
+ `Multiple unique subgraph invocations found for "parent|parent_one"`
369
+ );
370
+ }
359
371
  );
360
- });
361
372
 
362
- test.concurrent("imported subgraphs", () => {
363
- const schemas = SubgraphExtractor.extractSchemas(
364
- {
365
- contents: dedent`
373
+ test.concurrent("imported subgraphs", { timeout: 10_000 }, () => {
374
+ const schemas = SubgraphExtractor.extractSchemas(
375
+ {
376
+ contents: dedent`
366
377
  import { HumanMessage } from "@langchain/core/messages";
367
378
  import { subgraph } from "./subgraph.mts";
368
379
  import {
@@ -388,10 +399,10 @@ describe.concurrent("subgraphs", () => {
388
399
  .addEdge("child", "__end__")
389
400
  .compile();
390
401
  `,
391
- files: [
392
- [
393
- "./subgraph.mts",
394
- dedent`
402
+ files: [
403
+ [
404
+ "./subgraph.mts",
405
+ dedent`
395
406
  import { HumanMessage } from "@langchain/core/messages";
396
407
  import {
397
408
  Annotation,
@@ -411,92 +422,95 @@ describe.concurrent("subgraphs", () => {
411
422
  .addEdge("__start__", "child")
412
423
  .compile();
413
424
  `,
425
+ ],
414
426
  ],
415
- ],
416
- },
417
- "graph"
418
- );
419
-
420
- expect(Object.keys(schemas)).toEqual(
421
- expect.arrayContaining(["graph", "graph|child"])
422
- );
423
-
424
- expect(schemas["graph|child"].input).toMatchObject({
425
- type: "object",
426
- properties: {
427
- kind: {
428
- type: "string",
429
- enum: expect.arrayContaining(["weather", "other"]),
430
- },
431
- messages: {
432
- type: "array",
433
- items: { $ref: "#/definitions/BaseMessage" },
434
- },
435
- },
436
- definitions: {
437
- BaseMessage: {
438
- oneOf: expect.arrayContaining([
439
- { $ref: "#/definitions/BaseMessageChunk" },
440
- ]),
441
- },
442
- },
443
- $schema: "http://json-schema.org/draft-07/schema#",
444
- });
445
-
446
- expect(schemas["graph|child"].output).toMatchObject({
447
- type: "object",
448
- properties: {
449
- kind: {
450
- type: "string",
451
- enum: expect.arrayContaining(["weather", "other"]),
452
- },
453
- messages: {
454
- type: "array",
455
- items: { $ref: "#/definitions/BaseMessage" },
456
- },
457
- },
458
- definitions: {
459
- BaseMessage: {
460
- oneOf: expect.arrayContaining([
461
- { $ref: "#/definitions/BaseMessageChunk" },
462
- ]),
463
427
  },
464
- },
465
- $schema: "http://json-schema.org/draft-07/schema#",
466
- });
428
+ "graph"
429
+ );
467
430
 
468
- expect(schemas["graph|child"].state).toMatchObject({
469
- type: "object",
470
- properties: {
471
- kind: {
472
- type: "string",
473
- enum: expect.arrayContaining(["weather", "other"]),
474
- },
475
- messages: {
476
- type: "array",
477
- items: { $ref: "#/definitions/BaseMessage" },
478
- },
479
- },
480
- definitions: {
481
- BaseMessage: {
482
- oneOf: expect.arrayContaining([
483
- { $ref: "#/definitions/BaseMessageChunk" },
484
- ]),
485
- },
486
- },
487
- $schema: "http://json-schema.org/draft-07/schema#",
488
- });
431
+ expect(Object.keys(schemas)).toEqual(
432
+ expect.arrayContaining(["graph", "graph|child"])
433
+ );
489
434
 
490
- expect(schemas["graph|child"].config).toMatchObject({
491
- type: "object",
492
- $schema: "http://json-schema.org/draft-07/schema#",
435
+ expect(schemas["graph|child"].input).toMatchObject({
436
+ type: "object",
437
+ properties: {
438
+ kind: {
439
+ type: "string",
440
+ enum: expect.arrayContaining(["weather", "other"]),
441
+ },
442
+ messages: {
443
+ type: "array",
444
+ items: { $ref: "#/definitions/BaseMessage" },
445
+ },
446
+ },
447
+ definitions: {
448
+ BaseMessage: {
449
+ oneOf: expect.arrayContaining([
450
+ { $ref: "#/definitions/BaseMessageChunk" },
451
+ ]),
452
+ },
453
+ },
454
+ $schema: "http://json-schema.org/draft-07/schema#",
455
+ });
456
+
457
+ expect(schemas["graph|child"].output).toMatchObject({
458
+ type: "object",
459
+ properties: {
460
+ kind: {
461
+ type: "string",
462
+ enum: expect.arrayContaining(["weather", "other"]),
463
+ },
464
+ messages: {
465
+ type: "array",
466
+ items: { $ref: "#/definitions/BaseMessage" },
467
+ },
468
+ },
469
+ definitions: {
470
+ BaseMessage: {
471
+ oneOf: expect.arrayContaining([
472
+ { $ref: "#/definitions/BaseMessageChunk" },
473
+ ]),
474
+ },
475
+ },
476
+ $schema: "http://json-schema.org/draft-07/schema#",
477
+ });
478
+
479
+ expect(schemas["graph|child"].state).toMatchObject({
480
+ type: "object",
481
+ properties: {
482
+ kind: {
483
+ type: "string",
484
+ enum: expect.arrayContaining(["weather", "other"]),
485
+ },
486
+ messages: {
487
+ type: "array",
488
+ items: { $ref: "#/definitions/BaseMessage" },
489
+ },
490
+ },
491
+ definitions: {
492
+ BaseMessage: {
493
+ oneOf: expect.arrayContaining([
494
+ { $ref: "#/definitions/BaseMessageChunk" },
495
+ ]),
496
+ },
497
+ },
498
+ $schema: "http://json-schema.org/draft-07/schema#",
499
+ });
500
+
501
+ expect(schemas["graph|child"].config).toMatchObject({
502
+ type: "object",
503
+ $schema: "http://json-schema.org/draft-07/schema#",
504
+ });
493
505
  });
494
- });
495
506
 
496
- test.concurrent("imported uncompiled subgraphs", () => {
497
- const schemas = SubgraphExtractor.extractSchemas(
498
- {
499
- contents: dedent`
507
+ test.concurrent(
508
+ "imported uncompiled subgraphs",
509
+ { timeout: 10_000 },
510
+ () => {
511
+ const schemas = SubgraphExtractor.extractSchemas(
512
+ {
513
+ contents: dedent`
500
514
  import { HumanMessage } from "@langchain/core/messages";
501
515
  import { subgraph } from "./subgraph.mts";
502
516
  import {
@@ -522,10 +536,10 @@ describe.concurrent("subgraphs", () => {
522
536
  .addEdge("child", "__end__")
523
537
  .compile();
524
538
  `,
525
- files: [
526
- [
527
- "./subgraph.mts",
528
- dedent`
539
+ files: [
540
+ [
541
+ "./subgraph.mts",
542
+ dedent`
529
543
  import { HumanMessage } from "@langchain/core/messages";
530
544
  import {
531
545
  Annotation,
@@ -544,92 +558,93 @@ describe.concurrent("subgraphs", () => {
544
558
  })
545
559
  .addEdge("__start__", "child")
546
560
  `,
547
- ],
548
- ],
549
- },
550
- "graph"
551
- );
552
-
553
- expect(Object.keys(schemas)).toEqual(
554
- expect.arrayContaining(["graph", "graph|child"])
555
- );
556
-
557
- expect(schemas["graph|child"].input).toMatchObject({
558
- type: "object",
559
- properties: {
560
- kind: {
561
- type: "string",
562
- enum: expect.arrayContaining(["weather", "other"]),
563
- },
564
- messages: {
565
- type: "array",
566
- items: { $ref: "#/definitions/BaseMessage" },
567
- },
568
- },
569
- definitions: {
570
- BaseMessage: {
571
- oneOf: expect.arrayContaining([
572
- { $ref: "#/definitions/BaseMessageChunk" },
573
- ]),
574
- },
575
- },
576
- $schema: "http://json-schema.org/draft-07/schema#",
577
- });
561
+ ],
562
+ ],
563
+ },
564
+ "graph"
565
+ );
566
+
567
+ expect(Object.keys(schemas)).toEqual(
568
+ expect.arrayContaining(["graph", "graph|child"])
569
+ );
570
+
571
+ expect(schemas["graph|child"].input).toMatchObject({
572
+ type: "object",
573
+ properties: {
574
+ kind: {
575
+ type: "string",
576
+ enum: expect.arrayContaining(["weather", "other"]),
577
+ },
578
+ messages: {
579
+ type: "array",
580
+ items: { $ref: "#/definitions/BaseMessage" },
581
+ },
582
+ },
583
+ definitions: {
584
+ BaseMessage: {
585
+ oneOf: expect.arrayContaining([
586
+ { $ref: "#/definitions/BaseMessageChunk" },
587
+ ]),
588
+ },
589
+ },
590
+ $schema: "http://json-schema.org/draft-07/schema#",
591
+ });
578
592
 
579
- expect(schemas["graph|child"].output).toMatchObject({
580
- type: "object",
581
- properties: {
582
- kind: {
583
- type: "string",
584
- enum: expect.arrayContaining(["weather", "other"]),
585
- },
586
- messages: {
587
- type: "array",
588
- items: { $ref: "#/definitions/BaseMessage" },
589
- },
590
- },
591
- definitions: {
592
- BaseMessage: {
593
- oneOf: expect.arrayContaining([
594
- { $ref: "#/definitions/BaseMessageChunk" },
595
- ]),
596
- },
597
- },
598
- $schema: "http://json-schema.org/draft-07/schema#",
599
- });
593
+ expect(schemas["graph|child"].output).toMatchObject({
594
+ type: "object",
595
+ properties: {
596
+ kind: {
597
+ type: "string",
598
+ enum: expect.arrayContaining(["weather", "other"]),
599
+ },
600
+ messages: {
601
+ type: "array",
602
+ items: { $ref: "#/definitions/BaseMessage" },
603
+ },
604
+ },
605
+ definitions: {
606
+ BaseMessage: {
607
+ oneOf: expect.arrayContaining([
608
+ { $ref: "#/definitions/BaseMessageChunk" },
609
+ ]),
610
+ },
611
+ },
612
+ $schema: "http://json-schema.org/draft-07/schema#",
613
+ });
600
614
 
601
- expect(schemas["graph|child"].state).toMatchObject({
602
- type: "object",
603
- properties: {
604
- kind: {
605
- type: "string",
606
- enum: expect.arrayContaining(["weather", "other"]),
607
- },
608
- messages: {
609
- type: "array",
610
- items: { $ref: "#/definitions/BaseMessage" },
611
- },
612
- },
613
- definitions: {
614
- BaseMessage: {
615
- oneOf: expect.arrayContaining([
616
- { $ref: "#/definitions/BaseMessageChunk" },
617
- ]),
618
- },
619
- },
620
- $schema: "http://json-schema.org/draft-07/schema#",
621
- });
615
+ expect(schemas["graph|child"].state).toMatchObject({
616
+ type: "object",
617
+ properties: {
618
+ kind: {
619
+ type: "string",
620
+ enum: expect.arrayContaining(["weather", "other"]),
621
+ },
622
+ messages: {
623
+ type: "array",
624
+ items: { $ref: "#/definitions/BaseMessage" },
625
+ },
626
+ },
627
+ definitions: {
628
+ BaseMessage: {
629
+ oneOf: expect.arrayContaining([
630
+ { $ref: "#/definitions/BaseMessageChunk" },
631
+ ]),
632
+ },
633
+ },
634
+ $schema: "http://json-schema.org/draft-07/schema#",
635
+ });
622
636
 
623
- expect(schemas["graph|child"].config).toMatchObject({
624
- type: "object",
625
- $schema: "http://json-schema.org/draft-07/schema#",
626
- });
627
- });
637
+ expect(schemas["graph|child"].config).toMatchObject({
638
+ type: "object",
639
+ $schema: "http://json-schema.org/draft-07/schema#",
640
+ });
641
+ }
642
+ );
628
643
 
629
- test.concurrent("indirect", () => {
630
- const schemas = SubgraphExtractor.extractSchemas(
631
- {
632
- contents: dedent`
644
+ test.concurrent("indirect", { timeout: 10_000 }, () => {
645
+ const schemas = SubgraphExtractor.extractSchemas(
646
+ {
647
+ contents: dedent`
633
648
  import { HumanMessage } from "@langchain/core/messages";
634
649
  import {
635
650
  Annotation,
@@ -664,83 +679,83 @@ describe.concurrent("subgraphs", () => {
664
679
  const indirect2 = (() => indirect1)()
665
680
  export const graph = parent.compile()
666
681
  `,
667
- },
668
- "graph"
669
- );
670
- expect(schemas["graph|child"].input).toMatchObject({
671
- type: "object",
672
- properties: {
673
- kind: {
674
- type: "string",
675
- enum: expect.arrayContaining(["weather", "other"]),
676
- },
677
- messages: {
678
- type: "array",
679
- items: { $ref: "#/definitions/BaseMessage" },
680
682
  },
681
- },
682
- definitions: {
683
- BaseMessage: {
684
- oneOf: expect.arrayContaining([
685
- { $ref: "#/definitions/BaseMessageChunk" },
686
- ]),
687
- },
688
- },
689
- $schema: "http://json-schema.org/draft-07/schema#",
690
- });
691
-
692
- expect(schemas["graph|child"].output).toMatchObject({
693
- type: "object",
694
- properties: {
695
- kind: {
696
- type: "string",
697
- enum: expect.arrayContaining(["weather", "other"]),
698
- },
699
- messages: {
700
- type: "array",
701
- items: { $ref: "#/definitions/BaseMessage" },
702
- },
703
- },
704
- definitions: {
705
- BaseMessage: {
706
- oneOf: expect.arrayContaining([
707
- { $ref: "#/definitions/BaseMessageChunk" },
708
- ]),
709
- },
710
- },
711
- $schema: "http://json-schema.org/draft-07/schema#",
712
- });
713
-
714
- expect(schemas["graph|child"].state).toMatchObject({
715
- type: "object",
716
- properties: {
717
- kind: {
718
- type: "string",
719
- enum: expect.arrayContaining(["weather", "other"]),
720
- },
721
- messages: {
722
- type: "array",
723
- items: { $ref: "#/definitions/BaseMessage" },
724
- },
725
- },
726
- definitions: {
727
- BaseMessage: {
728
- oneOf: expect.arrayContaining([
729
- { $ref: "#/definitions/BaseMessageChunk" },
730
- ]),
731
- },
732
- },
733
- $schema: "http://json-schema.org/draft-07/schema#",
734
- });
735
-
736
- expect(schemas["graph|child"].config).toMatchObject({
737
- type: "object",
738
- $schema: "http://json-schema.org/draft-07/schema#",
683
+ "graph"
684
+ );
685
+ expect(schemas["graph|child"].input).toMatchObject({
686
+ type: "object",
687
+ properties: {
688
+ kind: {
689
+ type: "string",
690
+ enum: expect.arrayContaining(["weather", "other"]),
691
+ },
692
+ messages: {
693
+ type: "array",
694
+ items: { $ref: "#/definitions/BaseMessage" },
695
+ },
696
+ },
697
+ definitions: {
698
+ BaseMessage: {
699
+ oneOf: expect.arrayContaining([
700
+ { $ref: "#/definitions/BaseMessageChunk" },
701
+ ]),
702
+ },
703
+ },
704
+ $schema: "http://json-schema.org/draft-07/schema#",
705
+ });
706
+
707
+ expect(schemas["graph|child"].output).toMatchObject({
708
+ type: "object",
709
+ properties: {
710
+ kind: {
711
+ type: "string",
712
+ enum: expect.arrayContaining(["weather", "other"]),
713
+ },
714
+ messages: {
715
+ type: "array",
716
+ items: { $ref: "#/definitions/BaseMessage" },
717
+ },
718
+ },
719
+ definitions: {
720
+ BaseMessage: {
721
+ oneOf: expect.arrayContaining([
722
+ { $ref: "#/definitions/BaseMessageChunk" },
723
+ ]),
724
+ },
725
+ },
726
+ $schema: "http://json-schema.org/draft-07/schema#",
727
+ });
728
+
729
+ expect(schemas["graph|child"].state).toMatchObject({
730
+ type: "object",
731
+ properties: {
732
+ kind: {
733
+ type: "string",
734
+ enum: expect.arrayContaining(["weather", "other"]),
735
+ },
736
+ messages: {
737
+ type: "array",
738
+ items: { $ref: "#/definitions/BaseMessage" },
739
+ },
740
+ },
741
+ definitions: {
742
+ BaseMessage: {
743
+ oneOf: expect.arrayContaining([
744
+ { $ref: "#/definitions/BaseMessageChunk" },
745
+ ]),
746
+ },
747
+ },
748
+ $schema: "http://json-schema.org/draft-07/schema#",
749
+ });
750
+
751
+ expect(schemas["graph|child"].config).toMatchObject({
752
+ type: "object",
753
+ $schema: "http://json-schema.org/draft-07/schema#",
754
+ });
739
755
  });
740
756
  });
741
- });
742
757
 
743
- test.concurrent("weather", () => {
758
+ test.skipIf(isParserSkipped).concurrent("weather", { timeout: 10_000 }, () => {
744
759
  const schemas = SubgraphExtractor.extractSchemas(
745
760
  {
746
761
  contents: dedent`
@@ -811,7 +826,7 @@ test.concurrent("weather", () => {
811
826
  );
812
827
  });
813
828
 
814
- test.concurrent("nested", () => {
829
+ test.skipIf(isParserSkipped).concurrent("nested", { timeout: 10_000 }, () => {
815
830
  const schemas = SubgraphExtractor.extractSchemas(
816
831
  {
817
832
  contents: dedent`