Setup guides · Python
LangChain and LangGraph
One call at startup reaches every chain, agent and graph in the process. Nothing changes where you invoke them, and your callbacks and LangSmith keep working.
Your coding agent can do the attaching. Ask it:
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.
Check your versions
from nomi.compatibility import langchain_support
print(langchain_support())
The range is langchain-core 1.1.2 up to (not including) 1.9; langgraph 1.0.2 up to 1.3 and langchain 1.1.0 up to 1.6 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 and logs one adapter off line; your agent runs as usual, and scopes and declarations are still recorded. strict=True raises instead. Don’t downgrade your app’s packages to fit.
Attach
-
Once, where the observer is created:
from nomi import Observer from nomi.integrations.langchain import instrument observer = Observer.from_env("support-desk", project="support-desk", agent="support-desk", prefix="SUPPORT_DESK_NOMI") instrument(observer)It reaches every LangChain and LangGraph run in the process: sync, async, streamed, on any thread. Don’t also pass a handler in
config. -
Wrap each unit of work. A graph or chain invoked inside the scope joins its run:
with observer.observe("support_turn", workflow="support", group=thread_id, step="reply"): graph.invoke(state, config)For a graph that pauses on an interrupt, use the LangGraph
thread_id(or your own conversation ID) asgroup, so the paused and resumed runs are one work item.
Recorded automatically
- Model calls: requested and returned model, tokens, stop reason, the output cap from the request, the provider’s response ID, and prompts and replies. A reply that ended without a finish reason says what it lacked (finish reason, content, tool calls, usage).
- The provider:
ChatOpenAIpointed anywhere other than api.openai.com (a proxy, a local model) shows the provider as unknown, with the address the request went to. - Reasoning text, kept apart from the reply, from chat models that return
reasoning_content(for exampleChatOllamawithreasoning=True). - Tool calls: name, arguments, result, duration and errors (a handled tool error is recorded with its message); the provider’s tool-call ID, exact; the tool function’s file, function and line.
- Rejected tool calls: a call naming a tool the agent doesn’t have, which LangGraph’s
ToolNodeanswers with an error without running anything, is a failed tool step marked as rejected by the framework, with the framework’s message. - Structure: graph, node, chain, model and tool runs. Each LangGraph node is a step.
- Retries: each
.with_retry()attempt is its own model call; a nodeRetryPolicyretry shows as an errored node run, then another for the same task. Retries inside the provider client (max_retriesonChatAnthropicorChatOpenAI) are one longer model call; a failed call shows the client’s attempts. - Interrupts: the paused node ends deferred, not failed.
Declared by your code
Decisions (results and issues), effects and logical actions, expected exceptions and waits. No callback provides them. An observer.tool(...) made inside a LangChain tool nests under that tool’s run. Don’t wrap model or tool calls the adapter already records; that duplicates steps.
What it can’t see
- Tokens in streamed OpenAI replies, unless the app sets
stream_usage=True. They show as unknown, not zero. - A retry number for
.with_retry()orRetryPolicy, and the provider client’s retries on a call that succeeded: the step says they aren’t reported. - The provider’s response ID in streamed replies.
- Graph state passed between nodes. Model and tool content are recorded.
- The code location of a tool that doesn’t run through
BaseTool.run/arun; the step says so.
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?”