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
      • Scopes
      • Middleware
      • Plugins
      • Events
      • Subscribers
      • Framework Integrations
    • 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
  • What Subscribers Are
  • How Subscribers Relate to Events
  • Registration Levels
  • Global Subscribers
  • Scope-Local Subscribers
  • Plugin-Installed Subscribers
  • What Subscribers Consume
  • Common Subscriber Roles
  • In-Process Observation
  • Host Integration Event JSON
  • Waiting for Delivery
  • Forwarding and Export
  • Analytics and Diagnostics
  • Built-In Subscriber Examples
  • Custom Subscribers
  • Agent Trajectory Interchange Format (ATIF) Exporter
  • Agent Trajectory Observability Format (ATOF) JSONL Exporter
  • OpenTelemetry Subscriber
  • OpenInference Subscriber
  • Practical Guidance
About NVIDIA NeMo RelayConcepts

Subscribers

||View as Markdown|
Previous

Events

Next

Framework Integrations

This page explains how subscribers consume lifecycle events without changing runtime execution.

What Subscribers Are

Subscribers are consumers of the NeMo Relay event stream. They receive emitted lifecycle events and use them for observation, forwarding, export, or analysis. On native Rust, Python, Node.js, and FFI surfaces, event-producing calls enqueue subscriber delivery on a process-wide background dispatcher and return without waiting for subscriber callbacks or exporter work.

How Subscribers Relate to Events

Events describe what happened. Subscribers are the components that watch those events.

That separation matters:

  • The runtime can emit one canonical event stream
  • Native event calls stay non-blocking for subscriber work
  • Many subscribers can consume that same stream
  • Observability behavior stays downstream from execution semantics

Registration Levels

Middleware and subscribers can be registered at different levels depending on their lifetime and visibility.

Global Subscribers

Global subscribers remain active process-wide until they are removed.

Scope-Local Subscribers

Scope-local subscribers are owned by one active scope and disappear when that scope closes.

Deregistering a subscriber affects future emissions. Events that were already emitted carry a subscriber snapshot, so queued callbacks from that snapshot may still run after deregistration.

Plugin-Installed Subscribers

Plugins can install subscribers as reusable, configuration-driven runtime components.

What Subscribers Consume

Subscribers consume the canonical event stream. They do not define the event model. They react to it.

This lets plain subscribers, exporters, and tracing adapters share one runtime source of truth.

Common Subscriber Roles

Subscribers are commonly used for in-process observation, counters, debugging, and exporter handoff.

In-Process Observation

Some subscribers stay inside the process and power custom logging, analytics, or debugging logic.

Host Integration Event JSON

For host integrations that need a serialized event payload, use the event object’s canonical JSON helpers instead of reconstructing payloads from native attributes. Python subscribers can call event.to_dict() or event.to_json() from the callback while still using the normal subscriber registration API.

This pattern is useful when an agent runtime, framework adapter, or plugin host already has its own lifecycle hooks but wants NeMo Relay to be the shared telemetry representation. The host integration maps those hooks into NeMo Relay scopes, LLM calls, tool calls, or marks. NeMo Relay emits the canonical ATOF event stream, and each subscriber chooses whether to consume the native event object, the canonical JSON helper, or an exporter-specific translation.

The important boundary is that subscribers do not define the event schema. They receive the runtime event and may serialize it through the binding helper when they need a stable JSON payload. Exporter subscribers, such as the ATOF JSONL exporter, consume the same event stream and serialize the same canonical event shape for their target backend.

Native subscribers are invoked by one process-wide worker thread in FIFO event order and subscriber snapshot order. WebAssembly keeps its current synchronous delivery behavior because this ticket does not add thread-based dispatch there.

Waiting for Delivery

Use the flush API when application shutdown, tests, or examples must observe side effects from subscriber callbacks that have already been queued:

  • Rust: nemo_relay::api::subscriber::flush_subscribers()?
  • Python: nemo_relay.subscribers.flush()
  • Node.js: flushSubscribers(), then await an event-loop tick for JavaScript callback side effects
  • FFI: nemo_relay_flush_subscribers()
  • WebAssembly: flushSubscribers() succeeds as a no-op

Forwarding and Export

Some subscribers translate the event stream into external formats or transport it to another system.

Analytics and Diagnostics

Some subscribers derive measurements, trajectories, or diagnostics from the event stream without affecting execution behavior.

Built-In Subscriber Examples

These examples show how built-in subscriber patterns relate to custom subscribers and exporters.

Custom Subscribers

A plain custom subscriber is the right choice when you want in-process handling of the canonical event stream.

Agent Trajectory Interchange Format (ATIF) Exporter

The Agent Trajectory Interchange Format (ATIF) exporter collects lifecycle events and emits trajectory artifacts for offline analysis, replay, or debugging.

Agent Trajectory Observability Format (ATOF) JSONL Exporter

The Agent Trajectory Observability Format (ATOF) JSONL exporter writes the canonical event stream to a native filesystem path as one raw ATOF event per line.

OpenTelemetry Subscriber

The OpenTelemetry subscriber maps runtime events into OTLP traces for tracing backends.

OpenInference Subscriber

The OpenInference subscriber maps runtime events into OTLP traces using OpenInference semantics for model-centric observability.

Detailed setup, configuration, and API shape for these subscribers belongs in Observability. For configuration-driven setup, use the built-in observability plugin to install ATOF, ATIF, OpenTelemetry, and OpenInference subscribers from one plugin component.

Practical Guidance

Use these practices when applying the concept in application or integration code.

  • Use a plain subscriber when you want in-process custom behavior.
  • Flush subscribers before asserting on printed output, captured lists, or files written by subscriber callbacks.
  • Use event.to_dict() or event.to_json() when a host runtime or exporter needs the canonical event JSON shape in-process.
  • Use a scope-local subscriber when the observation should disappear with the owning scope.
  • Use a plugin-installed subscriber when the behavior should be reusable and config-driven.
  • Use an exporter-oriented subscriber when the event stream should leave the process.