langsmith 0.10.8 → 0.10.9

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.
Files changed (98) hide show
  1. package/dist/_openapi_client/client.cjs +26 -2
  2. package/dist/_openapi_client/client.d.ts +15 -6
  3. package/dist/_openapi_client/client.js +27 -3
  4. package/dist/_openapi_client/internal/detect-platform.cjs +1 -1
  5. package/dist/_openapi_client/internal/detect-platform.js +1 -1
  6. package/dist/_openapi_client/resources/annotation-queues/items.cjs +13 -6
  7. package/dist/_openapi_client/resources/annotation-queues/items.d.ts +33 -8
  8. package/dist/_openapi_client/resources/annotation-queues/items.js +13 -6
  9. package/dist/_openapi_client/resources/datasets/datasets.cjs +9 -0
  10. package/dist/_openapi_client/resources/datasets/datasets.d.ts +4 -0
  11. package/dist/_openapi_client/resources/datasets/datasets.js +9 -0
  12. package/dist/_openapi_client/resources/datasets/examples.cjs +26 -0
  13. package/dist/_openapi_client/resources/datasets/examples.d.ts +23 -0
  14. package/dist/_openapi_client/resources/datasets/examples.js +22 -0
  15. package/dist/_openapi_client/resources/fleet/fleet.cjs +54 -0
  16. package/dist/_openapi_client/resources/fleet/fleet.d.ts +9 -0
  17. package/dist/_openapi_client/resources/fleet/fleet.js +17 -0
  18. package/dist/_openapi_client/resources/fleet/threads.cjs +18 -0
  19. package/dist/_openapi_client/resources/fleet/threads.d.ts +19 -0
  20. package/dist/_openapi_client/resources/fleet/threads.js +14 -0
  21. package/dist/_openapi_client/resources/index.cjs +8 -2
  22. package/dist/_openapi_client/resources/index.d.ts +6 -3
  23. package/dist/_openapi_client/resources/index.js +5 -2
  24. package/dist/_openapi_client/resources/info.d.ts +6 -0
  25. package/dist/_openapi_client/resources/issues.cjs +2 -2
  26. package/dist/_openapi_client/resources/issues.d.ts +188 -4
  27. package/dist/_openapi_client/resources/issues.js +2 -2
  28. package/dist/_openapi_client/resources/online-evaluators.cjs +7 -4
  29. package/dist/_openapi_client/resources/online-evaluators.d.ts +63 -4
  30. package/dist/_openapi_client/resources/online-evaluators.js +7 -4
  31. package/dist/_openapi_client/resources/product-feedback.cjs +33 -0
  32. package/dist/_openapi_client/resources/product-feedback.d.ts +77 -0
  33. package/dist/_openapi_client/resources/product-feedback.js +29 -0
  34. package/dist/_openapi_client/resources/runs/runs.d.ts +26 -16
  35. package/dist/_openapi_client/resources/sandboxes/boxes.cjs +44 -4
  36. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +256 -21
  37. package/dist/_openapi_client/resources/sandboxes/boxes.js +44 -4
  38. package/dist/_openapi_client/resources/sandboxes/registries.d.ts +10 -2
  39. package/dist/_openapi_client/resources/sandboxes/sandboxes.cjs +13 -0
  40. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +169 -14
  41. package/dist/_openapi_client/resources/sandboxes/sandboxes.js +13 -0
  42. package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +10 -6
  43. package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +37 -6
  44. package/dist/_openapi_client/resources/sandboxes/snapshots.js +10 -6
  45. package/dist/_openapi_client/resources/sessions.cjs +23 -0
  46. package/dist/_openapi_client/resources/sessions.d.ts +732 -0
  47. package/dist/_openapi_client/resources/sessions.js +19 -0
  48. package/dist/_openapi_client/resources/threads/index.cjs +9 -0
  49. package/dist/_openapi_client/resources/threads/index.d.ts +2 -0
  50. package/dist/_openapi_client/resources/threads/index.js +4 -0
  51. package/dist/_openapi_client/resources/threads/share.cjs +61 -0
  52. package/dist/_openapi_client/resources/threads/share.d.ts +71 -0
  53. package/dist/_openapi_client/resources/threads/share.js +57 -0
  54. package/dist/_openapi_client/resources/threads/threads.cjs +143 -0
  55. package/dist/_openapi_client/resources/threads/threads.d.ts +973 -0
  56. package/dist/_openapi_client/resources/threads/threads.js +106 -0
  57. package/dist/_openapi_client/resources/threads.cjs +15 -67
  58. package/dist/_openapi_client/resources/threads.d.ts +1 -709
  59. package/dist/_openapi_client/resources/threads.js +1 -65
  60. package/dist/_openapi_client/resources/traces.d.ts +7 -1
  61. package/dist/_openapi_client/version.cjs +1 -1
  62. package/dist/_openapi_client/version.js +1 -1
  63. package/dist/address.cjs +160 -59
  64. package/dist/address.d.ts +59 -26
  65. package/dist/address.js +154 -55
  66. package/dist/anonymizer/index.cjs +1 -1
  67. package/dist/anonymizer/index.js +1 -1
  68. package/dist/client.cjs +39 -19
  69. package/dist/client.d.ts +20 -4
  70. package/dist/client.js +34 -14
  71. package/dist/index.cjs +5 -3
  72. package/dist/index.d.ts +2 -2
  73. package/dist/index.js +2 -2
  74. package/dist/run_trees.cjs +18 -21
  75. package/dist/run_trees.d.ts +4 -4
  76. package/dist/run_trees.js +15 -18
  77. package/dist/sandbox/client.cjs +33 -4
  78. package/dist/sandbox/client.d.ts +4 -0
  79. package/dist/sandbox/client.js +34 -5
  80. package/dist/sandbox/command_handle.cjs +8 -0
  81. package/dist/sandbox/command_handle.js +8 -0
  82. package/dist/sandbox/sandbox.cjs +7 -0
  83. package/dist/sandbox/sandbox.js +7 -0
  84. package/dist/sandbox/service_url.cjs +9 -1
  85. package/dist/sandbox/service_url.d.ts +2 -1
  86. package/dist/sandbox/service_url.js +9 -1
  87. package/dist/sandbox/tracing.cjs +13 -0
  88. package/dist/sandbox/tracing.d.ts +1 -0
  89. package/dist/sandbox/tracing.js +10 -0
  90. package/dist/schemas.d.ts +3 -3
  91. package/dist/traceable.cjs +5 -4
  92. package/dist/traceable.js +4 -3
  93. package/dist/utils/{agent_addressing.cjs → addressing.cjs} +20 -11
  94. package/dist/utils/{agent_addressing.d.ts → addressing.d.ts} +4 -6
  95. package/dist/utils/{agent_addressing.js → addressing.js} +21 -11
  96. package/dist/utils/env.cjs +6 -4
  97. package/dist/utils/env.js +6 -4
  98. package/package.json +1 -1
