For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • About NVIDIA NeMo Relay
    • Overview
    • Architecture
    • Ecosystem
    • Concepts
    • Release Notes
  • Getting Started
    • Agent Runtime Primer
    • Prerequisites
    • Installation
    • Configuration / Setup
    • Quick Start
  • NVIDIA NeMo Relay CLI
    • About
    • Basic Usage
    • Claude Code
    • Codex
    • Cursor
    • Hermes Agent
  • Supported Integrations
    • About
    • OpenClaw Plugin Guide
    • LangChain Integration Guide
    • LangGraph Integration Guide
    • Deep Agents Integration Guide
  • Instrument Applications
    • About
    • Adding Scopes and Marks
    • Instrument a Tool Call
    • Instrument an LLM Call
    • Add Middleware
    • Code Examples
  • Observability Plugin
    • About
    • Configuration
    • Agent Trajectory Interchange Format (ATIF)
    • Agent Trajectory Observability Format (ATOF)
    • OpenTelemetry
    • OpenInference
  • Adaptive Plugin
    • About
    • Configuration
    • Adaptive Cache Governor (ACG)
    • Adaptive Hints
  • NeMo Guardrails Plugin
    • About
    • Configuration
  • Integrate into Frameworks
    • About
    • Adding Scopes
    • Wrap Tool Calls
    • Wrap LLM Calls
    • Handle Non-Serializable Data
    • Using Codecs
    • Provider Codecs
    • Provider Response Codecs
    • Code Examples
  • Build Plugins
    • About
    • Define a Plugin
    • Validate Plugin Configuration
    • Plugin Configuration Files
    • Register Plugin Behavior
    • Design Plugin Configuration
    • NeMo Guardrails Example Plugin
    • Code Examples
  • Contribute
    • About
    • Development Setup
    • Workflow and Reviews
    • Testing and Documentation
  • Reference
    • APIs
    • Performance
  • Resources
    • Support and FAQs
    • Glossary
    • Troubleshooting Guide
    • Community
    • Legal
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogo
On this page
  • Preferred Integration Order
  • Managed Execution Wrappers
  • Fallback: Explicit API Calls
  • Conditional Execution
  • Request Intercepts
  • Mark Events
  • Sample Third-Party Patch Integrations
  • Quickstart: Apply Maintained Patches
Integrate into Frameworks

Code Examples

||View as Markdown|
Previous

Provider Response Codecs

Next

About

Use these examples for implementation surfaces:

  • Adding Scopes
  • Wrap Tool Calls
  • Wrap LLM Calls
  • Non-Serializable Data
  • Using Codecs
  • Provider Codecs
  • Provider Response Codecs

Preferred Integration Order

Choose the highest option your framework boundary supports:

  1. Managed execution wrappers.
  2. Explicit start and end lifecycle calls.
  3. Standalone conditional-execution helpers.
  4. Standalone request-intercept helpers.
  5. Mark events for milestones that are not full tool or LLM calls.

Managed execution wrappers give NeMo Relay the most complete lifecycle: middleware order, parent-child scope relationships, request and response event payloads, execution intercepts, and subscriber visibility. Fallback helpers are useful when the framework owns the real callback internally.

Managed Execution Wrappers

Use managed wrappers when the framework exposes a stable callable boundary.

SurfacePythonNode.jsRust
Tool executenemo_relay.tools.execute(...)toolCallExecute(...)nemo_relay::api::tool::tool_call_execute
LLM executenemo_relay.llm.execute(...)llmCallExecute(...)nemo_relay::api::llm::llm_call_execute
LLM stream executenemo_relay.typed.llm_stream_execute(...)typedLlmStreamExecute(...)nemo_relay::api::llm::llm_stream_call_execute

Fallback: Explicit API Calls

Use explicit API calls when the framework has start and finish hooks but owns the invocation internally.

What you lose from managed execution wrappers:

  • Execution intercepts cannot wrap the real callback.
  • The framework must preserve the start handle and call the matching end helper.
  • Request intercepts and conditional execution must be invoked explicitly if you still need them.
  • Error paths need deliberate end-event or mark-event handling.
Python
Node.js
Rust
1import nemo_relay
2from nemo_relay import LLMRequest
3
4def framework_tool_started(name: str, args: dict):
5 return nemo_relay.tools.call(name, args)
6
7def framework_tool_finished(handle, result: dict) -> None:
8 nemo_relay.tools.call_end(handle, result)
9
10def framework_llm_started(provider: str, payload: dict):
11 request = LLMRequest({}, payload)
12 return nemo_relay.llm.call(provider, request, model_name=payload.get("model"))
13
14def framework_llm_finished(handle, response: dict) -> None:
15 nemo_relay.llm.call_end(handle, response)

Conditional Execution

Use conditional-execution helpers when the framework needs an allow-or-block decision before it continues down its own invocation path.

Python
Node.js
Rust
1import nemo_relay
2from nemo_relay import LLMRequest
3
4nemo_relay.tools.conditional_execution("search", {"query": "weather"})
5nemo_relay.llm.conditional_execution(LLMRequest({}, {"messages": []}))

Request Intercepts

Use request-intercept helpers when the framework wants NeMo Relay to rewrite arguments or provider requests before the framework invokes its own downstream code.

Python
Node.js
Rust
1import nemo_relay
2from nemo_relay import LLMRequest
3
4rewritten_args = nemo_relay.tools.request_intercepts("search", {"query": "weather"})
5rewritten_request = nemo_relay.llm.request_intercepts(
6 "demo-provider",
7 LLMRequest({}, {"messages": []}),
8)

Mark Events

Use mark events when the framework exposes important milestones but not a full lifecycle boundary.

Python
Node.js
Rust
1import nemo_relay
2
3nemo_relay.scope.event("scheduler.retry", data={"attempt": 2})

Sample Third-Party Patch Integrations

NeMo Relay keeps sample third-party integrations as patch sets under patches/ and pinned upstream checkouts under third_party/. For the current OpenClaw end-user integration, use the OpenClaw Plugin Guide.

The following table lists maintained patch checkouts:

IntegrationUpstream Checkout
Hermes Agentthird_party/hermes-agent
LangChainthird_party/langchain
LangChain NVIDIAthird_party/langchain-nvidia
LangGraphthird_party/langgraph
OpenClaw (legacy patch)third_party/openclaw
opencodethird_party/opencode

Quickstart: Apply Maintained Patches

From the repository root, use the wrapper scripts when you want the maintained NeMo Relay patches applied to the pinned third-party checkouts:

ScriptPurpose
./scripts/bootstrap-third-party.shClone pinned third-party upstream checkouts from third_party/sources.lock.
./scripts/apply-patches.shApply NeMo Relay integration patches to third-party checkouts.
./scripts/apply-patches.sh --checkEnsure the patches apply cleanly to all third-party checkouts.
./scripts/generate-patches.shRegenerate patch files from local third-party checkout changes.
./scripts/build-docs.shBuild the documentation site after integration docs change.

The dry run checks that patches apply cleanly before modifying the local checkouts. Use manual git clone, git checkout, and git apply commands only when you need to work on one integration outside the standard wrapper flow.