> This page is for NeMo Relay, version v0.10.0.
> For other versions, use one of these documentation indexes:
> - Latest (v0.10.0) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v0.10.0: https://docs.nvidia.com/nemo/relay/v0.10.0/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt
> - v0.7.3: https://docs.nvidia.com/nemo/relay/v0.7.3/llms.txt
> - v0.6.0: https://docs.nvidia.com/nemo/relay/v0.6.0/llms.txt
> - v0.5.0: https://docs.nvidia.com/nemo/relay/v0.5.0/llms.txt

> 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.

# Struct Plugin Runtime

> Cloneable handle for calling the Relay host runtime from worker callbacks.

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
pub struct PluginRuntime { /* private fields */ }
```

Cloneable handle for calling the Relay host runtime from worker callbacks.

## Implementations

### `impl PluginRuntime`

<pre />

#### `log`

<pre />

Emits one operational log record through the Relay host's configured sinks.

The host authenticates the activation and applies its own log-level filter. `target` identifies the plugin subsystem; pass an empty string to use the plugin's default target.

#### `trace`

<pre />

Emits an info-level operational log record through the Relay host.

#### `debug`

<pre />

Emits a debug-level operational log record through the Relay host.

#### `info`

<pre />

Emits an info-level operational log record through the Relay host.

#### `warn`

<pre />

Emits a warn-level operational log record through the Relay host.

#### `error`

<pre />

Emits an error-level operational log record through the Relay host.

#### `list_runtime_registrations`

<pre />

List global runtime registrations, optionally filtered by kind.

#### `register_conditional_middleware_guardrail`

<pre />

Register a callback-based gate owned by this worker activation.

#### `deregister_conditional_middleware_guardrail`

<pre />

Deregister a callback-based gate owned by this worker activation.

#### `emit_mark`

<pre />

Emits a mark event through the host runtime.

#### `emit_mark_with_options`

<pre />

Emits a mark event through the host runtime with optional schema and severity fields.

#### `emit_mark_with_options_and_category`

<pre />

Emits a mark event through the host runtime with optional schema, severity, and category.

#### `runtime_diagnostics`

<pre />

Return a bounded snapshot of active host runtime diagnostics.

#### `emit_metric`

<pre />

Emits a validated Relay metric-measurement mark through the host runtime.

#### `emit_metric_with_category`

<pre />

Emits a validated Relay metric-measurement mark with an event category.

#### `create_scope_stack`

<pre />

Creates an isolated host-owned scope stack.

#### `drop_scope_stack`

<pre />

Drops an isolated host-owned scope stack.

#### `with_scope_stack`

<pre />

Runs an async operation with runtime calls bound to a specific host-owned scope stack.

This is useful for isolated stacks created with [`Self::create_scope_stack`](/reference/api/rust-library-reference/nemo-relay-worker/struct-pluginruntime). The previous worker invocation scope is restored after the future completes.

#### `push_scope`

<pre />

Pushes a scope through the host runtime.

#### `push_scope_at`

<pre />

Pushes a scope through the host runtime using an explicit start time.

#### `pop_scope`

<pre />

Pops a scope through the host runtime.

#### `pop_scope_at`

<pre />

Pops a scope through the host runtime using an explicit end time.

## Trait Implementations

### `impl Clone for PluginRuntime`

<pre />

#### `clone`

<pre />

#### `clone_from`

<pre />