plugin-inference-middleware

Implement custom inference middleware for the NeMo Platform Inference Gateway.

58|16|Updated May 14, 2026
One-click install
npx skills add https://github.com/NVIDIA-NeMo/nemo-platform --skill plugin-inference-middleware
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: plugin-inference-middleware
Source: https://github.com/NVIDIA-NeMo/nemo-platform/tree/main/packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-inference-middleware
Command: npx skills add https://github.com/NVIDIA-NeMo/nemo-platform --skill plugin-inference-middleware

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pydantic.

What problem does it solve?

This Skill provides the framework for implementing custom inference middleware, allowing developers to intercept, mutate, and validate request and response traffic within the NeMo Inference Gateway (IGW) for advanced model routing, PII redaction, or custom guardrails.

Core Features & Use Cases

  • Request/Response Interception: Implement process_request and process_response hooks to modify payloads or short-circuit inference with immediate responses.
  • Configurable Middleware: Support for both inline configurations and externalized config entities with CRUD API support for versioned, shared middleware logic.
  • Use Case: A developer can build a middleware plugin that inspects incoming chat requests for PII, redacts sensitive information before it reaches the model, and appends custom guardrail metadata to the final response.

Quick Start

Use the plugin-inference-middleware skill to register a new custom middleware class in the nemo.inference_middleware entry point of your project.

Frequently Asked Questions about plugin-inference-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build custom inference middleware to intercept API requests in the NeMo Inference Gateway?

To build custom inference middleware, you implement the NemoInferenceMiddleware base class to intercept and transform request and response traffic. This allows you to modify payloads, apply custom guardrails, and manage advanced model routing within the NeMo Platform.

Can I redact PII from chat payloads before they reach the model using inference middleware?

Yes, you can redact PII from chat payloads by implementing the process_request hook in your custom middleware. This intercepts incoming traffic, mutates the request payload to strip sensitive information, and forwards the sanitized data to the model.

How do I configure and version shared inference middleware logic for an API gateway?

You can configure inference middleware using inline configurations or externalized config entities managed through a CRUD API. This externalized approach supports versioned middleware logic, enabling shared configuration management across the NeMo Platform entity store.

Does NeMo inference middleware support short-circuiting a request with an immediate response?

Yes, NeMo inference middleware supports short-circuiting requests with immediate responses. By implementing the process_request and process_response lifecycle hooks, you can intercept traffic, validate payloads, and return custom responses without executing the standard model inference.

Do I need pydantic to implement custom middleware for the NeMo Platform?

Yes, pydantic is a required dependency for implementing custom inference middleware on the NeMo Platform. It provides the data validation and settings management needed to support standardized lifecycle hooks and payload mutation within the Inference Gateway.

How do I append custom guardrail metadata to an API response using inference middleware?

You append custom guardrail metadata by implementing the process_response hook in your middleware class. This hook intercepts the model's outgoing response traffic, allowing you to mutate the payload and inject additional guardrail metadata before it returns to the client.