@@ -0,0 +1,973 @@
1
+ import { APIResource } from '../../core/resource.js';
2
+ import * as ShareAPI from './share.js';
3
+ import { Share, ShareCreateParams, ShareCreateResponse, ShareDeleteParams, ShareRetrieveParams, ShareRetrieveResponse } from './share.js';
4
+ import { APIPromise } from '../../core/api-promise.js';
5
+ import { ItemsCursorGetPagination, type ItemsCursorGetPaginationParams, ItemsCursorPostPagination, type ItemsCursorPostPaginationParams, PagePromise } from '../../core/pagination.js';
6
+ import { RequestOptions } from '../../internal/request-options.js';
7
+ export declare class Threads extends APIResource {
8
+ share: ShareAPI.Share;
9
+ /**
10
+ * GET with body payload — no resources created. Returns aggregate statistics for
11
+ * threads in a tracing project. The response includes the thread counts, run
12
+ * counts, latency percentiles, rates, token totals, and cost totals requested in
13
+ * `select`.
14
+ *
15
+ * Self-hosted deployments require LangSmith `v0.17` or later.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const response = await client.threads.aggregateStats({
20
+ * project_id: '0190a1b2-c3d4-7ef0-a5b6-6ea3a82e9328',
21
+ * select: [
22
+ * 'THREAD_COUNT',
23
+ * 'TRACE_COUNT',
24
+ * 'TOTAL_TOKENS',
25
+ * 'TOTAL_COST',
26
+ * ],
27
+ * });
28
+ * ```
29
+ */
30
+ aggregateStats(body: ThreadAggregateStatsParams, options?: RequestOptions): APIPromise<ThreadAggregateStatsResponse>;
31
+ /**
32
+ * Retrieve all traces belonging to a specific thread within a project.
33
+ *
34
+ * Self-hosted deployments require LangSmith `v0.16` or later.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * // Automatically fetches more pages as needed.
39
+ * for await (const threadTrace of client.threads.listTraces(
40
+ * 'thread_id',
41
+ * { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
42
+ * )) {
43
+ * // ...
44
+ * }
45
+ * ```
46
+ */
47
+ listTraces(threadID: string, query: ThreadListTracesParams, options?: RequestOptions): PagePromise<ThreadTracesItemsCursorGetPagination, ThreadTrace>;
48
+ /**
49
+ * Query threads within a project (session), with cursor-based pagination. Returns
50
+ * threads matching the given time range and optional filters.
51
+ *
52
+ * Self-hosted deployments require LangSmith `v0.16` or later.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * // Automatically fetches more pages as needed.
57
+ * for await (const thread of client.threads.query()) {
58
+ * // ...
59
+ * }
60
+ * ```
61
+ */
62
+ query(params: ThreadQueryParams, options?: RequestOptions): PagePromise<ThreadsItemsCursorPostPagination, Thread>;
63
+ /**
64
+ * Compute aggregate stats for a single thread (turn count, latency percentiles,
65
+ * token/cost sums, and detail breakdowns) within a project.
66
+ *
67
+ * Self-hosted deployments require LangSmith `v0.16` or later.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const threadStats = await client.threads.stats(
72
+ * 'thread_id',
73
+ * {
74
+ * selects: ['TURNS'],
75
+ * session_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
76
+ * },
77
+ * );
78
+ * ```
79
+ */
80
+ stats(threadID: string, query: ThreadStatsParams, options?: RequestOptions): APIPromise<ThreadStats>;
81
+ }
82
+ export type ThreadTracesItemsCursorGetPagination = ItemsCursorGetPagination<ThreadTrace>;
83
+ export type ThreadsItemsCursorPostPagination = ItemsCursorPostPagination<Thread>;
84
+ export interface Thread {
85
+ /**
86
+ * `count` is how many root traces (conversation turns) fall in this thread for the
87
+ * query time range.
88
+ */
89
+ count?: number;
90
+ /**
91
+ * `feedback_stats` is the aggregated feedback across traces in the thread, keyed
92
+ * by feedback key; shape matches `feedback_stats` on a single run.
93
+ */
94
+ feedback_stats?: {
95
+ [key: string]: Thread.FeedbackStats;
96
+ };
97
+ /**
98
+ * `first_inputs` is a truncated preview of inputs from the earliest trace in the
99
+ * thread for the query window.
100
+ */
101
+ first_inputs?: string;
102
+ /**
103
+ * `first_trace_id` is the root trace UUID for the chronologically first trace in
104
+ * the query time window.
105
+ */
106
+ first_trace_id?: string;
107
+ /**
108
+ * `last_error` is a short error summary from the most recent failing trace in the
109
+ * thread. Absent when there is no error in the window.
110
+ */
111
+ last_error?: string;
112
+ /**
113
+ * `last_outputs` is a truncated preview of outputs from the latest trace in the
114
+ * thread for the query window.
115
+ */
116
+ last_outputs?: string;
117
+ /**
118
+ * `last_trace_id` is the root trace UUID for the chronologically last trace in the
119
+ * query time window.
120
+ */
121
+ last_trace_id?: string;
122
+ /**
123
+ * `latency_p50` is the approximate median end-to-end latency of traces in the
124
+ * thread, in seconds.
125
+ */
126
+ latency_p50?: number;
127
+ /**
128
+ * `latency_p99` is the approximate 99th percentile end-to-end latency of traces in
129
+ * the thread, in seconds.
130
+ */
131
+ latency_p99?: number;
132
+ /**
133
+ * `max_start_time` is the latest trace start time in the thread (RFC3339
134
+ * date-time).
135
+ */
136
+ max_start_time?: string;
137
+ /**
138
+ * `min_start_time` is the earliest trace start time in the thread (RFC3339
139
+ * date-time).
140
+ */
141
+ min_start_time?: string;
142
+ /**
143
+ * `num_errored_turns` is the count of root traces in the thread (within the query
144
+ * window) whose status was an error.
145
+ */
146
+ num_errored_turns?: number;
147
+ /**
148
+ * `query_metadata` describes why this thread matched the query, including
149
+ * `sem_filter_score` when a semantic filter is used. Returned automatically, or
150
+ * null when unavailable.
151
+ */
152
+ query_metadata?: unknown | null;
153
+ /**
154
+ * `start_time` is a reference start time for this row (RFC3339 date-time), such as
155
+ * for sorting.
156
+ */
157
+ start_time?: string;
158
+ /**
159
+ * `thread_id` identifies this conversation thread within the project from the
160
+ * request body `project_id`.
161
+ */
162
+ thread_id?: string;
163
+ /**
164
+ * `total_cost` is the sum of estimated USD cost across those traces.
165
+ */
166
+ total_cost?: number;
167
+ /**
168
+ * `total_cost_details` sums per-category estimated USD cost across traces in the
169
+ * thread. Keys mirror `total_token_details`.
170
+ *
171
+ * Example: `{"cache_read": 0.012, "reasoning": 0.008}`.
172
+ */
173
+ total_cost_details?: {
174
+ [key: string]: number;
175
+ };
176
+ /**
177
+ * `total_token_details` sums per-category token counts across traces in the
178
+ * thread. Keys are model-specific category names (for example `cache_read`,
179
+ * `cache_write`, `reasoning`, `audio`).
180
+ *
181
+ * Example: `{"cache_read": 400, "reasoning": 120}`.
182
+ */
183
+ total_token_details?: {
184
+ [key: string]: number;
185
+ };
186
+ /**
187
+ * `total_tokens` is the sum of token usage across those traces.
188
+ */
189
+ total_tokens?: number;
190
+ /**
191
+ * `trace_id` is a representative root trace UUID when the summary includes one,
192
+ * for example for deep links.
193
+ */
194
+ trace_id?: string;
195
+ }
196
+ export declare namespace Thread {
197
+ interface FeedbackStats {
198
+ /**
199
+ * `avg` is the arithmetic mean of numeric feedback scores for this key on the run,
200
+ * or `null` when no numeric score has been recorded (for example purely
201
+ * categorical feedback).
202
+ */
203
+ avg?: number;
204
+ /**
205
+ * `comments` is a sample of human-readable comments attached to feedback points
206
+ * for this key, in no particular order. May be empty; is not exhaustive when many
207
+ * comments exist.
208
+ */
209
+ comments?: Array<string>;
210
+ /**
211
+ * `contains_thread_feedback` is true when at least one feedback point for this key
212
+ * was submitted at the thread level (rather than at an individual run). Always
213
+ * false on responses that already describe a single run in isolation.
214
+ */
215
+ contains_thread_feedback?: boolean;
216
+ /**
217
+ * `errors` is the number of feedback points recorded as errors rather than
218
+ * successful scores (for example an automated evaluator that raised an exception).
219
+ * Defaults to 0 when no errors occurred.
220
+ */
221
+ errors?: number;
222
+ /**
223
+ * `max` is the largest numeric feedback score recorded for this key on the run, or
224
+ * `null` when no numeric score has been recorded.
225
+ */
226
+ max?: number;
227
+ /**
228
+ * `min` is the smallest numeric feedback score recorded for this key on the run,
229
+ * or `null` when no numeric score has been recorded.
230
+ */
231
+ min?: number;
232
+ /**
233
+ * `n` is the number of feedback points recorded for this key on the run. For
234
+ * numeric feedback this is the sample size behind `avg`, `min`, `max`, and
235
+ * `stdev`; for categorical feedback it is the sum of the `values` counts.
236
+ */
237
+ n?: number;
238
+ /**
239
+ * `sources` is a sample of feedback sources for this key. Each entry is either a
240
+ * plain string identifier (for example `"api"`, `"app"`, `"model"`) or a JSON
241
+ * object describing a synthetic source (for example
242
+ * `{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
243
+ * tolerate both shapes.
244
+ */
245
+ sources?: Array<unknown>;
246
+ /**
247
+ * `stdev` is the sample standard deviation of numeric feedback scores for this key
248
+ * on the run, or `null` when it cannot be computed (for example fewer than two
249
+ * numeric scores, or purely categorical feedback).
250
+ */
251
+ stdev?: number;
252
+ /**
253
+ * `values` is the distribution of categorical feedback labels for this key,
254
+ * mapping each label to its occurrence count. Empty (`{}`) for purely numeric
255
+ * feedback.
256
+ */
257
+ values?: {
258
+ [key: string]: number;
259
+ };
260
+ }
261
+ }
262
+ export interface ThreadStats {
263
+ /**
264
+ * `completion_cost` is the sum of per-trace completion costs across the thread, in
265
+ * USD. Populated when `COMPLETION_COST` is selected.
266
+ */
267
+ completion_cost?: number;
268
+ /**
269
+ * `completion_cost_details` is the per-sub-category sum of completion cost details
270
+ * across the thread. Populated when `COMPLETION_COST_DETAILS` is selected.
271
+ */
272
+ completion_cost_details?: ThreadStats.CompletionCostDetails;
273
+ /**
274
+ * `completion_token_details` is the per-sub-category sum of completion token
275
+ * details across the thread. Populated when `COMPLETION_TOKEN_DETAILS` is
276
+ * selected.
277
+ */
278
+ completion_token_details?: ThreadStats.CompletionTokenDetails;
279
+ /**
280
+ * `completion_tokens` is the sum of per-trace completion token counts across the
281
+ * thread. Populated when `COMPLETION_TOKENS` is selected.
282
+ */
283
+ completion_tokens?: number;
284
+ /**
285
+ * `feedback_stats` aggregates run-level feedback across the thread's traces, keyed
286
+ * by feedback key. Populated when `FEEDBACK_STATS` is selected.
287
+ */
288
+ feedback_stats?: {
289
+ [key: string]: ThreadStats.FeedbackStats;
290
+ };
291
+ /**
292
+ * `first_start_time` is the earliest trace start time in the thread (RFC3339).
293
+ * Populated when `FIRST_START_TIME` is selected.
294
+ */
295
+ first_start_time?: string;
296
+ /**
297
+ * `last_end_time` is the latest trace end time in the thread (RFC3339). Populated
298
+ * when `LAST_END_TIME` is selected.
299
+ */
300
+ last_end_time?: string;
301
+ /**
302
+ * `last_start_time` is the latest trace start time in the thread (RFC3339).
303
+ * Populated when `LAST_START_TIME` is selected.
304
+ */
305
+ last_start_time?: string;
306
+ /**
307
+ * `latency_p50_seconds` is the approximate p50 of trace latency across the thread,
308
+ * in seconds. Populated when `LATENCY_P50` is selected.
309
+ */
310
+ latency_p50_seconds?: number;
311
+ /**
312
+ * `latency_p99_seconds` is the approximate p99 of trace latency across the thread,
313
+ * in seconds. Populated when `LATENCY_P99` is selected.
314
+ */
315
+ latency_p99_seconds?: number;
316
+ /**
317
+ * `prompt_cost` is the sum of per-trace prompt costs across the thread, in USD.
318
+ * Populated when `PROMPT_COST` is selected.
319
+ */
320
+ prompt_cost?: number;
321
+ /**
322
+ * `prompt_cost_details` is the per-sub-category sum of prompt cost details across
323
+ * the thread. Populated when `PROMPT_COST_DETAILS` is selected.
324
+ */
325
+ prompt_cost_details?: ThreadStats.PromptCostDetails;
326
+ /**
327
+ * `prompt_token_details` is the per-sub-category sum of prompt token details
328
+ * across the thread. Populated when `PROMPT_TOKEN_DETAILS` is selected.
329
+ */
330
+ prompt_token_details?: ThreadStats.PromptTokenDetails;
331
+ /**
332
+ * `prompt_tokens` is the sum of per-trace prompt token counts across the thread.
333
+ * Populated when `PROMPT_TOKENS` is selected.
334
+ */
335
+ prompt_tokens?: number;
336
+ /**
337
+ * `total_cost` is the sum of per-trace total costs across the thread, in USD.
338
+ * Populated when `TOTAL_COST` is selected.
339
+ */
340
+ total_cost?: number;
341
+ /**
342
+ * `total_tokens` is the sum of per-trace total token counts across the thread.
343
+ * Populated when `TOTAL_TOKENS` is selected.
344
+ */
345
+ total_tokens?: number;
346
+ /**
347
+ * `turns` is the number of distinct traces (turns) in the thread. Populated when
348
+ * `TURNS` is selected.
349
+ */
350
+ turns?: number;
351
+ }
352
+ export declare namespace ThreadStats {
353
+ /**
354
+ * `completion_cost_details` is the per-sub-category sum of completion cost details
355
+ * across the thread. Populated when `COMPLETION_COST_DETAILS` is selected.
356
+ */
357
+ interface CompletionCostDetails {
358
+ /**
359
+ * `raw` maps each category name to its estimated USD cost.
360
+ */
361
+ raw?: {
362
+ [key: string]: number;
363
+ };
364
+ }
365
+ /**
366
+ * `completion_token_details` is the per-sub-category sum of completion token
367
+ * details across the thread. Populated when `COMPLETION_TOKEN_DETAILS` is
368
+ * selected.
369
+ */
370
+ interface CompletionTokenDetails {
371
+ /**
372
+ * `raw` maps each category name to its completion-token count.
373
+ */
374
+ raw?: {
375
+ [key: string]: number;
376
+ };
377
+ }
378
+ interface FeedbackStats {
379
+ /**
380
+ * `avg` is the arithmetic mean of numeric feedback scores for this key on the run,
381
+ * or `null` when no numeric score has been recorded (for example purely
382
+ * categorical feedback).
383
+ */
384
+ avg?: number;
385
+ /**
386
+ * `comments` is a sample of human-readable comments attached to feedback points
387
+ * for this key, in no particular order. May be empty; is not exhaustive when many
388
+ * comments exist.
389
+ */
390
+ comments?: Array<string>;
391
+ /**
392
+ * `contains_thread_feedback` is true when at least one feedback point for this key
393
+ * was submitted at the thread level (rather than at an individual run). Always
394
+ * false on responses that already describe a single run in isolation.
395
+ */
396
+ contains_thread_feedback?: boolean;
397
+ /**
398
+ * `errors` is the number of feedback points recorded as errors rather than
399
+ * successful scores (for example an automated evaluator that raised an exception).
400
+ * Defaults to 0 when no errors occurred.
401
+ */
402
+ errors?: number;
403
+ /**
404
+ * `max` is the largest numeric feedback score recorded for this key on the run, or
405
+ * `null` when no numeric score has been recorded.
406
+ */
407
+ max?: number;
408
+ /**
409
+ * `min` is the smallest numeric feedback score recorded for this key on the run,
410
+ * or `null` when no numeric score has been recorded.
411
+ */
412
+ min?: number;
413
+ /**
414
+ * `n` is the number of feedback points recorded for this key on the run. For
415
+ * numeric feedback this is the sample size behind `avg`, `min`, `max`, and
416
+ * `stdev`; for categorical feedback it is the sum of the `values` counts.
417
+ */
418
+ n?: number;
419
+ /**
420
+ * `sources` is a sample of feedback sources for this key. Each entry is either a
421
+ * plain string identifier (for example `"api"`, `"app"`, `"model"`) or a JSON
422
+ * object describing a synthetic source (for example
423
+ * `{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
424
+ * tolerate both shapes.
425
+ */
426
+ sources?: Array<unknown>;
427
+ /**
428
+ * `stdev` is the sample standard deviation of numeric feedback scores for this key
429
+ * on the run, or `null` when it cannot be computed (for example fewer than two
430
+ * numeric scores, or purely categorical feedback).
431
+ */
432
+ stdev?: number;
433
+ /**
434
+ * `values` is the distribution of categorical feedback labels for this key,
435
+ * mapping each label to its occurrence count. Empty (`{}`) for purely numeric
436
+ * feedback.
437
+ */
438
+ values?: {
439
+ [key: string]: number;
440
+ };
441
+ }
442
+ /**
443
+ * `prompt_cost_details` is the per-sub-category sum of prompt cost details across
444
+ * the thread. Populated when `PROMPT_COST_DETAILS` is selected.
445
+ */
446
+ interface PromptCostDetails {
447
+ /**
448
+ * `raw` maps each category name to its estimated USD cost.
449
+ */
450
+ raw?: {
451
+ [key: string]: number;
452
+ };
453
+ }
454
+ /**
455
+ * `prompt_token_details` is the per-sub-category sum of prompt token details
456
+ * across the thread. Populated when `PROMPT_TOKEN_DETAILS` is selected.
457
+ */
458
+ interface PromptTokenDetails {
459
+ /**
460
+ * `raw` maps each category name to its prompt-token count.
461
+ */
462
+ raw?: {
463
+ [key: string]: number;
464
+ };
465
+ }
466
+ }
467
+ export interface ThreadTrace {
468
+ /**
469
+ * `completion_cost` is the estimated USD cost for the completion. Omitted unless
470
+ * included in `selects`.
471
+ */
472
+ completion_cost?: number;
473
+ /**
474
+ * `completion_cost_details` is the USD cost breakdown for completion-side
475
+ * categories; per-category values are under `raw`. Omitted unless included in
476
+ * `selects`.
477
+ */
478
+ completion_cost_details?: ThreadTrace.CompletionCostDetails;
479
+ /**
480
+ * `completion_token_details` is the completion-side token breakdown by category;
481
+ * per-category counts are under `raw`. Omitted unless included in `selects`.
482
+ */
483
+ completion_token_details?: ThreadTrace.CompletionTokenDetails;
484
+ /**
485
+ * `completion_tokens` is the completion-side token count. Omitted unless included
486
+ * in `selects`.
487
+ */
488
+ completion_tokens?: number;
489
+ /**
490
+ * `end_time` is when the root run ended (RFC3339 date-time). JSON null if the run
491
+ * is still in progress. Omitted unless included in `selects`.
492
+ */
493
+ end_time?: string;
494
+ /**
495
+ * `error` is the full root run error message when the run failed. Omitted unless
496
+ * included in `selects`.
497
+ */
498
+ error?: string;
499
+ /**
500
+ * `error_preview` is a short error summary when the run failed. Omitted unless
501
+ * included in `selects`.
502
+ */
503
+ error_preview?: string;
504
+ /**
505
+ * `first_token_time` is when the first output token was produced (RFC3339
506
+ * date-time), for streamed runs when that metadata exists. Omitted unless included
507
+ * in `selects`.
508
+ */
509
+ first_token_time?: string;
510
+ /**
511
+ * `inputs` is the full root run input payload. Omitted unless included in
512
+ * `selects`.
513
+ */
514
+ inputs?: unknown;
515
+ /**
516
+ * `inputs_preview` is a truncated text preview of inputs. Omitted unless included
517
+ * in `selects`.
518
+ */
519
+ inputs_preview?: string;
520
+ /**
521
+ * `latency` is wall-clock duration from start to end in seconds. Omitted unless
522
+ * included in `selects`.
523
+ */
524
+ latency?: number;
525
+ /**
526
+ * `name` is a human-readable label for the root run (for example the model name,
527
+ * function name, or step name chosen when the run was traced). Omitted unless
528
+ * included in `selects`.
529
+ */
530
+ name?: string;
531
+ /**
532
+ * `op` is a numeric code identifying the root run's `run_type` (for example LLM
533
+ * vs. tool vs. chain). Encoded as a number for compatibility with legacy clients;
534
+ * prefer the string `run_type` on `RunResponse` when available. Omitted unless
535
+ * included in `selects`.
536
+ */
537
+ op?: number;
538
+ /**
539
+ * `outputs` is the full root run output payload. Omitted unless included in
540
+ * `selects`.
541
+ */
542
+ outputs?: unknown;
543
+ /**
544
+ * `outputs_preview` is a truncated text preview of outputs. Omitted unless
545
+ * included in `selects`.
546
+ */
547
+ outputs_preview?: string;
548
+ /**
549
+ * `prompt_cost` is the estimated USD cost for the prompt. Omitted unless included
550
+ * in `selects`.
551
+ */
552
+ prompt_cost?: number;
553
+ /**
554
+ * `prompt_cost_details` is the USD cost breakdown for prompt-side categories;
555
+ * per-category values are under `raw`. Omitted unless included in `selects`.
556
+ */
557
+ prompt_cost_details?: ThreadTrace.PromptCostDetails;
558
+ /**
559
+ * `prompt_token_details` is the prompt-side token breakdown by category;
560
+ * per-category counts are under nested `raw`. Omitted unless included in
561
+ * `selects`.
562
+ */
563
+ prompt_token_details?: ThreadTrace.PromptTokenDetails;
564
+ /**
565
+ * `prompt_tokens` is the prompt-side token count. Omitted unless included in
566
+ * `selects`.
567
+ */
568
+ prompt_tokens?: number;
569
+ /**
570
+ * `start_time` is when the trace started (RFC3339 date-time). Omitted unless
571
+ * included in `selects`.
572
+ */
573
+ start_time?: string;
574
+ /**
575
+ * `thread_id` is the conversation thread UUID that contains this trace. Matches
576
+ * the `thread_id` path parameter of the request. Omitted unless included in
577
+ * `selects`.
578
+ */
579
+ thread_id?: string;
580
+ /**
581
+ * `total_cost` is the estimated total USD cost for the root run. Omitted unless
582
+ * included in `selects`.
583
+ */
584
+ total_cost?: number;
585
+ /**
586
+ * `total_tokens` is the total token count (prompt plus completion). Omitted unless
587
+ * included in `selects`.
588
+ */
589
+ total_tokens?: number;
590
+ /**
591
+ * `trace_id` is the UUID of this trace (the root run). Returned when `TRACE_ID` is
592
+ * in `selects`, or when `selects` is omitted entirely (sole fallback field).
593
+ */
594
+ trace_id?: string;
595
+ /**
596
+ * `turn_number` is the 1-based position in the whole thread, ordered by start_time
597
+ * then trace_id ascending, before filtering or pagination. Updates and deletions
598
+ * can change this position. Omitted unless TURN_NUMBER is included in `selects`.
599
+ */
600
+ turn_number?: number;
601
+ }
602
+ export declare namespace ThreadTrace {
603
+ /**
604
+ * `completion_cost_details` is the USD cost breakdown for completion-side
605
+ * categories; per-category values are under `raw`. Omitted unless included in
606
+ * `selects`.
607
+ */
608
+ interface CompletionCostDetails {
609
+ /**
610
+ * `raw` maps each category name to its estimated USD cost.
611
+ */
612
+ raw?: {
613
+ [key: string]: number;
614
+ };
615
+ }
616
+ /**
617
+ * `completion_token_details` is the completion-side token breakdown by category;
618
+ * per-category counts are under `raw`. Omitted unless included in `selects`.
619
+ */
620
+ interface CompletionTokenDetails {
621
+ /**
622
+ * `raw` maps each category name to its completion-token count.
623
+ */
624
+ raw?: {
625
+ [key: string]: number;
626
+ };
627
+ }
628
+ /**
629
+ * `prompt_cost_details` is the USD cost breakdown for prompt-side categories;
630
+ * per-category values are under `raw`. Omitted unless included in `selects`.
631
+ */
632
+ interface PromptCostDetails {
633
+ /**
634
+ * `raw` maps each category name to its estimated USD cost.
635
+ */
636
+ raw?: {
637
+ [key: string]: number;
638
+ };
639
+ }
640
+ /**
641
+ * `prompt_token_details` is the prompt-side token breakdown by category;
642
+ * per-category counts are under nested `raw`. Omitted unless included in
643
+ * `selects`.
644
+ */
645
+ interface PromptTokenDetails {
646
+ /**
647
+ * `raw` maps each category name to its prompt-token count.
648
+ */
649
+ raw?: {
650
+ [key: string]: number;
651
+ };
652
+ }
653
+ }
654
+ export interface ThreadAggregateStatsResponse {
655
+ /**
656
+ * `completion_cost` is the completion cost across matching traces in USD.
657
+ */
658
+ completion_cost?: number;
659
+ /**
660
+ * `completion_cost_details` contains completion-cost totals by category.
661
+ */
662
+ completion_cost_details?: {
663
+ [key: string]: number;
664
+ };
665
+ /**
666
+ * `completion_token_details` contains completion-token totals by category.
667
+ */
668
+ completion_token_details?: {
669
+ [key: string]: number;
670
+ };
671
+ /**
672
+ * `completion_tokens` is the sum of completion tokens across matching traces.
673
+ */
674
+ completion_tokens?: number;
675
+ /**
676
+ * `error_rate` is the fraction of matching traces that contain an error.
677
+ */
678
+ error_rate?: number;
679
+ /**
680
+ * `first_token_p50_seconds` is the approximate median time to first token in
681
+ * seconds. Populated when `FIRST_TOKEN_P50` is selected.
682
+ */
683
+ first_token_p50_seconds?: number;
684
+ /**
685
+ * `first_token_p99_seconds` is the approximate p99 time to first token in seconds.
686
+ * Populated when `FIRST_TOKEN_P99` is selected.
687
+ */
688
+ first_token_p99_seconds?: number;
689
+ /**
690
+ * `latency_p50_seconds` is the approximate median trace latency in seconds.
691
+ * Populated when `LATENCY_P50` is selected.
692
+ */
693
+ latency_p50_seconds?: number;
694
+ /**
695
+ * `latency_p99_seconds` is the approximate p99 trace latency in seconds. Populated
696
+ * when `LATENCY_P99` is selected.
697
+ */
698
+ latency_p99_seconds?: number;
699
+ /**
700
+ * `median_tokens` is the approximate median of total tokens across matching
701
+ * traces. Populated when `MEDIAN_TOKENS` is selected.
702
+ */
703
+ median_tokens?: number;
704
+ /**
705
+ * `prompt_cost` is the prompt cost across matching traces in USD.
706
+ */
707
+ prompt_cost?: number;
708
+ /**
709
+ * `prompt_cost_details` contains prompt-cost totals by category.
710
+ */
711
+ prompt_cost_details?: {
712
+ [key: string]: number;
713
+ };
714
+ /**
715
+ * `prompt_token_details` contains prompt-token totals by category.
716
+ */
717
+ prompt_token_details?: {
718
+ [key: string]: number;
719
+ };
720
+ /**
721
+ * `prompt_tokens` is the sum of prompt tokens across matching traces.
722
+ */
723
+ prompt_tokens?: number;
724
+ /**
725
+ * `streaming_rate` is the fraction of completed matching traces that streamed
726
+ * tokens.
727
+ */
728
+ streaming_rate?: number;
729
+ /**
730
+ * `thread_count` is the number of distinct threads matching the query. Populated
731
+ * when `THREAD_COUNT` is selected.
732
+ */
733
+ thread_count?: number;
734
+ /**
735
+ * `thread_feedback_stats` contains aggregate thread-level feedback statistics
736
+ * keyed by feedback key. Populated when `THREAD_FEEDBACK_STATS` is selected.
737
+ */
738
+ thread_feedback_stats?: {
739
+ [key: string]: ThreadAggregateStatsResponse.ThreadFeedbackStats;
740
+ };
741
+ /**
742
+ * `total_cost` is the total cost across matching traces in USD.
743
+ */
744
+ total_cost?: number;
745
+ /**
746
+ * `total_tokens` is the sum of all tokens across matching traces.
747
+ */
748
+ total_tokens?: number;
749
+ /**
750
+ * `trace_count` is the number of traces in the matching threads. Populated when
751
+ * `TRACE_COUNT` is selected.
752
+ */
753
+ trace_count?: number;
754
+ }
755
+ export declare namespace ThreadAggregateStatsResponse {
756
+ interface ThreadFeedbackStats {
757
+ /**
758
+ * `avg` is the arithmetic mean of numeric feedback scores for this key on the run,
759
+ * or `null` when no numeric score has been recorded (for example purely
760
+ * categorical feedback).
761
+ */
762
+ avg?: number;
763
+ /**
764
+ * `comments` is a sample of human-readable comments attached to feedback points
765
+ * for this key, in no particular order. May be empty; is not exhaustive when many
766
+ * comments exist.
767
+ */
768
+ comments?: Array<string>;
769
+ /**
770
+ * `contains_thread_feedback` is true when at least one feedback point for this key
771
+ * was submitted at the thread level (rather than at an individual run). Always
772
+ * false on responses that already describe a single run in isolation.
773
+ */
774
+ contains_thread_feedback?: boolean;
775
+ /**
776
+ * `errors` is the number of feedback points recorded as errors rather than
777
+ * successful scores (for example an automated evaluator that raised an exception).
778
+ * Defaults to 0 when no errors occurred.
779
+ */
780
+ errors?: number;
781
+ /**
782
+ * `max` is the largest numeric feedback score recorded for this key on the run, or
783
+ * `null` when no numeric score has been recorded.
784
+ */
785
+ max?: number;
786
+ /**
787
+ * `min` is the smallest numeric feedback score recorded for this key on the run,
788
+ * or `null` when no numeric score has been recorded.
789
+ */
790
+ min?: number;
791
+ /**
792
+ * `n` is the number of feedback points recorded for this key on the run. For
793
+ * numeric feedback this is the sample size behind `avg`, `min`, `max`, and
794
+ * `stdev`; for categorical feedback it is the sum of the `values` counts.
795
+ */
796
+ n?: number;
797
+ /**
798
+ * `sources` is a sample of feedback sources for this key. Each entry is either a
799
+ * plain string identifier (for example `"api"`, `"app"`, `"model"`) or a JSON
800
+ * object describing a synthetic source (for example
801
+ * `{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
802
+ * tolerate both shapes.
803
+ */
804
+ sources?: Array<unknown>;
805
+ /**
806
+ * `stdev` is the sample standard deviation of numeric feedback scores for this key
807
+ * on the run, or `null` when it cannot be computed (for example fewer than two
808
+ * numeric scores, or purely categorical feedback).
809
+ */
810
+ stdev?: number;
811
+ /**
812
+ * `values` is the distribution of categorical feedback labels for this key,
813
+ * mapping each label to its occurrence count. Empty (`{}`) for purely numeric
814
+ * feedback.
815
+ */
816
+ values?: {
817
+ [key: string]: number;
818
+ };
819
+ }
820
+ }
821
+ export interface ThreadAggregateStatsParams {
822
+ /**
823
+ * `project_id` is the tracing project UUID.
824
+ */
825
+ project_id: string;
826
+ /**
827
+ * `select` lists the aggregate statistics to compute and return. At least one
828
+ * value is required.
829
+ */
830
+ select: Array<'THREAD_COUNT' | 'TRACE_COUNT' | 'TOTAL_TOKENS' | 'TOTAL_COST' | 'ERROR_RATE' | 'STREAMING_RATE' | 'LATENCY_P50' | 'LATENCY_P99' | 'MEDIAN_TOKENS' | 'FIRST_TOKEN_P50' | 'FIRST_TOKEN_P99' | 'PROMPT_TOKENS' | 'COMPLETION_TOKENS' | 'PROMPT_COST' | 'COMPLETION_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'THREAD_FEEDBACK_STATS'>;
831
+ /**
832
+ * `filter` is a deprecated, unscoped LangSmith filter expression evaluated against
833
+ * trace root runs. Kept for compatibility with deployments that serve this
834
+ * endpoint via the legacy ClickHouse backend (no SmithDB query service
835
+ * configured); prefer `trace_filter`, `tree_filter`, or `thread_filter` otherwise,
836
+ * since those require SmithDB.
837
+ */
838
+ filter?: string;
839
+ /**
840
+ * `max_start_time` is the exclusive upper bound on thread activity (RFC3339
841
+ * date-time). Defaults to now (UTC) when omitted.
842
+ */
843
+ max_start_time?: string;
844
+ /**
845
+ * `min_start_time` is the inclusive lower bound on thread activity (RFC3339
846
+ * date-time). Defaults to 1 day before now (UTC) when omitted.
847
+ */
848
+ min_start_time?: string;
849
+ /**
850
+ * `thread_filter` narrows eligible threads using a LangSmith filter expression
851
+ * evaluated against the complete thread summary.
852
+ */
853
+ thread_filter?: string;
854
+ /**
855
+ * `trace_filter` narrows eligible threads to those containing a trace whose root
856
+ * run matches this LangSmith filter expression.
857
+ */
858
+ trace_filter?: string;
859
+ /**
860
+ * `tree_filter` narrows eligible threads to those containing a matching run
861
+ * anywhere in a trace tree.
862
+ */
863
+ tree_filter?: string;
864
+ }
865
+ export interface ThreadListTracesParams extends ItemsCursorGetPaginationParams {
866
+ /**
867
+ * `project_id` is the tracing project UUID (required).
868
+ */
869
+ project_id: string;
870
+ /**
871
+ * `filter` narrows which traces are returned for this thread, using a LangSmith
872
+ * filter expression evaluated against each root trace run. For example: eq(status,
873
+ * "success") or has(tags, "production"). See
874
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
875
+ * for syntax.
876
+ */
877
+ filter?: string;
878
+ /**
879
+ * `selects` lists which properties to include on each returned trace (repeatable
880
+ * query parameter). Accepts any value of the `ThreadTraceSelectField` enum.
881
+ * Properties not listed are omitted from each trace object; `trace_id` is always
882
+ * returned.
883
+ */
884
+ selects?: Array<'THREAD_ID' | 'TRACE_ID' | 'OP' | 'PROMPT_TOKENS' | 'COMPLETION_TOKENS' | 'TOTAL_TOKENS' | 'START_TIME' | 'END_TIME' | 'LATENCY' | 'FIRST_TOKEN_TIME' | 'INPUTS_PREVIEW' | 'OUTPUTS_PREVIEW' | 'INPUTS' | 'OUTPUTS' | 'ERROR' | 'PROMPT_COST' | 'COMPLETION_COST' | 'TOTAL_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'NAME' | 'ERROR_PREVIEW' | 'TURN_NUMBER'>;
885
+ /**
886
+ * `trace_filter` narrows traces by applying a LangSmith filter expression to each
887
+ * trace's root run.
888
+ */
889
+ trace_filter?: string;
890
+ /**
891
+ * `tree_filter` narrows traces to those containing at least one run that matches
892
+ * the LangSmith filter expression.
893
+ */
894
+ tree_filter?: string;
895
+ }
896
+ export interface ThreadQueryParams extends ItemsCursorPostPaginationParams {
897
+ /**
898
+ * Body param: `filter` narrows which threads are returned, using a LangSmith
899
+ * filter expression evaluated against each thread's root run. For example:
900
+ * has(tags, "production") or eq(status, "error"). See
901
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
902
+ * for syntax.
903
+ */
904
+ filter?: string;
905
+ /**
906
+ * Body param: `max_start_time` is the exclusive upper bound on thread activity
907
+ * (RFC3339 date-time). Defaults to now (UTC) when omitted.
908
+ */
909
+ max_start_time?: string;
910
+ /**
911
+ * Body param: `min_start_time` is the inclusive lower bound on thread activity
912
+ * (RFC3339 date-time). Defaults to 1 day before now (UTC) when omitted.
913
+ */
914
+ min_start_time?: string;
915
+ /**
916
+ * Body param: `project_id` is the tracing project UUID.
917
+ */
918
+ project_id?: string;
919
+ /**
920
+ * Body param: `thread_filter` narrows results using a LangSmith filter expression
921
+ * evaluated against each complete thread summary. Self-hosted deployments require
922
+ * LangSmith v0.17 or later; unsupported deployments return 501. See
923
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
924
+ * for syntax.
925
+ */
926
+ thread_filter?: string;
927
+ /**
928
+ * Body param: `trace_filter` narrows results to threads containing at least one
929
+ * trace whose root run matches this LangSmith filter expression. Trace-level
930
+ * aggregate fields are evaluated using the complete trace summary. Self-hosted
931
+ * deployments require LangSmith v0.17 or later; unsupported deployments
932
+ * return 501. See
933
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
934
+ * for syntax.
935
+ */
936
+ trace_filter?: string;
937
+ /**
938
+ * Body param: `tree_filter` narrows results to threads containing at least one
939
+ * trace with a matching run anywhere in its run tree. Self-hosted deployments
940
+ * require LangSmith v0.17 or later; unsupported deployments return 501. See
941
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
942
+ * for syntax.
943
+ */
944
+ tree_filter?: string;
945
+ /**
946
+ * Header param: application/json or text/event-stream
947
+ */
948
+ Accept?: string;
949
+ }
950
+ export interface ThreadStatsParams {
951
+ /**
952
+ * `selects` lists which aggregate stats to compute and return (repeatable query
953
+ * parameter). At least one value is required. Accepts any value of
954
+ * `SingleThreadStatsSelectField`.
955
+ */
956
+ selects: Array<'TURNS' | 'FIRST_START_TIME' | 'LAST_START_TIME' | 'LAST_END_TIME' | 'LATENCY_P50' | 'LATENCY_P99' | 'PROMPT_TOKENS' | 'PROMPT_COST' | 'COMPLETION_TOKENS' | 'COMPLETION_COST' | 'TOTAL_TOKENS' | 'TOTAL_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'FEEDBACK_STATS'>;
957
+ /**
958
+ * `session_id` is the tracing project (session) UUID (required).
959
+ */
960
+ session_id: string;
961
+ /**
962
+ * `filter` narrows which of the thread's traces are aggregated, using a LangSmith
963
+ * filter expression. For example: lt(start_time, "2025-01-01T00:00:00Z") or
964
+ * eq(trace_id, "0190a1b2-c3d4-7ef0-a5b6-6ea3a82e9328"). See
965
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
966
+ * for syntax.
967
+ */
968
+ filter?: string;
969
+ }
970
+ export declare namespace Threads {
971
+ export { type Thread as Thread, type ThreadStats as ThreadStats, type ThreadTrace as ThreadTrace, type ThreadAggregateStatsResponse as ThreadAggregateStatsResponse, type ThreadTracesItemsCursorGetPagination as ThreadTracesItemsCursorGetPagination, type ThreadsItemsCursorPostPagination as ThreadsItemsCursorPostPagination, type ThreadAggregateStatsParams as ThreadAggregateStatsParams, type ThreadListTracesParams as ThreadListTracesParams, type ThreadQueryParams as ThreadQueryParams, type ThreadStatsParams as ThreadStatsParams, };
972
+ export { Share as Share, type ShareCreateResponse as ShareCreateResponse, type ShareRetrieveResponse as ShareRetrieveResponse, type ShareCreateParams as ShareCreateParams, type ShareRetrieveParams as ShareRetrieveParams, type ShareDeleteParams as ShareDeleteParams, };
973
+ }