Skip to content

AI-281: add @temporalio/langsmith samples#480

Merged
xumaple merged 1 commit into
mainfrom
maplexu/AI-281-langsmith-samples
Jul 15, 2026
Merged

AI-281: add @temporalio/langsmith samples#480
xumaple merged 1 commit into
mainfrom
maplexu/AI-281-langsmith-samples

Conversation

@xumaple

@xumaple xumaple commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Adds samples for the @temporalio/langsmith plugin.

@xumaple
xumaple force-pushed the maplexu/AI-281-langsmith-samples branch from c31ac0d to 1d6f81d Compare June 23, 2026 18:15
@xumaple
xumaple marked this pull request as ready for review June 30, 2026 16:49
@xumaple
xumaple requested a review from a team as a code owner June 30, 2026 16:49
@xumaple
xumaple force-pushed the maplexu/AI-281-langsmith-samples branch 3 times, most recently from 997b241 to f360f7c Compare July 8, 2026 21:16
DABH added a commit to temporalio/sdk-typescript that referenced this pull request Jul 9, 2026
…rites

LangSmithPlugin.configureBundler installs three webpack rewrites into the
Workflow bundle (node:async_hooks -> isolate shim, langsmith node-only
utils/{fs,worker_threads}.cjs -> .browser.cjs, and a config DefinePlugin)
via require('webpack').

webpack is a dependency of @temporalio/worker, not of this plugin, so the
bare require is only resolvable when webpack is hoisted (npm, yarn, default
pnpm). Under a non-hoisting layout -- notably pnpm with hoist=false, which
samples-typescript uses -- it throws MODULE_NOT_FOUND, which the helpers
silently swallow. The langsmith redirect is then skipped, the Node-only
fs.cjs stays in the isolate bundle, and the build fails far downstream with
an opaque UnhandledSchemeError on node:fs/fs-promises/path/worker_threads
(temporalio/samples-typescript#480).

Resolve webpack through @temporalio/worker (a direct dependency of this
plugin that always carries the exact webpack the bundle is built with), so
the rewrites apply regardless of the consumer's node_modules layout -- the
same approach already used for the interceptor module via require.resolve.
Also throw an actionable error instead of silently skipping when webpack
cannot be resolved.
DABH added a commit to temporalio/sdk-typescript that referenced this pull request Jul 9, 2026
LangSmithPlugin.configureBundler installs three webpack rewrites into the
Workflow bundle (node:async_hooks -> isolate shim, langsmith node-only
utils/{fs,worker_threads}.cjs -> .browser.cjs, and a config DefinePlugin),
acquiring webpack via require('webpack').

webpack is a dependency of @temporalio/worker, not of this plugin, so the
bare require only resolves when webpack is hoisted (npm, yarn, default pnpm).
Under a non-hoisting layout -- notably pnpm with hoist=false, which
samples-typescript uses -- it throws MODULE_NOT_FOUND, which the helpers
silently swallowed. The rewrites were skipped, langsmith's Node-only fs.cjs
stayed in the isolate bundle, and the build failed far downstream with an
opaque UnhandledSchemeError on node:fs/fs-promises/path/worker_threads
(temporalio/samples-typescript#480).

Install the rewrites from a single plugin whose apply() reads webpack off
`compiler.webpack` instead of importing it. This needs no webpack dependency,
works regardless of the consumer's node_modules layout, and uses the exact
webpack instance running the bundle -- never a second copy.
@xumaple
xumaple force-pushed the maplexu/AI-281-langsmith-samples branch 2 times, most recently from 5ac220c to f360f7c Compare July 9, 2026 01:24
Four scenarios demonstrating the @temporalio/langsmith plugin:
activity-tracing, workflow-tracing, agent-pipeline, and message-handlers.
Each includes a worker, client, workflows, a mocha test, and a README.
@xumaple
xumaple force-pushed the maplexu/AI-281-langsmith-samples branch from f360f7c to de46cf8 Compare July 15, 2026 20:00
@xumaple
xumaple merged commit 2c7d3c1 into main Jul 15, 2026
22 of 23 checks passed
@xumaple
xumaple deleted the maplexu/AI-281-langsmith-samples branch July 15, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants