Skip to main content
This guide is for developers who can change Agent code. The Python path uses Relay’s framework integration. On Node.js 24+, use the official SDK to record requests and tool calls manually. For Node.js 22, see Langfuse’s local tool example. For ready-made apps such as Codex and Claude Code, install the dedicated plugin using Agent application integration.
For an installed Hermes Agent, use Hermes native Relay integration. It uses the host’s built-in runtime and Hermes application card, without this page’s framework examples, Python startup helper or Node.js manual instrumentation. The host and Relay version contracts differ between these paths.
Relay runs inside your application process and exports traces directly to AI Vision. This integration does not require a separate Relay backend. Choose the path that matches your application: The first success check is to find the Trace ID from this request in AI Vision and inspect the calls that ran. Integration credentials authorize data export to AI Vision; a model API key authorizes model calls. They are not interchangeable.

1. Select a language and obtain connection settings

Open Agent Access → Agent Market → Custom Agent integrations, choose Via NeMo Relay, then select Python for LangChain, LangGraph, or Deep Agents, or JavaScript / TypeScript for Node.js SDK. Select or create an AI Vision project and obtain complete credentials in the environment variables section. Both the Python relay_tracing.py helper and the Node.js example read these variables. For your first run, execute the page’s Shell settings in the same terminal as the example. Saving a .env file does not load it automatically: use the page’s loading command for Python, or --env-file below for Node.js. Configuration alone does not add instrumentation.

2. Run a complete example first

The commands below use Bash/zsh. The Python example requires 3.11+; if your interpreter is called python3, replace python in both installation and execution commands.

Python: LangChain example

For the first check, choose Python → LangChain and follow these steps:
Complete LangChain example, connection settings and download button on the Python NeMo Relay integration pageComplete LangChain example, connection settings and download button on the Python NeMo Relay integration page

NeMo Relay Python: complete LangChain example and connection settings · Demo data · Click to enlarge

  1. Use Select project, or enter a name and click Create project. Click Get credentials under Environment variables. Ask the space administrator to check permissions if either action fails.
  2. Choose Run a complete example and copy the Shell environment settings into the terminal running Python. Replace OPENAI_API_KEY, OPENAI_MODEL, and OPENAI_BASE_URL with working model settings. Confirm that this machine can reach AIVISION_OTLP_ENDPOINT and the authorization value is complete, without placeholders or masks.
  3. Click Download example and save relay-langchain-agent-middleware.py in a practice directory. The complete file already contains the startup helper; no separate relay_tracing.py is needed. In a Python 3.11+ environment, enter that directory, install dependencies, and run:
  1. Keep the 32 hexadecimal characters printed after AI Vision trace_id. Enter them in Trace ID for this request, select Verify this Trace, and open the details to match the Trace ID, model, and tool nodes. You can find it again through My Agent channel → Agent traces.
  2. After reading back this request, switch to Add to existing code and replace existing_*, input, and session placeholders with your application objects.
If no Trace ID is printed, resolve dependency, model configuration, or execution errors first. If an ID is printed but cannot be read back, check the project, reachable endpoint, complete credentials, and exporter logs. Retry or follow No data troubleshooting.

JavaScript / TypeScript: Node.js local tool example

This example calculates 7 × 9 so you can check the connection and the request/tool relationship. It makes no model calls, needs no model API key, and produces no model usage.
Complete Node.js SDK example, connection settings and download button on the JavaScript TypeScript NeMo Relay integration pageComplete Node.js SDK example, connection settings and download button on the JavaScript TypeScript NeMo Relay integration page

NeMo Relay JavaScript / TypeScript: complete Node.js SDK example · Demo data · Click to enlarge

  1. Select JavaScript / TypeScript → Node.js SDK → Run a complete example. Install dependencies in a new practice directory to keep its module settings separate from your application:
node --version must report version 24 or newer. This example uses server-side Node.js and ESM modules; it does not run in a browser.
  1. Select or create a project on the page, click Get credentials, and execute the Shell environment settings in this terminal. Use the complete authorization value and an AIVISION_OTLP_ENDPOINT reachable from this machine. This example only needs the three AIVISION_* variables.
  2. Click Download example, place relay-nodejs.ts in the practice directory, and run:
If you selected .env, save the settings as .env in the same directory and use:
  1. A successful run prints output like this, with new IDs each time:
  1. Enter this Trace ID in Trace ID for this request and click Verify this Trace. Open the details and look for a request root with a multiply tool child, input a=7, b=9, and result 63. No model node is expected for this example.
If a Trace ID appears but cannot be read back, follow section 4. Resolve execution errors before checking success; printing an ID alone is not sufficient. In an existing project with "type": "commonjs", save the file as relay-nodejs.mts, run node relay-nodejs.mts (optionally with --env-file=.env), and use .mts in its import path.

3. Integrate your existing application

Python framework integration

Install the dependencies shown on the page. Save the supplied startup module as relay_tracing.py where your application can import it. Apply the “Add to existing code” snippet while preserving your model, tools, and business configuration. Apply the changes for your framework:
  • LangChain: add NemoRelayMiddleware to existing middleware and merge NemoRelayCallbackHandler into invocation config. Preserve business callbacks.
  • LangGraph: the callback records graph lifecycle. Nested LangChain agents also need middleware and the parent config. Use official create_tool_node for standalone tool nodes.
  • Deep Agents: add_nemo_relay_integration adds middleware to the main agent and dictionary subagents. Merge NemoRelayDeepAgentsCallbackHandler. Check internal calls separately for default general-purpose, precompiled, and remote subagents.

Node.js / TypeScript manual instrumentation

After verifying the local example, select Add to existing code. Keep the downloaded relay-nodejs.ts and import its startup, request, and shutdown functions. It is a reusable module: importing it does not run the multiplication example. It does not need Python’s relay_tracing.py. Replace existingAgent with your application function, pass the session ID and input to handleRequest, and register onShutdown with the service shutdown handler. Preserve the business return value and await child tasks before returning from the request. Keep credentials on the server. The request wrapper records request input and output. Instrument internal tools and models with official APIs such as toolCallExecuteAsync / llmCallExecuteAsync at boundaries you control. This example does not automatically instrument LangChain.js or LangGraph.js, or provide the coverage of Python middleware.

Request and service lifecycle

For Python, call start_tracing() once at service startup. Give each request its own request_scope, reuse the business session ID, and set the explicit business output after execution. After all requests finish, call stop_tracing() during shutdown; asynchronous services use await stop_tracing_async(). For Node.js, call the example’s startTracing() once at startup, use runWithTrace() per request, and await stopTracing() after all requests finish. These functions come from the downloaded example module; they are not top-level Relay SDK APIs. Do not shut down the process exporter after each request. Review existing telemetry before adding another collector. Keep one complete collection path per destination and preserve the application’s existing environment. Run a model and tool request with the Python framework example, or a local tool operation with the complete Node.js example. Save the printed trace_id, then verify actual requests after integrating your application.

4. Read and inspect the Trace

Enter that trace_id on the integration page to read the selected project’s data. If you know the expected Span count from an independent execution record, enter it in the optional field before verifying. Inspect the unique Span count, storage count, read completeness, parent relationships, and usage results using the shared verification result guide, then open the details and verify:
  1. The record belongs to this request and project.
  2. Any model or tool calls that actually ran appear under the expected parents.
  3. Input, output, and errors match execution. Check usage only when the source provides it.
  4. For subagents, inspect internal calls as well as the subagent node.
A complete read describes the stored data returned by the backend; it does not prove that every business call was captured. The Node.js local-tool example has no model call: when the backend confirms there are no billable calls, usage coverage is not applicable. Missing evidence remains unknown, while an explicitly reported zero remains zero. For a partial read or structural differences, inspect the listed Span IDs and compare against the application’s execution record. If the record is absent, check the URL, credentials, exporter logs, and No data troubleshooting.

Versions and further reading

Python examples use Relay 0.9.x / Python 3.11+ (nemo-relay>=0.9.3,<0.10), with 0.9.3 as the validated baseline. Node.js examples use Node.js 24+ / nemo-relay-node>=0.9.3 <0.10. Relay is pre-1.0, so installation stays within the same minor series. Use the framework dependency ranges shown on the integration page. Official documentation may describe newer releases. Official capabilities and examples validated with AI Vision have separate scopes. Recheck APIs, export settings, and real requests before upgrading. Streaming, cancellation, TTFT, and subagent cleanup have version-dependent boundaries. See the source integration notes and validation evidence and known issues. Official references: Relay overview, LangChain, LangGraph, Deep Agents, Node.js quick start (0.9.x), and OTLP export. Relay also provides application and CLI integrations. AI Vision recommends dedicated collectors for existing applications; this guide covers code integration for custom Agents.