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
      • Rust Library Reference
        • nemo-relay
        • nemo-relay-adaptive
        • nemo-relay-ffi
          • api
            • FfiStream
            • nemo_relay_active_plugin_report_json
            • nemo_relay_anthropic_messages_codec_new
            • nemo_relay_atif_exporter_clear
            • nemo_relay_atif_exporter_create
            • nemo_relay_atif_exporter_deregister
            • nemo_relay_atif_exporter_export
            • nemo_relay_atif_exporter_register
            • nemo_relay_atof_exporter_create
            • nemo_relay_atof_exporter_create_from_json
            • nemo_relay_atof_exporter_deregister
            • nemo_relay_atof_exporter_force_flush
            • nemo_relay_atof_exporter_path
            • nemo_relay_atof_exporter_register
            • nemo_relay_atof_exporter_shutdown
            • nemo_relay_clear_plugin_configuration
            • nemo_relay_deregister_llm_conditional_execution_guardrail
            • nemo_relay_deregister_llm_execution_intercept
            • nemo_relay_deregister_llm_request_intercept
            • nemo_relay_deregister_llm_sanitize_request_guardrail
            • nemo_relay_deregister_llm_sanitize_response_guardrail
            • nemo_relay_deregister_llm_stream_execution_intercept
            • nemo_relay_deregister_plugin
            • nemo_relay_deregister_subscriber
            • nemo_relay_deregister_tool_conditional_execution_guardrail
            • nemo_relay_deregister_tool_execution_intercept
            • nemo_relay_deregister_tool_request_intercept
            • nemo_relay_deregister_tool_sanitize_request_guardrail
            • nemo_relay_deregister_tool_sanitize_response_guardrail
            • nemo_relay_event
            • nemo_relay_flush_subscribers
            • nemo_relay_get_handle
            • nemo_relay_initialize_plugins
            • nemo_relay_list_plugin_kinds_json
            • nemo_relay_llm_call
            • nemo_relay_llm_call_end
            • nemo_relay_llm_call_execute
            • nemo_relay_llm_conditional_execution
            • nemo_relay_llm_request_intercepts
            • nemo_relay_llm_stream_call_execute
            • nemo_relay_observability_component_spec_json
            • nemo_relay_observability_default_config_json
            • nemo_relay_observability_plugin_kind
            • nemo_relay_openai_chat_codec_new
            • nemo_relay_openai_responses_codec_new
            • nemo_relay_openinference_subscriber_create
            • nemo_relay_openinference_subscriber_deregister
            • nemo_relay_openinference_subscriber_force_flush
            • nemo_relay_openinference_subscriber_register
            • nemo_relay_openinference_subscriber_shutdown
            • nemo_relay_otel_subscriber_create
            • nemo_relay_otel_subscriber_deregister
            • nemo_relay_otel_subscriber_force_flush
            • nemo_relay_otel_subscriber_register
            • nemo_relay_otel_subscriber_shutdown
            • nemo_relay_plugin_context_register_llm_conditional_execution_guardrail
            • nemo_relay_plugin_context_register_llm_execution_intercept
            • nemo_relay_plugin_context_register_llm_request_intercept
            • nemo_relay_plugin_context_register_llm_sanitize_request_guardrail
            • nemo_relay_plugin_context_register_llm_sanitize_response_guardrail
            • nemo_relay_plugin_context_register_llm_stream_execution_intercept
            • nemo_relay_plugin_context_register_subscriber
            • nemo_relay_plugin_context_register_tool_conditional_execution_guardrail
            • nemo_relay_plugin_context_register_tool_execution_intercept
            • nemo_relay_plugin_context_register_tool_request_intercept
            • nemo_relay_plugin_context_register_tool_sanitize_request_guardrail
            • nemo_relay_plugin_context_register_tool_sanitize_response_guardrail
            • nemo_relay_pop_scope
            • nemo_relay_push_scope
            • nemo_relay_register_llm_conditional_execution_guardrail
            • nemo_relay_register_llm_execution_intercept
            • nemo_relay_register_llm_request_intercept
            • nemo_relay_register_llm_sanitize_request_guardrail
            • nemo_relay_register_llm_sanitize_response_guardrail
            • nemo_relay_register_llm_stream_execution_intercept
            • nemo_relay_register_plugin
            • nemo_relay_register_subscriber
            • nemo_relay_register_tool_conditional_execution_guardrail
            • nemo_relay_register_tool_execution_intercept
            • nemo_relay_register_tool_request_intercept
            • nemo_relay_register_tool_sanitize_request_guardrail
            • nemo_relay_register_tool_sanitize_response_guardrail
            • nemo_relay_scope_deregister_llm_conditional_execution_guardrail
            • nemo_relay_scope_deregister_llm_execution_intercept
            • nemo_relay_scope_deregister_llm_request_intercept
            • nemo_relay_scope_deregister_llm_sanitize_request_guardrail
            • nemo_relay_scope_deregister_llm_sanitize_response_guardrail
            • nemo_relay_scope_deregister_llm_stream_execution_intercept
            • nemo_relay_scope_deregister_subscriber
            • nemo_relay_scope_deregister_tool_conditional_execution_guardrail
            • nemo_relay_scope_deregister_tool_execution_intercept
            • nemo_relay_scope_deregister_tool_request_intercept
            • nemo_relay_scope_deregister_tool_sanitize_request_guardrail
            • nemo_relay_scope_deregister_tool_sanitize_response_guardrail
            • nemo_relay_scope_register_llm_conditional_execution_guardrail
            • nemo_relay_scope_register_llm_execution_intercept
            • nemo_relay_scope_register_llm_request_intercept
            • nemo_relay_scope_register_llm_sanitize_request_guardrail
            • nemo_relay_scope_register_llm_sanitize_response_guardrail
            • nemo_relay_scope_register_llm_stream_execution_intercept
            • nemo_relay_scope_register_subscriber
            • nemo_relay_scope_register_tool_conditional_execution_guardrail
            • nemo_relay_scope_register_tool_execution_intercept
            • nemo_relay_scope_register_tool_request_intercept
            • nemo_relay_scope_register_tool_sanitize_request_guardrail
            • nemo_relay_scope_register_tool_sanitize_response_guardrail
            • nemo_relay_scope_stack_active
            • nemo_relay_scope_stack_capture_thread
            • nemo_relay_scope_stack_create
            • nemo_relay_scope_stack_restore_thread
            • nemo_relay_scope_stack_set_thread
            • nemo_relay_stream_free
            • nemo_relay_stream_next
            • nemo_relay_tool_call
            • nemo_relay_tool_call_end
            • nemo_relay_tool_call_execute
            • nemo_relay_tool_conditional_execution
            • nemo_relay_tool_request_intercepts
            • nemo_relay_validate_plugin_config
          • callable
          • convert
          • error
          • types
    • 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
  • Re-exports
  • Structs
  • Functions
