@langchain/langgraph-api 0.0.65 → 0.0.67

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @langchain/langgraph-api
2
2
 
3
+ ## 0.0.67
4
+
5
+ ### Patch Changes
6
+
7
+ - e23fa7f: Add support for `sort_by`, `sort_order` and `select` when searching for assistants and add support for pagination headers.
8
+ - @langchain/langgraph-ui@0.0.67
9
+
10
+ ## 0.0.66
11
+
12
+ ### Patch Changes
13
+
14
+ - 5176f1c: chore(api): add description field for assistants
15
+ - 68a1aa8: fix(api): call threads:create auth handler when copying a thread
16
+ - @langchain/langgraph-ui@0.0.66
17
+
3
18
  ## 0.0.65
4
19
 
5
20
  ### Patch Changes
@@ -40,6 +40,7 @@ api.post("/assistants", zValidator("json", schemas.AssistantCreate), async (c) =
40
40
  metadata: payload.metadata ?? {},
41
41
  if_exists: payload.if_exists ?? "raise",
42
42
  name: payload.name ?? "Untitled",
43
+ description: payload.description,
43
44
  }, c.var.auth);
44
45
  return c.json(assistant);
45
46
  });
@@ -53,13 +54,22 @@ api.post("/assistants/search", zValidator("json", schemas.AssistantSearchRequest
53
54
  metadata: payload.metadata,
54
55
  limit: payload.limit ?? 10,
55
56
  offset: payload.offset ?? 0,
57
+ sort_by: payload.sort_by,
58
+ sort_order: payload.sort_order,
59
+ select: payload.select,
56
60
  }, c.var.auth)) {
57
- result.push(item.assistant);
61
+ result.push(Object.fromEntries(Object.entries(item.assistant).filter(([k]) => !payload.select || payload.select.includes(k))));
58
62
  if (total === 0) {
59
63
  total = item.total;
60
64
  }
61
65
  }
62
- c.res.headers.set("X-Pagination-Total", total.toString());
66
+ if (total === payload.limit) {
67
+ c.res.headers.set("X-Pagination-Next", ((payload.offset ?? 0) + total).toString());
68
+ c.res.headers.set("X-Pagination-Total", ((payload.offset ?? 0) + total + 1).toString());
69
+ }
70
+ else {
71
+ c.res.headers.set("X-Pagination-Total", ((payload.offset ?? 0) + total).toString());
72
+ }
63
73
  return c.json(result);
64
74
  });
65
75
  api.post("/assistants/count", zValidator("json", schemas.AssistantCountRequest), async (c) => {
@@ -111,8 +111,8 @@ export declare const Assistant: z.ZodObject<{
111
111
  };
112
112
  created_at: string;
113
113
  updated_at: string;
114
- graph_id: string;
115
114
  assistant_id: string;
115
+ graph_id: string;
116
116
  }, {
117
117
  metadata: {} & {
118
118
  [k: string]: any;
@@ -129,8 +129,8 @@ export declare const Assistant: z.ZodObject<{
129
129
  };
130
130
  created_at: string;
131
131
  updated_at: string;
132
- graph_id: string;
133
132
  assistant_id: string;
133
+ graph_id: string;
134
134
  }>;
135
135
  export declare const AssistantCreate: z.ZodObject<{
136
136
  assistant_id: z.ZodOptional<z.ZodString>;
@@ -179,6 +179,7 @@ export declare const AssistantCreate: z.ZodObject<{
179
179
  metadata: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodUnknown, z.objectOutputType<{}, z.ZodUnknown, "strip">, z.objectInputType<{}, z.ZodUnknown, "strip">>>;
180
180
  if_exists: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"raise">, z.ZodLiteral<"do_nothing">]>>;
181
181
  name: z.ZodOptional<z.ZodString>;
182
+ description: z.ZodOptional<z.ZodString>;
182
183
  }, "strip", z.ZodTypeAny, {
183
184
  graph_id: string;
184
185
  context?: unknown;
@@ -197,8 +198,9 @@ export declare const AssistantCreate: z.ZodObject<{
197
198
  thread_ts: z.ZodOptional<z.ZodString>;
198
199
  }, z.ZodUnknown, "strip">>>;
199
200
  }, z.ZodUnknown, "strip"> | undefined;
200
- name?: string | undefined;
201
201
  assistant_id?: string | undefined;
202
+ name?: string | undefined;
203
+ description?: string | undefined;
202
204
  if_exists?: "raise" | "do_nothing" | undefined;
203
205
  }, {
204
206
  graph_id: string;
@@ -218,8 +220,9 @@ export declare const AssistantCreate: z.ZodObject<{
218
220
  thread_ts: z.ZodOptional<z.ZodString>;
219
221
  }, z.ZodUnknown, "strip">>>;
220
222
  }, z.ZodUnknown, "strip"> | undefined;
221
- name?: string | undefined;
222
223
  assistant_id?: string | undefined;
224
+ name?: string | undefined;
225
+ description?: string | undefined;
223
226
  if_exists?: "raise" | "do_nothing" | undefined;
224
227
  }>;
