nomi

Setup guides · TypeScript

Vercel AI SDK

The AI SDK writes its own OpenTelemetry spans. Spans only, model and tool calls are recorded with no nomi code. Add the TypeScript SDK for scopes, decisions, effects, the commit and identity, and an exporter that can't end your process when nomi is down.

Versions
ai >=7.0.0,<7.0.182 with @ai-sdk/otel >=1.0.0,<1.0.182; the range is checked only with the SDK, and spans only was tested with ai 7.0.179 and @ai-sdk/otel 1.0.179; Node 22 or later; TypeScript SDK (runnomi-sdk) 1.0.0 for the second shape, installed from a packed file
Route
The framework's own OpenTelemetry GenAI spans, exported to the local receiver; with the TypeScript SDK, through an exporter it guards

Your coding agent can do the attaching. Ask it:

Use the attach-nomi skill and add nomi to this agent.

It finds the places to hook in and asks you the few things only you know. The steps below are what it does.

Start nomi

nomi is one program, nomi. Download it from the releases page, then:

nomi init
nomi configure -mode sdk -source my-agent -receiver-listen 127.0.0.1:4320
nomi start                                   # leave this running
nomi browser -home "$HOME/.nomi"  # opens the run view

Everything it records lives in ~/.nomi; -home on any command chooses another folder. nomi doctor says whether it's healthy.

For the shape that uses the TypeScript SDK, install the TypeScript SDK (runnomi-sdk 1.0.0) into your agent from the release's packed file. It isn't on npm, so keep the whole address. Then tell it where nomi is:

cd /path/to/your/agent
npm install https://github.com/joshbodunrin/nomi/releases/download/v1.0.0/runnomi-sdk-1.0.0.tgz
export MYAGENT_NOMI_ENABLED=1
export MYAGENT_NOMI_ENDPOINT=http://127.0.0.1:4320
export MYAGENT_NOMI_TOKEN_FILE="$HOME/.nomi/write-token"

npm records that address in package.json and the lockfile, so another machine or CI installs the same file. This was checked with npm 10.9.2 from a packed file on disk, from ES module and CommonJS applications; pnpm, yarn and bun weren't.

The SDK has no runtime dependencies and works from ES modules and CommonJS. The settings are read by Observer.fromEnv with prefix: "MYAGENT_NOMI"; the SDK reads the token file itself, so the token is never on a command line. Events are held in memory and sent in the background: what can't be delivered is counted and reported as lost. To keep events on disk through an outage or a restart, set MYAGENT_NOMI_SPOOL_DIR and MYAGENT_NOMI_SOURCE.

These are the same-machine settings. Your agent can also run in a container or on another machine of yours and send to the same nomi: where nomi runs has what changes, and the attach skill can set it up.

nomi never changes how your agent runs: if it’s off, down or hanging, your agent carries on with the same output.

Point the spans at nomi

These are for spans only. With the SDK, the exporter gets its endpoint, token and timeout from the observer, and none of these is needed.

Set these where your agent is launched. The exporter can't read a token file, so the token is filled in at launch; never write it into the repository.

export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4320
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20$(cat "$HOME/.nomi/write-token")"
export OTEL_EXPORTER_OTLP_TRACES_TIMEOUT=500
export OTEL_METRICS_EXPORTER=none
export OTEL_RESOURCE_ATTRIBUTES="vcs.ref.head.revision=$(git rev-parse HEAD),nomi.project=my-repo,nomi.agent=my-agent,nomi.root_commits=$(git rev-list --max-parents=0 HEAD | paste -sd ';' -)"

The receiver takes binary protobuf over HTTP. Leave OTEL_EXPORTER_OTLP_COMPRESSION unset: compressed bodies are rejected. Keep the timeout (in milliseconds for JavaScript): with the exporter's defaults (10 seconds per export, retried with backoff), a nomi that is down or hanging adds 12 to 20 seconds to a run; with it, under a second. Without the commit setting, a spans-only run has no code version; without the project and agent, its runs are in the unknown group, apart from every named agent.

