Sentry for Eve

Learn how to send Eve agent traces, conversations, and errors to Sentry with the Sentry Node SDK.

Eve is Vercel's filesystem-first framework for building durable backend AI agents on top of the Vercel AI SDK. This guide sets up the @sentry/node SDK inside an Eve app so agent turns, model calls, tool executions, and errors flow into Sentry Agent Tracing.

Before you begin, you need:

  • A Sentry account and project. The project's DSN tells the SDK where to send data.
  • An Eve application using version 0.63.0 or later.
  • @sentry/node version 11.0.0 or later. The SDK runs in Node.js only; it doesn't support browser or edge runtimes.

Choose the features you want to configure, and this guide will show you how:

Then install the Sentry Node SDK:

Copied
npm install @sentry/node@^11.0.0 @sentry/profiling-node@^11.0.0

Create agent/instrumentation/sentry.ts and export the Sentry instrumentation provider. Eve auto-discovers providers in agent/instrumentation/ and runs them at server startup, before it loads your agent and the AI SDK:

agent/instrumentation/sentry.ts
Copied
import * as Sentry from "@sentry/node";
// ___PRODUCT_OPTION_START___ profiling
import { nodeProfilingIntegration } from "@sentry/profiling-node";
// ___PRODUCT_OPTION_END___ profiling
import { defineInstrumentation } from "eve/instrumentation";

export default defineInstrumentation(
  Sentry.eveInstrumentation({
    dsn: "___PUBLIC_DSN___",
    // ___PRODUCT_OPTION_START___ profiling

      // Add our Profiling integration
      nodeProfilingIntegration(),
    // ___PRODUCT_OPTION_END___ profiling
    // ___PRODUCT_OPTION_START___ performance

    // Set tracesSampleRate to 1.0 to capture 100%
    // of spans for tracing.
    // We recommend adjusting this value in production.
    // Learn more at
    // https://docs.sentry.io/platforms/javascript/guides/node/configuration/options/#tracesSampleRate
    tracesSampleRate: 1.0,
    // ___PRODUCT_OPTION_END___ performance
    // ___PRODUCT_OPTION_START___ profiling

    // Set profileSessionSampleRate to 1.0 to profile every session.
    // Learn more at
    // https://docs.sentry.io/platforms/javascript/configuration/options/#profileSessionSampleRate
    profileSessionSampleRate: 1.0,
    // ___PRODUCT_OPTION_END___ profiling
  }),
);

With this setup, Sentry captures errors thrown by your agent and AI spans for every turn — model calls, tool executions, token usage, and latency — along with outgoing HTTP and fetch requests. It also groups every turn in an Eve session into one Sentry conversation. Prompts and model outputs are recorded on your agent spans by default, so the conversation detail shows the full exchange without any extra configuration.

To also instrument the rest of your Node app, see Instrument Other Dependencies below. To review what's captured and turn recording of prompts and responses off, see Control the Data You Send to Sentry.

Start Eve and send a prompt that calls a tool. Then open Explore → Agents in Sentry. Select the conversation to open its detail, where the timeline shows the model calls, tool calls, token usage, and latency for that turn, plus any errors your agent threw.

If no data appears, confirm that:

  • The dsn belongs to the Sentry project you're viewing.
  • tracesSampleRate is greater than 0.
  • Your app completed at least one agent turn after you added agent/instrumentation/sentry.ts.
  • Eve's earlier OTLP instrumentation isn't also initialized in the agent runtime. Running both integrations duplicates AI spans, token totals, and costs.

By default, the SDK sends the inputs and outputs of your LLM and tool calls, such as prompts, responses, and tool arguments. This will give you rich debugging context. Review the data your agent handles before you deploy to production.

The SDK always filters sensitive values whose keys match a built-in denylist, such as auth or password, and sends [Filtered] instead.

To send less data, turn off the categories you don't need in the dataCollection option. For the full list of categories and their defaults, see the dataCollection options.

agent/instrumentation/sentry.ts
Copied
export default defineInstrumentation(
  Sentry.eveInstrumentation({
    dsn: "___PUBLIC_DSN___",
dataCollection: { genAI: { inputs: false, outputs: false }, },
}), );

Each Eve turn is its own durable workflow, so a session's turns land in separate traces. eveInstrumentation uses the durable session id (session.id) as the Sentry conversation id by default, which groups all turns from the session into one Conversation.

To derive the conversation id yourself — for example, to group a subagent's turns under a root or parent session — pass getConversationId in your instrumentation provider:

agent/instrumentation/sentry.ts
Copied
export default defineInstrumentation(
  Sentry.eveInstrumentation({
    dsn: "___PUBLIC_DSN___",
    getConversationId: (context) => context.session.id,
  }),
);

The setup above instruments the AI SDK, HTTP, and fetch with no bootstrapping. To also instrument the rest of your Node app — database clients like pg or mysql, and other libraries that patch themselves as they load — start Eve with Sentry's ESM loader preloaded, so it can hook those modules at load time:

Copied
NODE_OPTIONS='--import=@sentry/node/import' eve start

The loader can only transform modules that Eve leaves external to its server bundle. If Eve inlines a dependency, the loader can't hook it, so the module is silently never instrumented. Rather than hardcode that list, use getInstrumentedModuleNames() from @sentry/node to keep every package Sentry instruments external in agent/agent.ts:

agent/agent.ts
Copied
import { getInstrumentedModuleNames } from "@sentry/node";
import { defineAgent } from "eve";

export default defineAgent({
  build: {
    externalDependencies: getInstrumentedModuleNames(),
  },
});

getInstrumentedModuleNames() returns the authoritative set of packages Sentry instruments through the loader (database clients like pg and mysql, and others), so you don't have to maintain the list yourself. The AI SDK isn't part of it — it reports through a native diagnostics channel that works without the loader.

  • @sentry/node: >=11.0.0
  • eve: >=0.63.0
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").