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
      • Python Library Reference
      • Node.js Library Reference
        • Runtime
        • Typed Helpers
        • Plugin Helpers
        • Adaptive Helpers
        • Observability Helpers
      • Rust Library Reference
    • 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
  • Interfaces
  • ConfigPolicy
  • ConfigDiagnostic
  • ConfigReport
  • ComponentSpec interface
  • PluginConfig
  • PluginContext
  • Plugin
  • Functions
  • defaultConfig
  • ComponentSpec function
  • validate
  • initialize
  • clear
  • report
  • listKinds
  • register
  • deregister
  • Type Aliases
  • UnsupportedBehavior
ReferenceAPIsNode.js Library Reference

Plugin Helpers

||View as Markdown|
Previous

Typed Helpers

Next

Adaptive Helpers

Generated from crates/node/plugin.d.ts.

Import from nemo-relay-node/plugin.

Plugin configuration, validation, activation, and registration helpers.

Interfaces

ConfigPolicy

Plugin-level policy for unknown or unsupported plugin configuration.

1export interface ConfigPolicy {
2 unknown_component?: UnsupportedBehavior;
3 unknown_field?: UnsupportedBehavior;
4 unsupported_value?: UnsupportedBehavior;
5}

ConfigDiagnostic

One validation or compatibility diagnostic produced by the plugin system.

1export interface ConfigDiagnostic {
2 level: 'warning' | 'error';
3 code: string;
4 component?: string;
5 field?: string;
6 message: string;
7}

ConfigReport

Validation or activation report for a plugin configuration.

1export interface ConfigReport {
2 diagnostics: ConfigDiagnostic[];
3}

ComponentSpec interface

One top-level plugin component.

1export interface ComponentSpec {
2 kind: string;
3 enabled?: boolean;
4 config?: Record<string, Json>;
5}

PluginConfig

Canonical plugin configuration document.

1export interface PluginConfig {
2 version?: number;
3 components?: Array<{
4 kind: string;
5 enabled?: boolean;
6 config?: Record<string, Json>;
7 }>;
8 policy?: ConfigPolicy;
9}

PluginContext

Component-scoped registration context passed to plugin handlers.

1export interface PluginContext {
2 /** Register an infallible event subscriber for this component. */
3 registerSubscriber(name: string, callback: (event: Json) => void): void;
4 /** Register a tool sanitize-request guardrail for this component. */
5 registerToolSanitizeRequestGuardrail(
6 name: string,
7 priority: number,
8 callback: (name: string, args: Json) => Json,
9 ): void;
10 /** Register a tool sanitize-response guardrail for this component. */
11 registerToolSanitizeResponseGuardrail(
12 name: string,
13 priority: number,
14 callback: (name: string, result: Json) => Json,
15 ): void;
16 /** Register a tool conditional-execution guardrail for this component. */
17 registerToolConditionalExecutionGuardrail(
18 name: string,
19 priority: number,
20 callback: (name: string, args: Json) => string | null,
21 ): void;
22 /** Register an LLM sanitize-request guardrail for this component. */
23 registerLlmSanitizeRequestGuardrail(name: string, priority: number, callback: (request: Json) => Json): void;
24 /** Register an LLM sanitize-response guardrail for this component. */
25 registerLlmSanitizeResponseGuardrail(name: string, priority: number, callback: (response: Json) => Json): void;
26 /** Register an LLM conditional-execution guardrail for this component. */
27 registerLlmConditionalExecutionGuardrail(
28 name: string,
29 priority: number,
30 callback: (request: Json) => string | null,
31 ): void;
32 /** Register an LLM request intercept for this component. */
33 registerLlmRequestIntercept(
34 name: string,
35 priority: number,
36 breakChain: boolean,
37 callback: (args: { name: string; request: Json; annotated: Json | null }) => {
38 request: Json;
39 annotated: Json | null;
40 },
41 ): void;
42 /** Register an LLM execution intercept for this component. */
43 registerLlmExecutionIntercept(
44 name: string,
45 priority: number,
46 callback: (request: Json, next: (request: Json) => Json | Promise<Json>) => Json | Promise<Json>,
47 ): void;
48 /** Register an LLM streaming execution intercept for this component. */
49 registerLlmStreamExecutionIntercept(
50 name: string,
51 priority: number,
52 callback: (
53 request: Json,
54 next: (request: Json) => AsyncIterable<Json> | Promise<AsyncIterable<Json>>,
55 ) => AsyncIterable<Json> | Promise<AsyncIterable<Json>>,
56 ): void;
57 /** Register a tool request intercept for this component. */
58 registerToolRequestIntercept(
59 name: string,
60 priority: number,
61 breakChain: boolean,
62 callback: (name: string, args: Json) => Json,
63 ): void;
64 /** Register a tool execution intercept for this component. */
65 registerToolExecutionIntercept(
66 name: string,
67 priority: number,
68 callback: (args: Json, next: (args: Json) => Json | Promise<Json>) => Json | Promise<Json>,
69 ): void;
70}

