> This page is for NeMo Relay, version v1.0.0.
> For other versions, use one of these documentation indexes:
> - Latest (v0.11.2) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v1.0.0: https://docs.nvidia.com/nemo/relay/v1.0.0/llms.txt
> - v0.11.2: https://docs.nvidia.com/nemo/relay/v0.11.2/llms.txt
> - v0.10.4: https://docs.nvidia.com/nemo/relay/v0.10.4/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

> For clean Markdown of any page, append .md to the page URL. For a task-oriented documentation index, fetch https://docs.nvidia.com/nemo/relay/llms.txt. Use the documentation version matching the installed NeMo Relay package: latest follows the latest stable release, vX.Y.Z identifies a retained release snapshot, and dev documents development changes. Preserve the selected version when following links; do not mix examples or API contracts from different versions. Fetch the relevant section's /llms.txt before individual pages instead of loading a complete version index.

# Struct Plugin Runtime

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

Generated from `cargo doc --no-deps -p nemo-relay-builtins -p nemo-relay-diagnostics -p nemo-relay-logging -p nemo-relay-plugin-host -p nemo-relay-codecs -p nemo-relay -p nemo-relay-runtime -p nemo-relay-model-pricing -p nemo-relay-resource-metrics -p nemo-relay-observability -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 />

#### `diagnostics`

<pre />

Negotiate once per activation. Disabled/unsupported facades skip lazy diagnostic factories and leave execution and operational logging intact.

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

#### `current_scope_stack_snapshot`

<pre />

Read owned root-to-top scope identities from the exact current binding. Returns `None` without a binding and an error if the host cannot read the binding or it has expired. Reads the live scope stack on each call.

#### `inspect_llm_content`

<pre />

Inspect supplied normalized content through the host's shared Rust projection.

One RPC returns an independent snapshot. Older hosts return an explicit unsupported error; this method never falls back to a worker-local extraction implementation.

#### `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 />