> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server. # nemo-relay-worker > Rust SDK for NeMo Relay out-of-process gRPC worker plugins. Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker`. Rust SDK for NeMo Relay out-of-process gRPC worker plugins. ## Invocation cancellation The `grpc-v1` service tracks active unary and streaming callbacks by the host-provided invocation ID. Relay sends `CancelInvocation` when a managed caller is cancelled, an invocation times out, or a host stream is abandoned. The SDK aborts the matching async callback task and reports `worker.cancelled`; cancellation of an unknown, completed, or already cancelled ID returns a negative acknowledgment. Cancellation is cooperative. Dropping an async callback future releases its Rust-owned resources, but an accepted acknowledgment does not prove that arbitrary blocking work started by the callback has stopped. ## Structs * [ConfigDiagnostic](/reference/api/rust-library-reference/nemo-relay-worker/struct-configdiagnostic): Structured validation diagnostic for plugin validation. * [LlmNext](/reference/api/rust-library-reference/nemo-relay-worker/struct-llmnext): Continuation handle for LLM execution intercepts. * [LlmRequest](/reference/api/rust-library-reference/nemo-relay-worker/struct-llmrequest): JSON-shaped LLM request payload passed through the runtime. * [LlmRequestInterceptOutcome](/reference/api/rust-library-reference/nemo-relay-worker/struct-llmrequestinterceptoutcome): Result of an LLM request intercept that can schedule lifecycle marks. * [LlmStreamNext](/reference/api/rust-library-reference/nemo-relay-worker/struct-llmstreamnext): Continuation handle for LLM stream execution intercepts. * [PendingMarkSpec](/reference/api/rust-library-reference/nemo-relay-worker/struct-pendingmarkspec): Mark requested by middleware for materialization by a lifecycle owner. * [PluginContext](/reference/api/rust-library-reference/nemo-relay-worker/struct-plugincontext): Registration context passed to [`WorkerPlugin::register`](/reference/api/rust-library-reference/nemo-relay-worker/trait-workerplugin). * [PluginRuntime](/reference/api/rust-library-reference/nemo-relay-worker/struct-pluginruntime): Cloneable handle for calling the Relay host runtime from worker callbacks. * [ToolExecutionInterceptOutcome](/reference/api/rust-library-reference/nemo-relay-worker/struct-toolexecutioninterceptoutcome): Canonical result returned by a tool execution intercept. * [ToolNext](/reference/api/rust-library-reference/nemo-relay-worker/struct-toolnext): Continuation handle for tool execution intercepts. * [WorkerServerConfig](/reference/api/rust-library-reference/nemo-relay-worker/struct-workerserverconfig): Explicit worker server configuration for tests and custom launchers. ## Enums * [DiagnosticLevel](/reference/api/rust-library-reference/nemo-relay-worker/enum-diagnosticlevel): Diagnostic severity returned by plugin validation. * [Event](/reference/api/rust-library-reference/nemo-relay-worker/enum-event): Tagged union covering the two ATOF event kinds emitted by the runtime. * [ScopeType](/reference/api/rust-library-reference/nemo-relay-worker/enum-scopetype): Semantic category attached to a scope lifecycle span. * [WorkerSdkError](/reference/api/rust-library-reference/nemo-relay-worker/enum-workersdkerror): Error returned by worker SDK callbacks and runtime helpers. ## Traits * [WorkerPlugin](/reference/api/rust-library-reference/nemo-relay-worker/trait-workerplugin): Trait implemented by Rust out-of-process worker plugins. ## Functions * [serve\_plugin](/reference/api/rust-library-reference/nemo-relay-worker/fn-serve-plugin): Serves a worker plugin using environment variables supplied by the Relay host. * [serve\_plugin\_arc](/reference/api/rust-library-reference/nemo-relay-worker/fn-serve-plugin-arc): Serves a shared worker plugin using environment variables supplied by the Relay host. * [serve\_plugin\_arc\_with\_config](/reference/api/rust-library-reference/nemo-relay-worker/fn-serve-plugin-arc-with-config): Serves a shared worker plugin using explicit endpoint and authentication configuration. ## Type Aliases * [BoxFutureResult](/reference/api/rust-library-reference/nemo-relay-worker/type-boxfutureresult): Boxed future returned by async worker callbacks. * [Json](/reference/api/rust-library-reference/nemo-relay-worker/type-json): Type alias for [`serde_json::Value`](https://docs.rs/serde_json/1.0.149/serde_json/value/enum.Value.html), used as the universal JSON representation throughout NeMo Relay APIs. * [JsonStream](/reference/api/rust-library-reference/nemo-relay-worker/type-jsonstream): Boxed JSON stream returned by streaming worker callbacks. * [Result](/reference/api/rust-library-reference/nemo-relay-worker/type-result): SDK result type. > Rust SDK for NeMo Relay out-of-process gRPC worker plugins. ## Docs - [Struct Config Diagnostic](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-configdiagnostic.md): Structured validation diagnostic for plugin validation. - [Struct LlmNext](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-llmnext.md): Continuation handle for LLM execution intercepts. - [Struct LlmRequest](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-llmrequest.md): JSON-shaped LLM request payload passed through the runtime. - [Struct LlmRequest Intercept Outcome](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-llmrequestinterceptoutcome.md): Result of an LLM request intercept that can schedule lifecycle marks. - [Struct LlmStream Next](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-llmstreamnext.md): Continuation handle for LLM stream execution intercepts. - [Struct Pending Mark Spec](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-pendingmarkspec.md): Mark requested by middleware for materialization by a lifecycle owner. - [Struct Plugin Context](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-plugincontext.md): Registration context passed to `WorkerPlugin::register`. - [Struct Plugin Runtime](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-pluginruntime.md): Cloneable handle for calling the Relay host runtime from worker callbacks. - [Struct Tool Execution Intercept Outcome](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-toolexecutioninterceptoutcome.md): Canonical result returned by a tool execution intercept. - [Struct Tool Next](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-toolnext.md): Continuation handle for tool execution intercepts. - [Struct Worker Server Config](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/struct-workerserverconfig.md): Explicit worker server configuration for tests and custom launchers. - [Enum Diagnostic Level](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/enum-diagnosticlevel.md): Diagnostic severity returned by plugin validation. - [Enum Event](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/enum-event.md): Tagged union covering the two ATOF event kinds emitted by the runtime. - [Enum Scope Type](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/enum-scopetype.md): Semantic category attached to a scope lifecycle span. - [Enum Worker SdkError](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/enum-workersdkerror.md): Error returned by worker SDK callbacks and runtime helpers. - [Trait Worker Plugin](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/trait-workerplugin.md): Trait implemented by Rust out-of-process worker plugins. - [Function serve_plugin](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/fn-serve-plugin.md): Serves a worker plugin using environment variables supplied by the Relay host. - [Function serve_plugin_arc](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/fn-serve-plugin-arc.md): Serves a shared worker plugin using environment variables supplied by the Relay host. - [Function serve_plugin_arc_with_config](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/fn-serve-plugin-arc-with-config.md): Serves a shared worker plugin using explicit endpoint and authentication configuration. - [Type Alias BoxFuture Result](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/type-boxfutureresult.md): Boxed future returned by async worker callbacks. - [Type Alias Json](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/type-json.md): Type alias for `serde_json::Value`, used as the universal JSON representation throughout NeMo Relay APIs. - [Type Alias Json Stream](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/type-jsonstream.md): Boxed JSON stream returned by streaming worker callbacks. - [Type Alias Result](https://docs.nvidia.com/nemo/relay/v0.5.0/reference/api/rust-library-reference/nemo-relay-worker/type-result.md): SDK result type.