Episode 05traces

eve already traces every agent turn

eve runs agent/instrumentation.ts at startup, and creating that file is what turns telemetry on. One file traces every turn, model step and tool call.

Ship telemetry toUse an OTLP endpoint you already have, from another vendor or your platform team. This one needs a one-time setup step: save your endpoint and the episodes fill it in.Set your endpointRun an OpenTelemetry Collector on your machine and watch telemetry arrive in its terminal. No account needed.More detailsShip straight to Bronto. You need an account and an API key with ingest permission.More details

Switch it on

Create agent/instrumentation.ts. eve finds it by name and runs it at startup, before any agent code, and there is no enable flag to set. Traces cover every turn, each model step with its token counts, and each tool call. Keep the endpoint in the file rather than in OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: the workflow runtime bundles its own OTel SDK, which reads that variable and exports every span again without your headers.

npm i @vercel/otel @opentelemetry/exporter-trace-otlp-http
import { registerOTel } from "@vercel/otel";
import { defineInstrumentation } from "eve/instrumentation";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

export default defineInstrumentation({
  traceChannelRequests: true,
  setup: ({ agentName }) =>
    registerOTel({
      serviceName: agentName,
      traceExporter: new OTLPTraceExporter({
        url: "https://ingestion.eu.bronto.io/v1/traces",
        headers: { "x-bronto-api-key": process.env.BRONTO_API_KEY ?? "" },
      }),
    }),
});
npm i @vercel/otel @opentelemetry/exporter-trace-otlp-http
import { registerOTel } from "@vercel/otel";
import { defineInstrumentation } from "eve/instrumentation";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

export default defineInstrumentation({
  traceChannelRequests: true,
  setup: ({ agentName }) =>
    registerOTel({
      serviceName: agentName,
      traceExporter: new OTLPTraceExporter({
        url: "http://localhost:4318/v1/traces",
      }),
    }),
});

This assumes a Collector listening on localhost:4318; the Local Collector setup shows how to start one.

This uses the endpoint and auth header you saved in the setup guide.

npm i @vercel/otel @opentelemetry/exporter-trace-otlp-http
import { registerOTel } from "@vercel/otel";
import { defineInstrumentation } from "eve/instrumentation";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

export default defineInstrumentation({
  traceChannelRequests: true,
  setup: ({ agentName }) =>
    registerOTel({
      serviceName: agentName,
      traceExporter: new OTLPTraceExporter({
        url: "YOUR_OTLP_ENDPOINT/v1/traces",
        headers: { "YOUR_AUTH_HEADER": "YOUR_AUTH_VALUE" },
      }),
    }),
});