Register Plugin Behavior
Use this guide when plugin config validation is in place and you need the plugin to install real NeMo Relay runtime behavior.
What You Build
You will register a plugin kind, initialize a validated config, install subscribers or middleware through PluginContext, and clear active plugin configuration during teardown.
Use PluginContext
PluginContext is the component-scoped registration surface passed to the plugin during initialization. Register subscribers, guardrails, and intercepts through this context rather than through global registration calls inside application startup.
That gives the plugin system three important guarantees:
- Runtime names can be qualified for the component instance.
- Partial setup can be rolled back if one registration fails.
- Activation reports can identify which configured component installed behavior.
Use the context only after validation succeeds. Validation should inspect config and return diagnostics; registration should create runtime objects and attach them to the context.
Activation APIs
Use the plugin APIs in this order:
- Register the plugin kind.
- Build a
PluginConfig. - Validate the config.
- Initialize the config.
- Inspect the activation report.
- Clear active config during teardown when needed.
Python
Node.js
Rust
Header Plugin Example
The same model applies in every binding: validate component-local config, then install middleware through the component-scoped registration context.
Python
Node.js
Rust
Registration Checklist
Before publishing or sharing a plugin:
- Validate a correct config and confirm no errors are reported.
- Validate an intentionally invalid config and confirm diagnostics are actionable.
- Initialize the plugin and verify the expected subscribers or middleware run.
- Force one registration failure and confirm partial setup is rolled back.
- Deregister or clear active config during teardown.
Common Issues
Check these symptoms first when the workflow does not behave as expected.
- Middleware names collide: Use component-local names and let the plugin runtime qualify them.
- Partial registrations remain after failure: Register through
PluginContextso rollback can clean up. - Registration does validation work: Move deterministic checks into the validation hook.
- Global state leaks across component instances: Create instance-local state during registration or key shared state by component identity.
Next Steps
Use these links to continue from this workflow into the next related task.
- Add advanced validation and rollout controls with Design Plugin Configuration.
- Review concrete authoring patterns in Code Examples.