gRPC Worker Plugins (Rust)
gRPC Worker Plugins (Rust)
Use the nemo-relay-worker crate to build an out-of-process Rust plugin. The
SDK implements the grpc-v1 service, exchanges JSON envelopes with Relay,
handles cancellation, and provides typed registration and host-runtime helpers.
Refer to gRPC Worker Plugin Concepts
to compare the Rust, Python, and command worker runtimes.
Create the Project
Create a binary Rust project with the following Cargo.toml file:
Implement the Worker
Add the following implementation to src/main.rs:
Relay provides the worker and host endpoints, activation ID, plugin ID, and
activation token through environment variables. The Rust SDK derives plugin
identity from WorkerPlugin::plugin_id(); custom launchers can use
NEMO_RELAY_PLUGIN_ID. serve_plugin consumes the endpoints and activation
credentials and runs until Relay requests shutdown. Do not start the worker
directly for normal operation.
Package the Worker
Create relay-plugin.toml with the following content. The artifact digest must
match the executable that operators receive:
Build the executable with the following command:
Calculate the SHA-256 digest of the executable with the following command: This command requires Python 3.
Use the following PowerShell command on Windows:
Replace sha256:<artifact-sha256> with the output before you register the
plugin. On Windows, use the .exe artifact name in source.artifact,
load.entrypoint, and the digest command.
Register the Worker
Register, enable, and validate the worker with the following commands:
Related Topics
- Refer to Configure Discoverable Plugins for lifecycle and trust-policy configuration.
- Refer to gRPC Worker Protocol Overview for the lower-level protocol contract.