> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/relay/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.