ReferenceAPIsRust Library Referencenemo-relay-ffi

Module api

||View as Markdown|
Previous

nemo-relay-ffi

Next

Struct FfiStream

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

Top-level FFI API functions exported as extern "C".

Each function clears the thread-local error before executing and returns an NemoRelayStatus. On failure, call [nemo_relay_last_error] to retrieve the error message.

Re-exports

  • pub use crate::types::nemo_relay_openinference_subscriber_free;
  • pub use crate::types::nemo_relay_otel_subscriber_free;

Structs

  • FfiStream: Opaque stream handle for consuming LLM streaming responses chunk by chunk. Use nemo_relay_stream_next to poll and nemo_relay_stream_free to release.

Functions

  • nemo_relay_active_plugin_report_json: Return the last successfully configured plugin report as JSON.
  • nemo_relay_anthropic_messages_codec_new: Create a new Anthropic Messages API codec handle.
  • nemo_relay_atif_exporter_clear: Clears all collected events from the exporter.
  • nemo_relay_atif_exporter_create: Creates a new ATIF exporter.
  • nemo_relay_atif_exporter_deregister: Deregisters the exporter subscriber.
  • nemo_relay_atif_exporter_export: Exports collected events as an ATIF trajectory JSON string.
  • nemo_relay_atif_exporter_register: Registers the exporter as an event subscriber.
  • nemo_relay_atof_exporter_create: Creates a new filesystem-backed ATOF JSONL exporter.
  • nemo_relay_atof_exporter_create_from_json: Creates a new ATOF exporter from a JSON config object.
  • nemo_relay_atof_exporter_deregister: Deregisters the ATOF exporter subscriber.
  • nemo_relay_atof_exporter_force_flush: Flushes the ATOF exporter output file.
  • nemo_relay_atof_exporter_path: Returns the ATOF exporter output path as a string.
  • nemo_relay_atof_exporter_register: Registers the ATOF exporter as an event subscriber.
  • nemo_relay_atof_exporter_shutdown: Shuts down the ATOF exporter by flushing output.
  • nemo_relay_clear_plugin_configuration: Clear the active global plugin configuration.
  • nemo_relay_deregister_llm_conditional_execution_guardrail: Deregister an LLM conditional execution guardrail by name.
  • nemo_relay_deregister_llm_execution_intercept: Deregister an LLM execution intercept by name.
  • nemo_relay_deregister_llm_request_intercept: Deregister an LLM request intercept by name.
  • nemo_relay_deregister_llm_sanitize_request_guardrail: Deregister an LLM request sanitization guardrail by name.
  • nemo_relay_deregister_llm_sanitize_response_guardrail: Deregister an LLM response sanitization guardrail by name.
  • nemo_relay_deregister_llm_stream_execution_intercept: Deregister an LLM streaming execution intercept by name.
  • nemo_relay_deregister_plugin: Deregister a plugin by kind.
  • nemo_relay_deregister_subscriber: Deregister an event subscriber by name.
  • nemo_relay_deregister_tool_conditional_execution_guardrail: Deregister a tool conditional execution guardrail by name.
  • nemo_relay_deregister_tool_execution_intercept: Deregister a tool execution intercept by name.
  • nemo_relay_deregister_tool_request_intercept: Deregister a tool request intercept by name.
  • nemo_relay_deregister_tool_sanitize_request_guardrail: Deregister a tool request sanitization guardrail by name.
  • nemo_relay_deregister_tool_sanitize_response_guardrail: Deregister a tool response sanitization guardrail by name.
  • nemo_relay_event: Emit a named lifecycle event.
  • nemo_relay_flush_subscribers: Wait for subscriber callbacks queued before this call to finish.
  • nemo_relay_get_handle: Retrieve the current scope handle from the thread-local scope stack.
  • nemo_relay_initialize_plugins: Initialize the active global plugin components and return the resulting diagnostics report.
  • nemo_relay_list_plugin_kinds_json: Return the registered plugin kinds as JSON.
  • nemo_relay_llm_call: Begin a manual LLM call lifecycle span.
  • nemo_relay_llm_call_end: End a manual LLM call lifecycle span.
  • nemo_relay_llm_call_execute: Execute an LLM call end-to-end: run conditional-execution guardrails (on raw request), then request intercepts, sanitize-request guardrails, execution intercepts, the callback, and sanitize-response guardrails. On rejection, only a standalone Mark event is emitted (no Start/End pair) and GuardrailRejected is returned. Blocks the calling thread until completion.
  • nemo_relay_llm_conditional_execution: Run the registered LLM conditional execution guardrail chain.
  • nemo_relay_llm_request_intercepts: Run the registered LLM request intercept chain on the given request.
  • nemo_relay_llm_stream_call_execute: Execute a streaming LLM call end-to-end. Conditional-execution guardrails run first on the raw request. Returns a stream handle that can be polled with nemo_relay_stream_next. Blocks until the stream is set up.
  • nemo_relay_observability_component_spec_json: Wrap an observability config JSON object as a top-level plugin component.
  • nemo_relay_observability_default_config_json: Return the default observability plugin config as JSON.
  • nemo_relay_observability_plugin_kind: Return the built-in observability plugin kind.
  • nemo_relay_openai_chat_codec_new: Create a new OpenAI Chat Completions codec handle.
  • nemo_relay_openai_responses_codec_new: Create a new OpenAI Responses API codec handle.
  • nemo_relay_openinference_subscriber_create: Creates a new OpenInference subscriber.
  • nemo_relay_openinference_subscriber_deregister: Deregisters the OpenInference subscriber by name.
  • nemo_relay_openinference_subscriber_force_flush: Forces a flush of finished spans through the exporter.
  • nemo_relay_openinference_subscriber_register: Registers the OpenInference subscriber as an event subscriber.
  • nemo_relay_openinference_subscriber_shutdown: Shuts down the underlying tracer provider.
  • nemo_relay_otel_subscriber_create: Creates a new OpenTelemetry subscriber.
  • nemo_relay_otel_subscriber_deregister: Deregisters the OpenTelemetry subscriber by name.
  • nemo_relay_otel_subscriber_force_flush: Forces a flush of finished spans through the exporter.
  • nemo_relay_otel_subscriber_register: Registers the OpenTelemetry subscriber as an event subscriber.
  • nemo_relay_otel_subscriber_shutdown: Shuts down the underlying tracer provider.
  • nemo_relay_plugin_context_register_llm_conditional_execution_guardrail: Register an LLM conditional-execution guardrail into the plugin registration context.
  • nemo_relay_plugin_context_register_llm_execution_intercept: Register an LLM execution intercept into the plugin registration context.
  • nemo_relay_plugin_context_register_llm_request_intercept: Register an LLM request intercept into the plugin registration context.
  • nemo_relay_plugin_context_register_llm_sanitize_request_guardrail: Register an LLM sanitize-request guardrail into the plugin registration context.
  • nemo_relay_plugin_context_register_llm_sanitize_response_guardrail: Register an LLM sanitize-response guardrail into the plugin registration context.
  • nemo_relay_plugin_context_register_llm_stream_execution_intercept: Register an LLM stream execution intercept into the plugin registration context.
  • nemo_relay_plugin_context_register_subscriber: Register an event subscriber into the plugin registration context.
  • nemo_relay_plugin_context_register_tool_conditional_execution_guardrail: Register a tool conditional-execution guardrail into the plugin registration context.
  • nemo_relay_plugin_context_register_tool_execution_intercept: Register a tool execution intercept into the plugin registration context.
  • nemo_relay_plugin_context_register_tool_request_intercept: Register a tool request intercept into the plugin registration context.
  • nemo_relay_plugin_context_register_tool_sanitize_request_guardrail: Register a tool sanitize-request guardrail into the plugin registration context.
  • nemo_relay_plugin_context_register_tool_sanitize_response_guardrail: Register a tool sanitize-response guardrail into the plugin registration context.
  • nemo_relay_pop_scope: Pop a scope from the scope stack by its handle.
  • nemo_relay_push_scope: Push a new scope onto the scope stack.
  • nemo_relay_register_llm_conditional_execution_guardrail: Register an LLM conditional execution guardrail. The callback decides whether an LLM call should proceed.
  • nemo_relay_register_llm_execution_intercept: Register an LLM execution intercept following the middleware chain pattern. The callback receives (request, next_fn, next_ctx) - call next_fn(request, next_ctx) to invoke the next intercept or the original LLM call, or skip calling it to short-circuit.
  • nemo_relay_register_llm_request_intercept: Register an LLM request intercept. The callback can transform the LlmRequest before it reaches the LLM provider.
  • nemo_relay_register_llm_sanitize_request_guardrail: Register an LLM request sanitization guardrail. The callback can modify or replace the LLM request before it is sent.
  • nemo_relay_register_llm_sanitize_response_guardrail: Register an LLM response sanitization guardrail. The callback can inspect and modify the LLM response after it is received.
  • nemo_relay_register_llm_stream_execution_intercept: Register an LLM streaming execution intercept following the middleware chain pattern. The callback receives (request, next_fn, next_ctx) - call next_fn(request, next_ctx) to invoke the next intercept or the original streaming LLM call, or skip calling it to short-circuit.
  • nemo_relay_register_plugin: Register a plugin backed by foreign callbacks.
  • nemo_relay_register_subscriber: Register an event subscriber. The callback is invoked for every lifecycle event emitted by the runtime.
  • nemo_relay_register_tool_conditional_execution_guardrail: Register a tool conditional execution guardrail. The callback decides whether a tool call should proceed. Returns an error message to reject, or null to allow.
  • nemo_relay_register_tool_execution_intercept: Register a tool execution intercept following the middleware chain pattern. The callback receives (args, next_fn, next_ctx) - call next_fn(args, next_ctx) to invoke the next intercept or the original tool function, or skip calling it to short-circuit.
  • nemo_relay_register_tool_request_intercept: Register a tool request intercept. The callback can transform tool arguments before execution. Runs after request guardrails in the middleware pipeline.
  • nemo_relay_register_tool_sanitize_request_guardrail: Register a tool request sanitization guardrail. The callback can inspect and modify tool arguments before the tool executes.
  • nemo_relay_register_tool_sanitize_response_guardrail: Register a tool response sanitization guardrail. The callback can inspect and modify tool results after the tool executes.
  • nemo_relay_scope_deregister_llm_conditional_execution_guardrail: Deregister a scope-local LLM conditional execution guardrail by name.
  • nemo_relay_scope_deregister_llm_execution_intercept: Deregister a scope-local LLM execution intercept by name.
  • nemo_relay_scope_deregister_llm_request_intercept: Deregister a scope-local LLM request intercept by name.
  • nemo_relay_scope_deregister_llm_sanitize_request_guardrail: Deregister a scope-local LLM request sanitization guardrail by name.
  • nemo_relay_scope_deregister_llm_sanitize_response_guardrail: Deregister a scope-local LLM response sanitization guardrail by name.
  • nemo_relay_scope_deregister_llm_stream_execution_intercept: Deregister a scope-local LLM streaming execution intercept by name.
  • nemo_relay_scope_deregister_subscriber: Deregister a scope-local event subscriber by name.
  • nemo_relay_scope_deregister_tool_conditional_execution_guardrail: Deregister a scope-local tool conditional execution guardrail by name.
  • nemo_relay_scope_deregister_tool_execution_intercept: Deregister a scope-local tool execution intercept by name.
  • nemo_relay_scope_deregister_tool_request_intercept: Deregister a scope-local tool request intercept by name.
  • nemo_relay_scope_deregister_tool_sanitize_request_guardrail: Deregister a scope-local tool request sanitization guardrail by name.
  • nemo_relay_scope_deregister_tool_sanitize_response_guardrail: Deregister a scope-local tool response sanitization guardrail by name.
  • nemo_relay_scope_register_llm_conditional_execution_guardrail: Register a scope-local LLM conditional execution guardrail.
  • nemo_relay_scope_register_llm_execution_intercept: Register a scope-local LLM execution intercept following the middleware chain pattern.
  • nemo_relay_scope_register_llm_request_intercept: Register a scope-local LLM request intercept.
  • nemo_relay_scope_register_llm_sanitize_request_guardrail: Register a scope-local LLM request sanitization guardrail.
  • nemo_relay_scope_register_llm_sanitize_response_guardrail: Register a scope-local LLM response sanitization guardrail.
  • nemo_relay_scope_register_llm_stream_execution_intercept: Register a scope-local LLM streaming execution intercept following the middleware chain pattern.
  • nemo_relay_scope_register_subscriber: Register a scope-local event subscriber.
  • nemo_relay_scope_register_tool_conditional_execution_guardrail: Register a scope-local tool conditional execution guardrail.
  • nemo_relay_scope_register_tool_execution_intercept: Register a scope-local tool execution intercept following the middleware chain pattern.
  • nemo_relay_scope_register_tool_request_intercept: Register a scope-local tool request intercept.
  • nemo_relay_scope_register_tool_sanitize_request_guardrail: Register a scope-local tool request sanitization guardrail.
  • nemo_relay_scope_register_tool_sanitize_response_guardrail: Register a scope-local tool response sanitization guardrail.
  • nemo_relay_scope_stack_active: Returns whether the current execution context has an explicitly-initialized scope stack.
  • nemo_relay_scope_stack_capture_thread: Capture the current thread-local scope stack binding.
  • nemo_relay_scope_stack_create: Create a new isolated scope stack with its own root scope.
  • nemo_relay_scope_stack_restore_thread: Restore and free a captured thread-local scope stack binding.
  • nemo_relay_scope_stack_set_thread: Bind an isolated scope stack to the current OS thread.
  • nemo_relay_stream_free: Free a stream handle and release its resources.
  • nemo_relay_stream_next: Poll the next chunk from a streaming LLM response. Blocks until a chunk is available.
  • nemo_relay_tool_call: Begin a manual tool call lifecycle span.
  • nemo_relay_tool_call_end: End a manual tool call lifecycle span.
  • nemo_relay_tool_call_execute: Execute a tool call end-to-end: run conditional-execution guardrails (on raw args), then request intercepts, sanitize-request guardrails, execution intercepts, the callback, and sanitize-response guardrails. On rejection, only a standalone Mark event is emitted (no Start/End pair) and GuardrailRejected is returned. Blocks the calling thread until completion.
  • nemo_relay_tool_conditional_execution: Run the registered tool conditional execution guardrail chain.
  • nemo_relay_tool_request_intercepts: Run the registered tool request intercept chain on the given arguments.
  • nemo_relay_validate_plugin_config: Validate a generic plugin config document and return the diagnostics report as JSON.