About Build Plugins
A plugin gives reusable runtime behavior a name and configuration. It can observe events, remove sensitive data, reject requests, or change tool and model calls. One plugin can combine these tasks when the same configuration controls them.
The smallest useful plugin has four visible stages:
- Define the implementation.
- Register its stable kind.
- Activate one configured component.
- Clear the behavior owned by that component.
The complete language-binding quickstart shows
this application-owned example in Python, Node.js, and Rust. In every version, the tool
request intercept adds plugin_tag to the real tool arguments, so the final assertion
proves that activation changed execution rather than only producing a successful report.
The implementation object is not middleware by itself. Relay calls register only for
an enabled, valid component and owns every callback installed through the supplied
context. That ownership lets cleanup remove the intercept before the kind is
deregistered.
The first design decision is where the plugin should run. That choice determines how quickly callbacks execute, what must be packaged, which failures can affect the host, and how much control the application keeps over dependencies.
Choose the Execution Model
Compare these models before choosing where your plugin runs:
Language-binding plugins are appropriate for application-owned behavior such as adding a tenant header, enforcing a local model policy, or installing an event subscriber beside the code that consumes it. They have the simplest build and distribution path, so start with Language Binding Plugins unless a separate artifact solves a concrete operational problem.
Native Rust plugins suit reusable middleware whose callback latency or throughput is
important enough to justify platform-specific binaries and full in-process trust. A
native plugin declares compat.native_api = "v1.0" and uses the checked bootstrap.
The native contract has its own version, separate from Relay releases. A host
supports plugins built for the same native major and a supported minor version.
Refer to the Native ABI Reference.
Worker plugins suit dependencies that should live outside the application environment,
teams that need a different runtime, or deployments that want a separate crash boundary.
That separation comes with gRPC, protobuf, and scheduling overhead. The Python and
Rust SDKs implement the same nvidia.nemo.relay.worker.v1 contract. A custom
command worker implements this protocol itself.
A managed tool callback and its continuation return ToolExecutionResult. This
value contains the application payload in result and an optional opaque
annotation. A tool execution intercept also returns Relay-owned pending marks.
Worker manifests declare
compat.worker_protocol = "nvidia.nemo.relay.worker.v1". The worker SDK uses
compat.relay = ">=1.0.0,<2.0" to declare its supported Relay releases.
Codec access belongs to that execution callback. For a non-streaming call, it expires when the callback finishes. For a streaming call, request codec access remains valid until the returned stream completes or closes. Retaining a codec object does not extend either lifetime.
Match Behavior to a Plugin
Use these examples to choose a model:
Whichever model you choose, the shared contract comes first. Plugin Shape explains lifecycle and ownership, Configuration and Validation defines the operator-facing boundary, and PluginContext describes every registration surface. Each model-specific section then follows a path through configuration checks, activation, example calls, result checks, and cleanup.
Plugins can also own gates that control whether another global runtime registration is included in future snapshots. Read Conditional Middleware Guardrails before adding this operational control to any delivery model.