225
228
  export declare const AssistantPatch: z.ZodObject<{
@@ -266,6 +269,7 @@ export declare const AssistantPatch: z.ZodObject<{
266
269
  }, z.ZodUnknown, "strip">>>;
267
270
  context: z.ZodOptional<z.ZodUnknown>;
268
271
  name: z.ZodOptional<z.ZodString>;
272
+ description: z.ZodOptional<z.ZodString>;
269
273
  metadata: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
270
274
  }, "strip", z.ZodTypeAny, {
271
275
  context?: unknown;
@@ -286,6 +290,7 @@ export declare const AssistantPatch: z.ZodObject<{
286
290
  }, z.ZodUnknown, "strip"> | undefined;
287
291
  name?: string | undefined;
288
292
  graph_id?: string | undefined;
293
+ description?: string | undefined;
289
294
  }, {
290
295
  context?: unknown;
291
296
  metadata?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
@@ -305,6 +310,7 @@ export declare const AssistantPatch: z.ZodObject<{
305
310
  }, z.ZodUnknown, "strip"> | undefined;
306
311
  name?: string | undefined;
307
312
  graph_id?: string | undefined;
313
+ description?: string | undefined;
308
314
  }>;
309
315
  export declare const Config: z.ZodObject<{
310
316
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
@@ -524,8 +530,8 @@ export declare const Run: z.ZodObject<{
524
530
  };
525
531
  created_at: string;
526
532
  updated_at: string;
527
- run_id: string;
528
533
  assistant_id: string;
534
+ run_id: string;
529
535
  multitask_strategy: "reject" | "rollback" | "interrupt" | "enqueue";
530
536
  kwargs: {} & {
531
537
  [k: string]: any;
@@ -538,8 +544,8 @@ export declare const Run: z.ZodObject<{
538
544
  };
539
545
  created_at: string;
540
546
  updated_at: string;
541
- run_id: string;
542
547
  assistant_id: string;
548
+ run_id: string;
543
549
  multitask_strategy: "reject" | "rollback" | "interrupt" | "enqueue";
544
550
  kwargs: {} & {
545
551
  [k: string]: any;
@@ -1074,16 +1080,25 @@ export declare const AssistantSearchRequest: z.ZodObject<{
1074
1080
  graph_id: z.ZodOptional<z.ZodString>;
1075
1081
  limit: z.ZodOptional<z.ZodNumber>;
1076
1082
  offset: z.ZodOptional<z.ZodNumber>;
1083
+ sort_by: z.ZodOptional<z.ZodEnum<["assistant_id", "graph_id", "created_at", "updated_at", "name"]>>;
1084
+ sort_order: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
1085
+ select: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1077
1086
  }, "strip", z.ZodTypeAny, {
1078
1087
  metadata?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
1079
1088
  graph_id?: string | undefined;
1080
1089
  limit?: number | undefined;
1081
1090
  offset?: number | undefined;
1091
+ sort_by?: "created_at" | "updated_at" | "assistant_id" | "name" | "graph_id" | undefined;
1092
+ sort_order?: "asc" | "desc" | undefined;
1093
+ select?: string[] | undefined;
1082
1094
  }, {
1083
1095
  metadata?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
1084
1096
  graph_id?: string | undefined;
1085
1097
  limit?: number | undefined;
1086
1098
  offset?: number | undefined;
1099
+ sort_by?: "created_at" | "updated_at" | "assistant_id" | "name" | "graph_id" | undefined;
1100
+ sort_order?: "asc" | "desc" | undefined;
1101
+ select?: string[] | undefined;
1087
1102
  }>;
1088
1103
  export declare const AssistantCountRequest: z.ZodObject<{
1089
1104
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1123,18 +1138,18 @@ export declare const ThreadSearchRequest: z.ZodObject<{
1123
1138
  metadata?: Record<string, unknown> | undefined;
1124
1139
  limit?: number | undefined;
1125
1140
  offset?: number | undefined;
1126
- ids?: string[] | undefined;
1127
1141
  sort_by?: "status" | "thread_id" | "created_at" | "updated_at" | undefined;
1128
1142
  sort_order?: "asc" | "desc" | undefined;
1143
+ ids?: string[] | undefined;
1129
1144
  }, {
1130
1145
  values?: Record<string, unknown> | undefined;
1131
1146
  status?: "error" | "idle" | "busy" | "interrupted" | undefined;
1132
1147
  metadata?: Record<string, unknown> | undefined;
1133
1148
  limit?: number | undefined;
1134
1149
  offset?: number | undefined;
1135
- ids?: string[] | undefined;
1136
1150
  sort_by?: "status" | "thread_id" | "created_at" | "updated_at" | undefined;
1137
1151
  sort_order?: "asc" | "desc" | undefined;
1152
+ ids?: string[] | undefined;
1138
1153
  }>;
1139
1154
  export declare const Thread: z.ZodObject<{
1140
1155
  thread_id: z.ZodString;
package/dist/schemas.mjs CHANGED
@@ -40,6 +40,7 @@ export const AssistantCreate = z
40
40
  .union([z.literal("raise"), z.literal("do_nothing")])
41
41
  .optional(),
42
42
  name: z.string().optional(),
43
+ description: z.string().optional(),
43
44
  })
44
45
  .describe("Payload for creating an assistant.");
45
46
  export const AssistantPatch = z
@@ -48,6 +49,7 @@ export const AssistantPatch = z
48
49
  config: AssistantConfig.optional(),
49
50
  context: z.unknown().optional(),
50
51
  name: z.string().optional(),
52
+ description: z.string().optional(),
51
53
  metadata: z
52
54
  .object({})
53
55
  .catchall(z.any())
@@ -272,6 +274,11 @@ export const AssistantSearchRequest = z
272
274
  .gte(0)
273
275
  .describe("Offset to start from.")
274
276
  .optional(),
277
+ sort_by: z
278
+ .enum(["assistant_id", "graph_id", "created_at", "updated_at", "name"])
279
+ .optional(),
280
+ sort_order: z.enum(["asc", "desc"]).optional(),
281
+ select: z.array(z.string()).optional(),
275
282
  })
276
283
  .describe("Payload for listing assistants.");
277
284
  export const AssistantCountRequest = z
@@ -66,6 +66,7 @@ export declare class FileSystemAssistants implements AssistantsRepo {
66
66
  metadata?: Metadata;
67
67
  if_exists: OnConflictBehavior;
68
68
  name?: string;
69
+ description?: string;
69
70
  }, auth: AuthContext | undefined): Promise<Assistant>;
