From fddf09563bb27447c4f3ce3f25440f425fd3174f Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2026 07:55:08 +0000 Subject: [PATCH 1/3] docs(cloudflare): Document Workers AI Jev tracing Co-Authored-By: Andrei Borza --- .../configuration/integrations/typesafe.mdx | 2 +- .../cloudflare/agent-tracing/workers-ai.mdx | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/integrations/typesafe.mdx b/docs/platforms/javascript/common/configuration/integrations/typesafe.mdx index a38bd65ab5f4a6..e496bc386773a6 100644 --- a/docs/platforms/javascript/common/configuration/integrations/typesafe.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/typesafe.mdx @@ -21,7 +21,7 @@ This integration is enabled by default when tracing The `typesafeIntegration` adds instrumentation for [`@typesafe-ai/sdk`](https://www.npmjs.com/package/@typesafe-ai/sdk) to capture agent tracing `gen_ai.evaluate` spans, recording model, token usage, latency, and (when enabled) evaluation inputs and answers. -If you call Jev through Vercel AI SDK's `experimental_evaluate()`, see the [Vercel AI integration](/platforms/javascript/guides/node/configuration/integrations/vercelai/#trace-jev-evaluations) instead. +If you call Jev through Vercel AI SDK's `experimental_evaluate()`, see the [Vercel AI integration](/platforms/javascript/guides/node/configuration/integrations/vercelai/#trace-jev-evaluations) instead. If you call Jev through Cloudflare Workers AI, see [Workers AI](/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai/#trace-jev-evaluations). ```javascript Sentry.init({ diff --git a/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx b/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx index 97ac6911df03a6..9e4b26f98eed46 100644 --- a/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx +++ b/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx @@ -30,6 +30,32 @@ Only `env.AI.run` is instrumented. Streaming spans end when the stream is fully You can browse the full list of available models in the [Cloudflare Workers AI models directory](https://developers.cloudflare.com/ai/models/). +## Trace Jev Evaluations + + + +Calls to TypeSafe's [Jev model](https://developers.cloudflare.com/ai/models/typesafe/jev/) (`typesafe/jev`) through `env.AI.run()` are traced automatically. No additional integration or setup is needed: + +```typescript +const result = await env.AI.run("typesafe/jev", { + state: "I was charged twice. Please refund the extra charge.", + questions: { + department: { + type: "choice", + instructions: "Which team should handle this?", + criteria: { + billing: "Charges and refunds", + technical: "Bugs and outages", + }, + }, + }, +}); +``` + +Sentry treats any `env.AI.run()` call whose input has both `state` and `questions` as an evaluation. Each call creates a `gen_ai.evaluate` span named `evaluate `, with the response model (for example, `jev-1.13.0`), latency, and token usage. When recording is enabled, Sentry captures `state` and `questions` as input messages and `answers` as output messages, including probabilities and confidence values returned by Jev. These spans have the same attributes as spans from the [TypeSafe integration](/platforms/javascript/guides/node/configuration/integrations/typesafe/) on other runtimes. + +Evaluation state and answers can contain sensitive data. To stop recording them, set `genAI: { inputs: false, outputs: false }` in the `dataCollection` option. + ## Next Steps - Group multi-turn chats with `setConversationId()` From 7f83e7afa84f240d6bc4a4d3e0881b8eb8c0b3cf Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:15:29 +0000 Subject: [PATCH 2/3] docs(cloudflare): Align Jev example with Workers AI handler snippet Co-Authored-By: Andrei Borza --- .../cloudflare/agent-tracing/workers-ai.mdx | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx b/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx index 9e4b26f98eed46..c0b7244b2cd2f1 100644 --- a/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx +++ b/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx @@ -37,19 +37,26 @@ You can browse the full list of available models in the [Cloudflare Workers AI m Calls to TypeSafe's [Jev model](https://developers.cloudflare.com/ai/models/typesafe/jev/) (`typesafe/jev`) through `env.AI.run()` are traced automatically. No additional integration or setup is needed: ```typescript -const result = await env.AI.run("typesafe/jev", { - state: "I was charged twice. Please refund the extra charge.", - questions: { - department: { - type: "choice", - instructions: "Which team should handle this?", - criteria: { - billing: "Charges and refunds", - technical: "Bugs and outages", +export default { + async fetch(request, env) { + // env.AI is automatically instrumented + const result = await env.AI.run("typesafe/jev", { + state: "I was charged twice. Please refund the extra charge.", + questions: { + department: { + type: "choice", + instructions: "Which team should handle this?", + criteria: { + billing: "Charges and refunds", + technical: "Bugs and outages", + }, + }, }, - }, + }); + + return new Response(JSON.stringify(result)); }, -}); +} satisfies ExportedHandler; ``` Sentry treats any `env.AI.run()` call whose input has both `state` and `questions` as an evaluation. Each call creates a `gen_ai.evaluate` span named `evaluate `, with the response model (for example, `jev-1.13.0`), latency, and token usage. When recording is enabled, Sentry captures `state` and `questions` as input messages and `answers` as output messages, including probabilities and confidence values returned by Jev. These spans have the same attributes as spans from the [TypeSafe integration](/platforms/javascript/guides/node/configuration/integrations/typesafe/) on other runtimes. From 8c17335a49d983601f42ad29df9940b4fa2d9a99 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:32:07 +0000 Subject: [PATCH 3/3] docs(cloudflare): Drop Jev call detection detail Co-Authored-By: Andrei Borza --- .../javascript/guides/cloudflare/agent-tracing/workers-ai.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx b/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx index c0b7244b2cd2f1..4c5a6b8d0ced5b 100644 --- a/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx +++ b/docs/platforms/javascript/guides/cloudflare/agent-tracing/workers-ai.mdx @@ -59,7 +59,7 @@ export default { } satisfies ExportedHandler; ``` -Sentry treats any `env.AI.run()` call whose input has both `state` and `questions` as an evaluation. Each call creates a `gen_ai.evaluate` span named `evaluate `, with the response model (for example, `jev-1.13.0`), latency, and token usage. When recording is enabled, Sentry captures `state` and `questions` as input messages and `answers` as output messages, including probabilities and confidence values returned by Jev. These spans have the same attributes as spans from the [TypeSafe integration](/platforms/javascript/guides/node/configuration/integrations/typesafe/) on other runtimes. +Each call creates a `gen_ai.evaluate` span named `evaluate `, with the response model (for example, `jev-1.13.0`), latency, and token usage. When recording is enabled, Sentry captures `state` and `questions` as input messages and `answers` as output messages, including probabilities and confidence values returned by Jev. These spans have the same attributes as spans from the [TypeSafe integration](/platforms/javascript/guides/node/configuration/integrations/typesafe/) on other runtimes. Evaluation state and answers can contain sensitive data. To stop recording them, set `genAI: { inputs: false, outputs: false }` in the `dataCollection` option.