nomi

Setup guides · Python

Pydantic AI

Pydantic AI writes its own OpenTelemetry spans. Point its exporter at the local receiver and model and tool calls are recorded with no other code. Add the Python SDK for decisions and effects.

Versions
pydantic-ai-slim 2.69.0; Python SDK (nomi-sdk) 1.0.0 for declarations
Route
The framework's own OpenTelemetry GenAI spans, exported to the local receiver

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 Python SDK into your agent's environment from the release's wheel (the same file comes with the program; it isn't on the Python package index) and tell it where nomi is:

pip install "nomi-sdk @ https://github.com/joshbodunrin/nomi/releases/download/v1.0.0/nomi_sdk-1.0.0-py3-none-any.whl"
export MYAGENT_NOMI_ENABLED=1
export MYAGENT_NOMI_ENDPOINT=http://127.0.0.1:4320
export MYAGENT_NOMI_TOKEN_FILE="$HOME/.nomi/write-token"

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

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=0.5
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 seconds for Python): 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.

Switch on the spans

There is no environment switch. At startup, instrument every agent and set up a standard tracer provider, which reads the export settings above:

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from pydantic_ai import Agent

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
Agent.instrument_all()

Prompts and replies are included by default; InstrumentationSettings(include_content=False) turns them off. Pass conversation_id= to run or run_sync to group a conversation’s runs; otherwise each run gets its own random ID.

Add declarations (optional)

Install the Python SDK (nomi-sdk 1.0.0) beside OpenTelemetry 1.38 to 1.45, reviewing a dry-run install first. There is no instrument call: the framework already traces.

observer = Observer.from_env("support-desk", project="support-desk", agent="support-desk", prefix="SUPPORT_DESK_NOMI")

with observer.observe("support_turn", workflow="support", group=conversation_id, step="reply"):
    result = await agent.run(text, conversation_id=conversation_id)
    observer.decision("refund_approved", f"order {order_id}")

The framework’s spans join the scope’s run. Don’t wrap model or tool calls the spans already record, and don’t add a second tracer provider.

Recorded automatically

  • Model calls: provider, requested and returned model, response ID, tokens and cache reads, finish reasons as the framework reports them, the requested output cap, and prompts, replies and system instructions when content is on.
  • Reasoning text: the “thinking” and “reasoning” parts of the model’s output, kept apart from the reply, when content is on.
  • The anthropic client’s own span inside each model call, when there is one: shown nested under the framework’s model call, not counted twice.
  • Tool calls: name, tool-call ID, arguments, result, duration, and errors with type, message and stack trace.
  • Agent runs and their parent and child structure, and the instrumentation version (pydantic-ai/2.69.0).
  • Spans only: a work item per conversation ID, and the commit from vcs.ref.head.revision.

Declared by your code

With the SDK only: decisions (results and issues), effects and logical actions, expected exceptions and waits. Spans only, there are none, and the run says so rather than read a caught problem from the content.

What it can’t see

  • The code location of any step; an errored step’s stack trace is the only pointer.
  • Success: the framework leaves status unset on success, so steps are unspecified and a spans-only run’s outcome isn’t observed. Errors are reported.
  • Spans only: lost events, the producer and a dirty tree are unknown.
  • A tool call the framework rejected before any tool ran: there is no step for it.
  • Model calls whose spans weren’t sent when the process ended: the framework exports in batches, and the run then says model calls may be missing.

Limits and edge cases

  • nomi failures lists a spans-only run only for a failed step, an issue or lost events, so an empty list means no failed step was recorded, not that every run succeeded.
  • With content off, message structure is still sent without text: those steps show content included, with empty parts.
  • With content on, a rejected tool call shows only in the next model call’s input.
  • Very long conversations: the framework repeats the whole message history on every model span, so one export can be large (80 fast turns: 9.7 MB). nomi takes up to 32 MiB per request; a larger one is refused with 413, and one span over 1 MiB on its own is left out. Both are counted in nomi doctor, and the exporter logs the 413 itself.

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