Two shapes

Spans only needs no nomi code: the AI SDK’s spans go to nomi through a standard exporter, set up by the export settings above. Model calls, tool calls and their structure are recorded; decisions, issues and effects aren’t, and each step’s success isn’t observed.

Spans plus the SDK adds a scope around each unit of work, and with it the run’s outcome and code location, decisions, issues and effects, the commit with whether it had uncommitted changes, and the count of lost events. The SDK builds the exporter from the endpoint and token the observer already has, so the export settings above aren’t needed.

Both need Node 22 or later, which ai 7 itself requires. OpenTelemetry JS 0.301.2 declares Node 22.15 or later; the tests ran on Node 22.13.0. Every test ran against a local stand-in for the provider, with @ai-sdk/anthropic and @ai-sdk/openai: nothing was run against a real provider API.

Spans only: switch on the spans

Register the AI SDK’s telemetry and an OpenTelemetry NodeSDK with the protobuf trace exporter. The JSON exporter isn’t accepted.

import { NodeSDK } from "@opentelemetry/sdk-node";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { registerTelemetry } from "ai";
import { OpenTelemetry } from "@ai-sdk/otel";

const sdk = new NodeSDK({ traceExporter: new OTLPTraceExporter() });
sdk.start();
registerTelemetry(new OpenTelemetry());

// ... your agent runs ...

// At exit. shutdown() rejects when its last export fails (nomi down, hanging or
// answering an error); left uncaught, that ends the process with exit code 1.
await sdk.shutdown().catch((e) => console.error(`tracing: spans not exported: ${e.message}`));

OTEL_METRICS_EXPORTER=none (in the settings above) stops NodeSDK from also sending metrics, which nomi doesn’t take. The settings above say what a down nomi costs with and without the timeout.

The exporter reads the settings above. Content is on by default; telemetry: { recordInputs: false, recordOutputs: false } turns it off for a call.

Spans only: group a conversation’s runs

The AI SDK writes no conversation ID of its own, so each generateText call is a run on its own. Pass the conversation’s ID with each call and write it onto every span; nomi then groups the conversation’s runs into one work item:

registerTelemetry(new OpenTelemetry({
  enrichSpan: ({ runtimeContext }) =>
    typeof runtimeContext?.conversationId === "string"
      ? { "gen_ai.conversation.id": runtimeContext.conversationId }
      : undefined,
}));

await generateText({
  // ...model, messages, tools...
  runtimeContext: { conversationId: conversation.id },
  telemetry: { includeRuntimeContext: { conversationId: true } },
});

Spans plus the SDK

import { vercelSupport } from "runnomi-sdk/integrations/vercel";
console.log(vercelSupport());

The range is ai 7.0.0 up to (not including) 7.0.182, with @ai-sdk/otel 1.0.0 up to 1.0.182. Tested on 2026-11-23: ai 7.0.0, 7.0.179 and 7.0.181, each with the @ai-sdk/otel release of the same number, and with @opentelemetry/sdk-node and @opentelemetry/exporter-trace-otlp-proto 0.301.2. Pre-releases aren’t accepted. The AI SDK releases often, so the upper bound goes out of date quickly.

