nomi

Setup guides · TypeScript

LangChain.js and LangGraph.js

One call at startup reaches the chains, agents and graphs started after it. Nothing changes where you invoke them, and your callbacks keep working. Runs started from a callback set up before that call are missed, and tool code locations aren't available.

Versions
@langchain/core >=1.1.49,<1.6; @langchain/langgraph >=1.2.9,<1.8 and langchain >=1.3.5,<1.7 when installed; Node 22 or later, run on Node 22.13.0 only; TypeScript SDK (runnomi-sdk) 1.0.0, installed from the release's packed file
Route
One call at startup, through @langchain/core's own configure hook

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.

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.

Check your versions

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

The range is @langchain/core 1.1.49 up to (not including) 1.6; @langchain/langgraph 1.2.9 up to 1.8 and langchain 1.3.5 up to 1.7 are optional, and checked only when installed. Pre-releases aren’t accepted. The provider packages aren’t gated; a field one doesn’t give is recorded as unknown.

Outside the range, instrument attaches nothing, returns null and logs one nomi: LangChain adapter off line; your agent runs as usual, and scopes and declarations are still recorded. { strict: true } as the third argument throws instead. Don’t downgrade your app’s packages to fit.

Attach

  1. Once, where the observer is created, at startup and before anything that later starts runs (a server, a queue consumer, a timer). Pass your app’s own @langchain/core/context module: the adapter doesn’t load the framework, and the module your app imports is the copy its runs read.

    import * as context from "@langchain/core/context";
    import { Observer } from "runnomi-sdk";
    import { instrument } from "runnomi-sdk/integrations/langchain";
    
    const observer = Observer.fromEnv("my-agent", { project: "my-repo", agent: "my-agent", prefix: "MYAGENT_NOMI" });
    const handler = instrument(observer, context);
    

    Nothing changes at invoke, stream or streamEvents calls. Don’t also pass a handler in callbacks, except in the one case below.

  2. Wrap each unit of work. A graph, agent, chain or model invoked inside the scope joins its run; outside one, each top-level invoke is its own run with no group:

    const answer = await observer.observe("support_turn", { workflow: "support", group: threadId, step: "reply" }, () =>
      graph.invoke(input, config),
    );
    

    For a graph that pauses on an interrupt, use the LangGraph thread_id (or your own conversation ID) as group, so the paused and resumed runs are one work item.

  3. Before the process ends, await observer.close().

Where runs can be missed

@langchain/core keeps its configure hooks in its own asynchronous context, not in a process-wide place as Python’s langchain-core does. The hook reaches every run started by the code that called instrument and by anything that code starts afterwards: later statements, timers and servers created after it, the requests those servers handle.

It doesn’t reach a run started from a callback that was set up before instrument ran: a timer already scheduled, a server already listening, an event listener already registered. Those runs aren’t recorded. To cover them, call instrument first, next to Observer.fromEnv at the top of the entry file; or call it again inside that callback (it registers the hook in the context it is called from, and calling it twice is harmless); or pass the handler it returned for that run:

graph.invoke(input, { callbacks: [handler] });

Recorded automatically

  • Model calls: requested and returned model, tokens (and cache reads and reasoning tokens where the provider reported them), stop reason, the output cap from the request, the provider’s response ID (streamed replies too), and prompts and replies with content capture on.
  • The provider: ChatOpenAI pointed at another server shows that server’s host and port, not openai.
  • Tool calls: name, arguments, result, duration, and errors with the error’s own type; the provider’s tool-call ID, exact. A tool that throws inside createAgent is one failed tool step; the error is handed to the model, so the run is a success with one error step.
  • Rejected tool calls: a call naming a tool the agent doesn’t have, answered without running anything, is a failed tool step marked as rejected by the framework.
  • Structure: graph, node, chain, model and tool runs, for createAgent agents, StateGraph graphs, chains and bare chat models. Each LangGraph node is a step.
  • Retries LangChain runs as separate runs: each .withRetry() attempt is its own model call; a node retryPolicy retry shows as an errored node run, then another for the same task.
  • Interrupts: the paused node ends deferred, not failed.
  • Cancellation: a run stopped through signal is recorded as cancelled, not failed.
  • Errors: the type and HTTP status, when the error has one; the message with content capture on.

Declared by your code

Decisions (results and issues), effects and logical actions, expected exceptions and waits. No callback provides them. Don’t wrap model or tool calls the adapter already records; that duplicates steps.

What it can’t see

  • The code location of a tool: the callback carries the tool’s name, not its function. Every tool step says so.
  • A run started from a callback set up before instrument (above).
  • Retries inside one model call: a chat model’s maxRetries is one longer model call with the attempts unknown. No attempt number for .withRetry() or a node retryPolicy.
  • The returned model in streamed ChatAnthropic replies with @langchain/anthropic 1.6.6, which doesn’t pass it on (releases up to 1.6.0 do).
  • Graph state passed between nodes. Model and tool content are recorded.
  • Whether a graph’s abort came from your signal or a timeout signal: both are recorded as cancelled.

Limits and edge cases

  • An observer.tool(...) made inside a LangChain tool is recorded under the scope around the run, not under that tool’s step, and is its own run when there is no such scope.
  • A zero cache-read or reasoning count the provider didn’t report is left out rather than shown as 0.
  • CommonJS apps and LangSmith tracing beside nomi weren’t run.

When nomi is down

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.

A process killed mid-run: the model call and node that had ended are stored with their tokens; the rest have a start and no end, and the run is shown as not finished.

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?”