SDK
TypeScript SDK
Records Node.js agent runs with the same data as the Python SDK: model calls, token counts, tools, errors, the release and the environment. Node.js 20 or later.
Install
npm install lanternfish-sdkStart recording
Call instrument() once, before the agent runs. The release defaults to LANTERNFISH_RELEASE or the CI commit (GITHUB_SHA, VERCEL_GIT_COMMIT_SHA and others); the environment to LANTERNFISH_ENVIRONMENT.
import OpenAI from "openai";
import { instrument, traceTool, wrapOpenAI } from "lanternfish-sdk";
const lanternfish = instrument({
apiKey: process.env.LANTERNFISH_API_KEY,
endpoint: process.env.LANTERNFISH_ENDPOINT,
agent: "booking-agent",
});
const openai = wrapOpenAI(new OpenAI());
const flights = await traceTool("search_flights", () => searchFlights("IST-LHR"));
await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: `Pick the cheapest of ${JSON.stringify(flights)}` }],
});
// In serverless functions, send pending runs before the response returns.
await lanternfish.flush();wrapOpenAI records chat.completions.create and responses.create, streams included. Pass { captureContent: false } for agents that handle personal data; model, tokens and timing are still recorded. traceTool records a tool call; the Releases page measures tool use from it.
Vercel AI SDK
On AI SDK 7, register its OpenTelemetry integration once after instrument(). Model calls, tokens, tool calls and messages are recorded under one run, and the agent summary does not count tokens twice. On AI SDK 4–6, experimental_telemetry alone is enough.
npm install @ai-sdk/otelimport { generateText, registerTelemetry } from "ai";
import { OpenTelemetry } from "@ai-sdk/otel";
registerTelemetry(new OpenTelemetry());
await generateText({ model, prompt: "Book IST-LHR", tools, experimental_telemetry: { isEnabled: true } });Send the same spans elsewhere
Extra span processors receive the same spans, for example an OTLP endpoint such as the Datadog Agent.
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
instrument({
spanProcessors: [new BatchSpanProcessor(new OTLPTraceExporter({ url: "http://localhost:4318/v1/traces" }))],
});Check a release in CI
The verdict command ships with the Python SDK. Run your agent test suite with environment "ci", then stop the deploy if the release regressed. See the Releases guide.
pip install lanternfish
lanternfish verdict --release "$GITHUB_SHA" --environment ci