nomi

Setup guides · Python

Local Model

For an agent whose model runs on your machine. Written from runs against Ollama on four routes; nomi doesn't change how your agent talks to the model.

Versions
Ollama 0.40.17 with qwen2.5:0.5b and deepseek-r1:1.5b; other local servers not run
Route
Any of four Python routes, pointed at a model on your machine

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.

How it fits

A local model isn’t a route of its own: use the guide for your framework, and point it at the model on your machine. This page gives the setting for each and what then shows as unknown. It was written from runs against Ollama 0.40.17; other local servers are likely to work but weren’t run. nomi doesn’t wrap or patch the model client.

What shows as unknown

  • Cost. nomi has no price for a local model, so its calls show as unpriced (<model>), never as $0, and totals that mix priced and local calls say so. To price one, add it to pricing.json in the nomi home.
  • Provider. An OpenAI-format client pointed anywhere other than api.openai.com shows the address it was sent to, such as 127.0.0.1:11434. nomi doesn’t name a provider from an address or a model name. Ollama’s own clients and Pydantic AI’s OllamaProvider say ollama.
  • Tokens, on some streams. A streamed reply that carries no usage has tokens unknown, never zero.
  • Reasoning text from thinking models is kept apart from the reply, where the route passes it on.

Steps, tool calls, timings and replies are recorded as with a hosted model.

Point your framework at Ollama

ollama serve &                        # or open the Ollama app
ollama pull qwen2.5:0.5b              # use a model whose `ollama show` lists "tools"

Custom Loop. With the ollama client, wrap each call in observer.model_call(model, provider="ollama", ...) and call finish() once the reply is in; finish(usage=) reads Ollama’s prompt_eval_count and eval_count, and finish(reasoning=) takes the thinking text. Record a stream this way too: chat_completions(..., stream=True) records no reply. The rest is as in Custom Loop.

OpenAI Agents SDK. Ollama has no Responses API, so use the Chat Completions model. The rest is as in the OpenAI Agents guide.

model = OpenAIChatCompletionsModel(
    model="qwen2.5:0.5b",
    openai_client=AsyncOpenAI(api_key="ollama", base_url="http://127.0.0.1:11434/v1"),
)

The provider shows as the endpoint, and the returned model and stop reason aren’t reported. Pass ModelSettings(include_usage=True) to get tokens on a stream. Reasoning text isn’t passed on.

LangChain and LangGraph. ChatOllama records the provider, tokens and stop reason; add reasoning=True to record reasoning text. The rest is as in the LangChain guide.

model = ChatOllama(model="qwen2.5:0.5b", base_url="http://127.0.0.1:11434", num_predict=1024)

ChatOpenAI with base_url="http://127.0.0.1:11434/v1" also works: the provider shows as the endpoint, a stream has tokens unknown, and reasoning text is dropped before nomi sees it.

Pydantic AI. Provider, tokens, stop reason and reasoning text are all recorded. Send its spans as in the Pydantic AI guide.

model = OpenAIChatModel("qwen2.5:0.5b", provider=OllamaProvider(base_url="http://127.0.0.1:11434/v1"))

What it can’t see

  • When the first token arrived, on any route.
  • A stream cut off through Ollama’s OpenAI-compatible endpoint ends silently; nomi records what the reply lacked, not an error.
  • What other local servers record: only Ollama was run.

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