langsmith 0.5.18 → 0.5.20
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/dist/client.cjs +24 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +24 -0
- package/dist/experimental/anthropic/context.cjs +5 -0
- package/dist/experimental/anthropic/context.js +5 -0
- package/dist/experimental/anthropic/index.cjs +1 -0
- package/dist/experimental/anthropic/index.js +1 -0
- package/dist/experimental/sandbox/client.cjs +234 -11
- package/dist/experimental/sandbox/client.d.ts +76 -4
- package/dist/experimental/sandbox/client.js +234 -11
- package/dist/experimental/sandbox/index.cjs +0 -3
- package/dist/experimental/sandbox/index.d.ts +1 -1
- package/dist/experimental/sandbox/index.js +0 -3
- package/dist/experimental/sandbox/sandbox.cjs +65 -1
- package/dist/experimental/sandbox/sandbox.d.ts +35 -5
- package/dist/experimental/sandbox/sandbox.js +65 -1
- package/dist/experimental/sandbox/types.d.ts +92 -1
- package/dist/experimental/vercel/index.cjs +11 -0
- package/dist/experimental/vercel/index.js +12 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -73,13 +73,35 @@ export interface ResourceStatus {
|
|
|
73
73
|
/** Human-readable details when failed. */
|
|
74
74
|
status_message?: string;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Represents a sandbox snapshot.
|
|
78
|
+
*
|
|
79
|
+
* Snapshots are built from Docker images or captured from running sandboxes.
|
|
80
|
+
* They are used to create new sandboxes.
|
|
81
|
+
*/
|
|
82
|
+
export interface Snapshot {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
/** One of "building", "ready", "failed". */
|
|
86
|
+
status: string;
|
|
87
|
+
fs_capacity_bytes: number;
|
|
88
|
+
docker_image?: string;
|
|
89
|
+
image_digest?: string;
|
|
90
|
+
source_sandbox_id?: string;
|
|
91
|
+
status_message?: string;
|
|
92
|
+
fs_used_bytes?: number;
|
|
93
|
+
created_by?: string;
|
|
94
|
+
registry_id?: string;
|
|
95
|
+
created_at?: string;
|
|
96
|
+
updated_at?: string;
|
|
97
|
+
}
|
|
76
98
|
/**
|
|
77
99
|
* Data representing a sandbox instance from the API.
|
|
78
100
|
*/
|
|
79
101
|
export interface SandboxData {
|
|
80
102
|
id?: string;
|
|
81
103
|
name: string;
|
|
82
|
-
template_name
|
|
104
|
+
template_name?: string;
|
|
83
105
|
dataplane_url?: string;
|
|
84
106
|
status?: string;
|
|
85
107
|
status_message?: string;
|
|
@@ -91,6 +113,14 @@ export interface SandboxData {
|
|
|
91
113
|
idle_ttl_seconds?: number;
|
|
92
114
|
/** Computed expiration timestamp when a TTL is active, else omitted/`undefined`. */
|
|
93
115
|
expires_at?: string;
|
|
116
|
+
/** Snapshot ID used to create this sandbox. */
|
|
117
|
+
snapshot_id?: string;
|
|
118
|
+
/** Number of vCPUs allocated. */
|
|
119
|
+
vcpus?: number;
|
|
120
|
+
/** Memory allocation in bytes. */
|
|
121
|
+
mem_bytes?: number;
|
|
122
|
+
/** Root filesystem capacity in bytes. */
|
|
123
|
+
fs_capacity_bytes?: number;
|
|
94
124
|
}
|
|
95
125
|
/**
|
|
96
126
|
* Configuration options for the SandboxClient.
|
|
@@ -239,6 +269,11 @@ export interface RunOptions {
|
|
|
239
269
|
* Options for creating a sandbox.
|
|
240
270
|
*/
|
|
241
271
|
export interface CreateSandboxOptions {
|
|
272
|
+
/**
|
|
273
|
+
* Snapshot ID to boot from.
|
|
274
|
+
* Mutually exclusive with the `templateName` positional arg.
|
|
275
|
+
*/
|
|
276
|
+
snapshotId?: string;
|
|
242
277
|
/**
|
|
243
278
|
* Optional sandbox name (auto-generated if not provided).
|
|
244
279
|
*/
|
|
@@ -264,6 +299,60 @@ export interface CreateSandboxOptions {
|
|
|
264
299
|
* Must be a multiple of 60, or `0`/`undefined` to disable or omit.
|
|
265
300
|
*/
|
|
266
301
|
idleTtlSeconds?: number;
|
|
302
|
+
/** Number of vCPUs. */
|
|
303
|
+
vCpus?: number;
|
|
304
|
+
/** Memory in bytes. */
|
|
305
|
+
memBytes?: number;
|
|
306
|
+
/** Root filesystem capacity in bytes. */
|
|
307
|
+
fsCapacityBytes?: number;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Options for creating a snapshot from a Docker image.
|
|
311
|
+
*/
|
|
312
|
+
export interface CreateSnapshotOptions {
|
|
313
|
+
/** Private registry ID (alternative to URL/credentials). */
|
|
314
|
+
registryId?: string;
|
|
315
|
+
/** Registry URL for private images. */
|
|
316
|
+
registryUrl?: string;
|
|
317
|
+
/** Registry username. */
|
|
318
|
+
registryUsername?: string;
|
|
319
|
+
/** Registry password. */
|
|
320
|
+
registryPassword?: string;
|
|
321
|
+
/** Timeout in seconds when waiting for ready. Default: 60. */
|
|
322
|
+
timeout?: number;
|
|
323
|
+
/** AbortSignal for cancellation. */
|
|
324
|
+
signal?: AbortSignal;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Options for capturing a snapshot from a running sandbox.
|
|
328
|
+
*/
|
|
329
|
+
export interface CaptureSnapshotOptions {
|
|
330
|
+
/** Checkpoint timestamp to use. If omitted, creates a fresh checkpoint. */
|
|
331
|
+
checkpoint?: string;
|
|
332
|
+
/** Timeout in seconds when waiting for ready. Default: 60. */
|
|
333
|
+
timeout?: number;
|
|
334
|
+
/** AbortSignal for cancellation. */
|
|
335
|
+
signal?: AbortSignal;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Options for waiting for a snapshot to become ready.
|
|
339
|
+
*/
|
|
340
|
+
export interface WaitForSnapshotOptions {
|
|
341
|
+
/** Maximum time in seconds to wait. Default: 300. */
|
|
342
|
+
timeout?: number;
|
|
343
|
+
/** Time in seconds between status polls. Default: 2.0. */
|
|
344
|
+
pollInterval?: number;
|
|
345
|
+
/** AbortSignal for cancellation. */
|
|
346
|
+
signal?: AbortSignal;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Options for starting a stopped sandbox.
|
|
350
|
+
*/
|
|
351
|
+
export interface StartSandboxOptions {
|
|
352
|
+
/** Timeout in seconds when waiting for ready. Default: 120. */
|
|
353
|
+
timeout?: number;
|
|
354
|
+
/** AbortSignal for cancellation. */
|
|
355
|
+
signal?: AbortSignal;
|
|
267
356
|
}
|
|
268
357
|
/**
|
|
269
358
|
* Options for updating a sandbox (name and/or TTL).
|
|
@@ -295,6 +384,8 @@ export interface WaitForSandboxOptions {
|
|
|
295
384
|
* Default: 1.0.
|
|
296
385
|
*/
|
|
297
386
|
pollInterval?: number;
|
|
387
|
+
/** AbortSignal for cancellation. */
|
|
388
|
+
signal?: AbortSignal;
|
|
298
389
|
}
|
|
299
390
|
/**
|
|
300
391
|
* Options for creating a volume.
|
|
@@ -118,11 +118,19 @@ const _resolveConfigs = (baseLsConfig, runtimeLsConfig) => {
|
|
|
118
118
|
resolvedToolConfig,
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
|
+
const _getLsAgentType = () => {
|
|
122
|
+
const parentRun = (0, traceable_js_1.getCurrentRunTree)(true);
|
|
123
|
+
if (parentRun != null && parentRun.run_type === "tool") {
|
|
124
|
+
return "subagent";
|
|
125
|
+
}
|
|
126
|
+
return "root";
|
|
127
|
+
};
|
|
121
128
|
const _getGenerateTextWrapperConfig = ({ model, runName, aiSdkMethodName, resolvedLsConfig, hasExplicitOutput, hasExplicitExperimentalOutput, traceResponseMetadata, }) => {
|
|
122
129
|
return {
|
|
123
130
|
name: runName ?? _getModelDisplayName(model),
|
|
124
131
|
...resolvedLsConfig,
|
|
125
132
|
metadata: {
|
|
133
|
+
ls_agent_type: _getLsAgentType(),
|
|
126
134
|
ai_sdk_method: aiSdkMethodName ?? "ai.generateText",
|
|
127
135
|
...resolvedLsConfig?.metadata,
|
|
128
136
|
},
|
|
@@ -198,6 +206,7 @@ const _getStreamTextWrapperConfig = ({ model, runName, aiSdkMethodName, resolved
|
|
|
198
206
|
name: runName ?? _getModelDisplayName(model),
|
|
199
207
|
...resolvedLsConfig,
|
|
200
208
|
metadata: {
|
|
209
|
+
ls_agent_type: _getLsAgentType(),
|
|
201
210
|
ai_sdk_method: aiSdkMethodName ?? "ai.streamText",
|
|
202
211
|
...resolvedLsConfig?.metadata,
|
|
203
212
|
},
|
|
@@ -400,6 +409,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
|
|
|
400
409
|
name: _getModelDisplayName(params.model),
|
|
401
410
|
...resolvedLsConfig,
|
|
402
411
|
metadata: {
|
|
412
|
+
ls_agent_type: _getLsAgentType(),
|
|
403
413
|
ai_sdk_method: "ai.generateObject",
|
|
404
414
|
...resolvedLsConfig?.metadata,
|
|
405
415
|
},
|
|
@@ -521,6 +531,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
|
|
|
521
531
|
name: _getModelDisplayName(params.model),
|
|
522
532
|
...resolvedLsConfig,
|
|
523
533
|
metadata: {
|
|
534
|
+
ls_agent_type: _getLsAgentType(),
|
|
524
535
|
ai_sdk_method: "ai.streamObject",
|
|
525
536
|
...resolvedLsConfig?.metadata,
|
|
526
537
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LangSmithMiddleware, } from "./middleware.js";
|
|
2
2
|
import { convertMessageToTracedFormat } from "./utils.js";
|
|
3
|
-
import { isTraceableFunction, traceable } from "../../traceable.js";
|
|
3
|
+
import { isTraceableFunction, traceable, getCurrentRunTree, } from "../../traceable.js";
|
|
4
4
|
const _wrapTools = (tools, lsConfig) => {
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
6
|
const wrappedTools = {};
|
|
@@ -114,11 +114,19 @@ const _resolveConfigs = (baseLsConfig, runtimeLsConfig) => {
|
|
|
114
114
|
resolvedToolConfig,
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
|
+
const _getLsAgentType = () => {
|
|
118
|
+
const parentRun = getCurrentRunTree(true);
|
|
119
|
+
if (parentRun != null && parentRun.run_type === "tool") {
|
|
120
|
+
return "subagent";
|
|
121
|
+
}
|
|
122
|
+
return "root";
|
|
123
|
+
};
|
|
117
124
|
const _getGenerateTextWrapperConfig = ({ model, runName, aiSdkMethodName, resolvedLsConfig, hasExplicitOutput, hasExplicitExperimentalOutput, traceResponseMetadata, }) => {
|
|
118
125
|
return {
|
|
119
126
|
name: runName ?? _getModelDisplayName(model),
|
|
120
127
|
...resolvedLsConfig,
|
|
121
128
|
metadata: {
|
|
129
|
+
ls_agent_type: _getLsAgentType(),
|
|
122
130
|
ai_sdk_method: aiSdkMethodName ?? "ai.generateText",
|
|
123
131
|
...resolvedLsConfig?.metadata,
|
|
124
132
|
},
|
|
@@ -194,6 +202,7 @@ const _getStreamTextWrapperConfig = ({ model, runName, aiSdkMethodName, resolved
|
|
|
194
202
|
name: runName ?? _getModelDisplayName(model),
|
|
195
203
|
...resolvedLsConfig,
|
|
196
204
|
metadata: {
|
|
205
|
+
ls_agent_type: _getLsAgentType(),
|
|
197
206
|
ai_sdk_method: aiSdkMethodName ?? "ai.streamText",
|
|
198
207
|
...resolvedLsConfig?.metadata,
|
|
199
208
|
},
|
|
@@ -395,6 +404,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
|
|
|
395
404
|
name: _getModelDisplayName(params.model),
|
|
396
405
|
...resolvedLsConfig,
|
|
397
406
|
metadata: {
|
|
407
|
+
ls_agent_type: _getLsAgentType(),
|
|
398
408
|
ai_sdk_method: "ai.generateObject",
|
|
399
409
|
...resolvedLsConfig?.metadata,
|
|
400
410
|
},
|
|
@@ -516,6 +526,7 @@ const wrapAISDK = (ai, baseLsConfig) => {
|
|
|
516
526
|
name: _getModelDisplayName(params.model),
|
|
517
527
|
...resolvedLsConfig,
|
|
518
528
|
metadata: {
|
|
529
|
+
ls_agent_type: _getLsAgentType(),
|
|
519
530
|
ai_sdk_method: "ai.streamObject",
|
|
520
531
|
...resolvedLsConfig?.metadata,
|
|
521
532
|
},
|
package/dist/index.cjs
CHANGED
|
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
|
|
|
18
18
|
Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
|
|
19
19
|
Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
|
|
20
20
|
// Update using pnpm bump-version
|
|
21
|
-
exports.__version__ = "0.5.
|
|
21
|
+
exports.__version__ = "0.5.20";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
|
5
5
|
export { getDefaultProjectName } from "./utils/project.js";
|
|
6
6
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
7
7
|
export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
|
-
export declare const __version__ = "0.5.
|
|
8
|
+
export declare const __version__ = "0.5.20";
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
7
7
|
// Update using pnpm bump-version
|
|
8
|
-
export const __version__ = "0.5.
|
|
8
|
+
export const __version__ = "0.5.20";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langsmith",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.20",
|
|
4
4
|
"description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
|
|
5
5
|
"packageManager": "pnpm@10.33.0",
|
|
6
6
|
"files": [
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"@ai-sdk/openai": "^3.0.0",
|
|
154
154
|
"@ai-sdk/provider": "^3.0.0",
|
|
155
155
|
"@anthropic-ai/claude-agent-sdk": "^0.2.83",
|
|
156
|
-
"@anthropic-ai/sdk": "^0.
|
|
156
|
+
"@anthropic-ai/sdk": "^0.88.0",
|
|
157
157
|
"@babel/preset-env": "^7.22.4",
|
|
158
158
|
"@faker-js/faker": "^8.4.1",
|
|
159
159
|
"@google/genai": "^1.29.0",
|