Outside the range, instrument logs one nomi: Vercel AI SDK adapter off line naming the installed versions, and the exporter it gives sends nothing to nomi: your agent runs as usual, scopes and declarations are recorded, the AI SDK’s model and tool calls aren’t. instrument(observer, { strict: true }) throws instead. Don’t downgrade your app’s packages to fit.

  1. Once, at startup. Beside ai, install @ai-sdk/otel (the release with ai’s number), @opentelemetry/sdk-node and @opentelemetry/exporter-trace-otlp-proto; the JSON exporter isn’t accepted. Until @ai-sdk/otel is installed, vercelSupport() shows it as null and unsupported; check again afterwards.

    import { OpenTelemetry } from "@ai-sdk/otel";
    import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
    import { NodeSDK } from "@opentelemetry/sdk-node";
    import { registerTelemetry } from "ai";
    import { Observer } from "runnomi-sdk";
    import { instrument } from "runnomi-sdk/integrations/vercel";
    
    const observer = Observer.fromEnv("my-agent", { project: "my-repo", agent: "my-agent", prefix: "MYAGENT_NOMI" });
    const tracing = instrument(observer);
    const sdk = new NodeSDK({
      traceExporter: tracing.exporter(OTLPTraceExporter),
      metricReaders: [],
    });
    sdk.start();
    registerTelemetry(new OpenTelemetry());
    

    Pass tracing.exporter the class, not an instance: nomi constructs it for its own receiver, with the endpoint and token the observer has and a 500 ms timeout (tracing.exporter(OTLPTraceExporter, { timeoutMillis }) changes it). The token isn’t put on a command line. With nomi not enabled, or the adapter off, this exporter sends nothing, so the same code runs everywhere. metricReaders: [] stops NodeSDK from starting its metrics exporter, which nomi doesn’t take.

  2. Wrap each unit of work. An AI SDK call inside the scope joins its run, and the scope’s group is the work item, so enrichSpan isn’t needed:

    const text = await observer.observe("support_turn", { workflow: "support", group: conversation.id, step: "reply" }, async () => {
      const result = await generateText({ model, messages, tools, stopWhen: stepCountIs(8) });
      observer.decision("reply_checked");
      return result.text;
    });
    

    An observer.tool(...) made inside an AI SDK tool’s execute nests under that tool’s span. Don’t wrap model or tool calls the spans already record, and don’t add a second NodeSDK or tracer provider.

  3. At exit, in this order, so a failed last export is counted in nomi’s one closing line:

    await sdk.shutdown();
    await observer.close();
    

    The exporter from tracing.exporter counts a failed export and tells the span processor the batch is dealt with, so sdk.shutdown() doesn’t reject when nomi is down and the .catch(...) of the spans-only shape isn’t needed for it. With the metadata profile, it leaves prompts, replies, system instructions, tool arguments and results, and exception messages out of what it sends to nomi; the spans themselves aren’t changed, so your other exporters get them whole.

An app that was set up for spans only and starts its NodeSDK only when OTEL_EXPORTER_OTLP_ENDPOINT is set must change that condition when it moves to tracing.exporter(OTLPTraceExporter): no OTEL_* variable is set any more, so with the old condition nothing starts and the AI SDK’s calls aren’t recorded. Start the NodeSDK always (the exporter sends nothing when nomi isn’t enabled), or when observer.setup === "enabled".

An app that already has OpenTelemetry passes the exporter it built, tracing.exporter(new OTLPTraceExporter()), configured by the export settings above. It is guarded the same way when it sends to this nomi, and handed back untouched when it sends anywhere else. If it sends to nomi with no timeout, or one over a second, instrument says so once. Sending to nomi beside another backend through two span processors wasn’t tested.

An AI SDK call made with no scope open is its own run, from spans alone. resourceFromAttributes(tracing.resourceAttributes()), as the NodeSDK’s resource, gives such runs the commit, project and agent the observer knows.

Recorded automatically

  • Model calls: provider, requested and returned model, response ID, tokens and cache reads, finish reasons as the AI SDK reports them, the requested output cap, and prompts and replies.
  • Tool calls: name, tool-call ID, arguments, result, duration and errors.
  • Agent runs and their structure, and the commit from vcs.ref.head.revision.
  • Spans only: a work item per conversation when you pass its ID as above.
  • With the SDK: the scope’s outcome (succeeded, failed with the error’s type and its HTTP status where it has one, or cancelled), duration and code location; the commit and whether the tree had uncommitted changes; the project, agent and producer; and the count of lost events.

Declared by your code

With the SDK only: the workflow, group and step of each scope, decisions (results and issues), effects and logical actions (observer.tool(..., { actionId, attempt }, fn) around a side effect’s own attempts), expected exceptions and waits. Spans only, there are none, and the run lists them as unknown.