Plugin

Plugin callback contract.

1export interface Plugin {
2 /** Validate one component-local config object. */
3 validate?(pluginConfig: Record<string, Json>): ConfigDiagnostic[] | null | undefined;
4 /**
5 * Install middleware and subscribers for one component instance.
6 *
7 * Throwing aborts the current initialization and triggers rollback.
8 */
9 register(pluginConfig: Record<string, Json>, context: PluginContext): void;
10}

Functions

defaultConfig

Create an empty plugin configuration.

Returns the canonical top-level config shape with version = 1 and no configured components so callers can build a document incrementally before validating or activating it.

Returns

A new PluginConfig object ready for mutation or validation.

Remarks

Mutating the returned object does not affect runtime state until it is passed to initialize.

1export declare function defaultConfig(): PluginConfig;

ComponentSpec function

Create a plugin component entry for a plugin config document.

Packages a plugin kind, component-local config, and enablement flag into the object shape expected by PluginConfig.components.

Parameters

  • kind: Registered plugin kind to reference.
  • config: Component-local config passed to plugin hooks.
  • options: Optional component-level flags.

Returns

A ComponentSpec ready to insert into a plugin config.

Remarks

Setting options.enabled = false preserves the component for validation while skipping runtime registration during initialize.

1export declare function ComponentSpec(
2 kind: string,
3 config?: Record<string, Json>,
4 options?: {
5 enabled?: boolean;

validate

Validate a plugin configuration without activating it.

Runs the same config validation pipeline used by initialization while leaving the active plugin registry and runtime configuration unchanged.

Parameters

  • config: Candidate plugin configuration document.

Returns

A structured validation report with diagnostics.

Remarks

Use this to surface warnings or incompatibilities before replacing the active plugin configuration.

1export declare function validate(config: PluginConfig): ConfigReport;

initialize

Validate and activate a plugin configuration.

Replaces the current active config, invokes each enabled component’s registration hooks, and resolves with the final activation report.

Parameters

  • config: Plugin configuration document to activate.

Returns

A promise resolving to the activation report.

Remarks

Partial plugin registration is rolled back if activation fails, and the promise rejects with the underlying validation or setup error.

1export declare function initialize(config: PluginConfig): Promise<ConfigReport>;

clear

Clear the active plugin configuration.

Removes the currently active component registrations while leaving plugin kinds in the registry so they can be reused by a later initialization call.

Returns

Nothing.

Remarks

Registered plugin kinds remain available after the active config is cleared.

1export declare function clear(): void;

report

Return the last successfully activated plugin report.

Exposes the most recent activation report emitted by the native plugin system without triggering validation or registration work.

Returns

The last activation report, if one exists.

Remarks

This returns null until initialize succeeds at least once in the current process.

1export declare function report(): ConfigReport | null;

listKinds

List registered plugin kinds.

Returns the plugin kind identifiers currently known to the global registry so callers can inspect what can be referenced from plugin configs.

Returns

The registered plugin kind names.

Remarks

The list reflects registry state only; it does not indicate whether a plugin kind is currently active in the runtime configuration.

1export declare function listKinds(): string[];

register

Register a plugin kind with JavaScript validation and registration hooks.

Adapts the higher-level Plugin object contract to the native callback shape expected by the Node binding.

Parameters

  • pluginKind: Unique plugin kind identifier to register.
  • plugin: Plugin implementation with validate and register hooks.

Returns

Nothing.

Remarks

Omitting plugin.validate makes the plugin permissive during validation; plugin.register still runs later during initialize.

1export declare function register(pluginKind: string, plugin: Plugin): void;

deregister

Remove a previously registered plugin kind.

Deletes the plugin kind from the registry so future config validation and initialization calls can no longer reference it.

Parameters

  • pluginKind: Registered plugin kind identifier to remove.

Returns

true when a plugin kind was removed, otherwise false.

Remarks

Active runtime registrations remain until clear() or the next successful initialize(...).

1export declare function deregister(pluginKind: string): boolean;

Type Aliases

UnsupportedBehavior

Policy behavior for unsupported configuration.

1export type UnsupportedBehavior = 'ignore' | 'warn' | 'error';