70
71
  patch(assistantId: string, options: {
71
72
  config?: RunnableConfig;
@@ -73,6 +74,7 @@ export declare class FileSystemAssistants implements AssistantsRepo {
73
74
  graph_id?: string;
74
75
  metadata?: Metadata;
75
76
  name?: string;
77
+ description?: string;
76
78
  }, auth: AuthContext | undefined): Promise<Assistant>;
77
79
  delete(assistant_id: string, auth: AuthContext | undefined): Promise<string[]>;
78
80
  setLatest(assistant_id: string, version: number, auth: AuthContext | undefined): Promise<Assistant>;
@@ -221,6 +221,7 @@ export class FileSystemAssistants {
221
221
  metadata: options.metadata,
222
222
  if_exists: options.if_exists,
223
223
  name: options.name,
224
+ description: options.description,
224
225
  });
225
226
  return this.conn.with((STORE) => {
226
227
  if (STORE.assistants[assistant_id] != null) {
@@ -244,6 +245,7 @@ export class FileSystemAssistants {
244
245
  graph_id: options.graph_id,
245
246
  metadata: mutable.metadata ?? {},
246
247
  name: options.name || options.graph_id,
248
+ description: options.description,
247
249
  };
248
250
  STORE.assistant_versions.push({
249
251
  assistant_id: assistant_id,
@@ -254,6 +256,7 @@ export class FileSystemAssistants {
254
256
  metadata: mutable.metadata ?? {},
255
257
  created_at: now,
256
258
  name: options.name || options.graph_id,
259
+ description: options.description,
257
260
  });
258
261
  return STORE.assistants[assistant_id];
259
262
  });
@@ -265,6 +268,7 @@ export class FileSystemAssistants {
265
268
  config: options?.config,
266
269
  metadata: options?.metadata,
267
270
  name: options?.name,
271
+ description: options?.description,
268
272
  });
269
273
  return this.conn.with((STORE) => {
270
274
  const assistant = STORE.assistants[assistantId];
@@ -293,6 +297,10 @@ export class FileSystemAssistants {
293
297
  if (options?.name != null) {
294
298
  assistant["name"] = options?.name ?? assistant["name"];
295
299
  }
300
+ if (options?.description != null) {
301
+ assistant["description"] =
302
+ options?.description ?? assistant["description"];
303
+ }
296
304
  if (metadata != null) {
297
305
  assistant["metadata"] = metadata ?? assistant["metadata"];
298
306
  }
@@ -308,6 +316,7 @@ export class FileSystemAssistants {
308
316
  config: options?.config ?? assistant["config"],
309
317
  context: options?.context ?? assistant["context"],
310
318
  name: options?.name ?? assistant["name"],
319
+ description: options?.description ?? assistant["description"],
311
320
  metadata: metadata ?? assistant["metadata"],
312
321
  created_at: now,
313
322
  };
@@ -615,20 +624,28 @@ export class FileSystemThreads {
615
624
  const [filters] = await handleAuthEvent(auth, "threads:read", {
616
625
  thread_id,
617
626
  });
618
- return this.conn.with((STORE) => {
627
+ const fromThread = await this.conn.with((STORE) => {
619
628
  const thread = STORE.threads[thread_id];
620
629
  if (!thread)
621
630
  throw new HTTPException(409, { message: "Thread not found" });
622
631
  if (!isAuthMatching(thread["metadata"], filters)) {
623
632
  throw new HTTPException(409, { message: "Thread not found" });
624
633
  }
625
- const newThreadId = uuid4();
626
- const now = new Date();
634
+ return thread;
635
+ });
636
+ const newThreadId = uuid4();
637
+ const now = new Date();
638
+ const newMetadata = { ...fromThread.metadata, thread_id: newThreadId };
639
+ await handleAuthEvent(auth, "threads:create", {
640
+ thread_id: newThreadId,
641
+ metadata: newMetadata,
642
+ });
643
+ return this.conn.with((STORE) => {
627
644
  STORE.threads[newThreadId] = {
628
645
  thread_id: newThreadId,
629
646
  created_at: now,
630
647
  updated_at: now,
631
- metadata: { ...thread.metadata, thread_id: newThreadId },
648
+ metadata: newMetadata,
632
649
  config: {},
633
650
  status: "idle",
634
651
  };
@@ -26,6 +26,7 @@ export interface RunnableConfig {
26
26
  }
27
27
  export interface Assistant {
28
28
  name: string | undefined;
29
+ description: string | undefined;
29
30
  assistant_id: string;
30
31
  graph_id: string;
31
32
  created_at: Date;
@@ -44,6 +45,7 @@ export interface AssistantVersion {
44
45
  metadata: Metadata;
45
46
  created_at: Date;
46
47
  name: string | undefined;
48
+ description: string | undefined;
47
49
  }
48
50
  export interface RunKwargs {
49
51
  input?: unknown;
@@ -243,6 +245,9 @@ export interface AssistantsRepo {
243
245
  metadata?: Metadata;
244
246
  limit: number;
245
247
  offset: number;
248
+ sort_by?: "assistant_id" | "created_at" | "updated_at" | "name" | "graph_id";
249
+ sort_order?: "asc" | "desc";
250
+ select?: string[];
246
251
  }, auth: AuthContext | undefined): AsyncGenerator<{
247
252
  assistant: Assistant;
248
253
  total: number;
@@ -255,6 +260,7 @@ export interface AssistantsRepo {
255
260
  metadata?: Metadata;
256
261
  if_exists: OnConflictBehavior;
257
262
  name?: string;
263
+ description?: string;
258
264
  }, auth: AuthContext | undefined): Promise<Assistant>;
259
265
  patch(assistantId: string, options: {
260
266
  config?: RunnableConfig;
@@ -262,6 +268,7 @@ export interface AssistantsRepo {
262
268
  graph_id?: string;
263
269
  metadata?: Metadata;
264
270
  name?: string;
271
+ description?: string;
265
272
  }, auth: AuthContext | undefined): Promise<Assistant>;
266
273
  delete(assistant_id: string, auth: AuthContext | undefined): Promise<string[]>;
267
274
  count(options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-api",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "^18.19.0 || >=20.16.0"
@@ -64,7 +64,7 @@
64
64
  "@babel/code-frame": "^7.26.2",
65
65
  "@hono/node-server": "^1.12.0",
66
66
  "@hono/zod-validator": "^0.2.2",
67
- "@langchain/langgraph-ui": "0.0.65",
67
+ "@langchain/langgraph-ui": "0.0.67",
68
68
  "@types/json-schema": "^7.0.15",
69
69
  "@typescript/vfs": "^1.6.0",
70
70
  "dedent": "^1.5.3",
@@ -98,7 +98,7 @@
98
98
  "@langchain/core": "^0.3.59",
99
99
  "@langchain/langgraph": "0.4.9",
100
100
  "@langchain/langgraph-checkpoint": "0.1.1",
101
- "@langchain/langgraph-sdk": "0.1.1",
101
+ "@langchain/langgraph-sdk": "0.1.6",
102
102
  "@types/babel__code-frame": "^7.0.6",
103
103
  "@types/node": "^18.15.11",
104
104
  "@types/react": "^19.0.8",