Not available

  • The code location of a model or tool step, in either shape: JavaScript has no supported way to ask where a tool’s function was defined, and tools aren’t wrapped to find out. With the SDK, the scope has its own, and an observer.tool(...) inside a tool has the location it was called from.
  • Success of a model or tool step: status is unset on success, so steps are unspecified. With the SDK, the run’s outcome is the scope’s. Spans only, nomi failures lists a run only for a failed step, so an empty list means no failed step was recorded, not that every run succeeded.
  • The framework version: its spans carry no version. With ai 7.0.0, the returned model too.
  • The HTTP status of a failed model call on the model step: the span carries the error’s type and message. With the SDK, the scope has the status.
  • A cancelled model call, as cancelled: an aborted call’s span ends as an error of type AbortError. With the SDK, the scope around a generateText that throws the abort is recorded as cancelled. An aborted streamText doesn’t throw, so its scope ends as a success with an unfinished model call; call abortSignal.throwIfAborted() after reading the stream if the run should read as cancelled.
  • A tool error is handed back to the model and the run goes on: the tool step is failed, the run is not.
  • Spans only: lost events, the producer and a dirty tree.
  • Retries inside the AI SDK (maxRetries) or the provider client: one longer model call, attempts unknown. Anything below a tool’s boundary.
  • Model calls whose spans weren’t sent when the process ended: the exporter sends in batches (every 5 seconds and at shutdown), so a killed process loses its spans, finished model calls included. With the SDK, the scope’s start is still stored, the run is shown as not finished with tokens unknown, and it says model calls may be missing.
  • Not tested: generateObject and streamObject, embeddings, the AI SDK’s agent classes, durable workflows, Next.js or an edge runtime, the gRPC exporter, and providers other than @ai-sdk/anthropic and @ai-sdk/openai.

When nomi is down

Spans only, the timeout in the settings above is what keeps a down nomi from holding your run, and the .catch(...) on sdk.shutdown() is what keeps a failed last export from ending the process with exit code 1.

With the SDK: your agent’s output, exit code and requests to the provider are the same with nomi up, down, never answering, answering 500 or refusing the token. What isn’t delivered is counted and said once on stderr. With durable delivery on (NOMI_SPOOL_DIR), the SDK keeps its events on disk and sends them when nomi is back.

The line also counts the framework’s span exports that failed (... and 1 exports of the framework's spans failed). With a nomi that never answers, about 0.5 s of the added time is the exporter waiting out its 500 ms timeout at sdk.shutdown().

In every guide: nothing below a tool’s boundary, such as HTTP retries in your own client, is seen unless your code declares its attempts. Retries inside a provider’s client library show as one longer model call; the step gives the client’s attempts where the route reports them, and otherwise says they aren’t reported. A model nomi has no price for, such as a local one, has its cost shown as unpriced, never as $0. A run that was still open when nomi stopped says its end was not received: its outcome is unknown, not interrupted.

Connect your coding agent

nomi includes a server with read-only tools for your coding agent, and a debug skill that teaches it to keep what was observed, what your code declared and what is unknown apart. Pick yours:

Claude Code

claude mcp add nomi -s user -- nomi mcp
mkdir -p ~/.claude/skills && cp -R skills/debug-agent-with-nomi ~/.claude/skills/

Codex

codex mcp add nomi -- nomi mcp
mkdir -p ~/.codex/skills && cp -R skills/debug-agent-with-nomi ~/.codex/skills/

Cursor, in ~/.cursor/mcp.json (or .cursor/mcp.json for one project)

{"mcpServers": {"nomi": {"type": "stdio", "command": "nomi", "args": ["mcp"]}}}

Cursor's debug skill (the skill needs Cursor 2.4 or later)

mkdir -p ~/.cursor/skills && cp -R skills/debug-agent-with-nomi ~/.cursor/skills/

Cursor also reads skills from ~/.claude/skills/, so if the skills are already installed for Claude Code, nothing needs copying.

Then open a session in your agent's repository and ask, for example:

  • “What went wrong in my agent's last few runs?”
  • “Why did this run fail?”
  • “What changed between these two runs?”