> 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 full documentation content, see https://docs.nvidia.com/nemo/relay/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/relay/_mcp/server.

# Struct Adaptive Runtime

> Hosted adaptive runtime that registers NeMo Relay plugin components.

Generated from `cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi`.

```rust
pub struct AdaptiveRuntime { /* private fields */ }
```

Hosted adaptive runtime that registers NeMo Relay plugin components.

This type validates configuration, builds the configured storage backend, registers intercepts and subscribers, and maintains the hot cache used by adaptive features on the request path.

## Implementations

### `impl AdaptiveRuntime`

<pre />

#### `new`

<pre />

Create a new adaptive runtime from configuration.

##### Parameters

* `config`: Adaptive runtime configuration to validate and apply.

##### Returns

A [`Result`](/reference/api/rust-library-reference/nemo-relay-adaptive/error/type-result) containing a new [`AdaptiveRuntime`](/reference/api/rust-library-reference/nemo-relay-adaptive/struct-adaptiveruntime).

##### Errors

Returns [`AdaptiveError::InvalidConfig`](/reference/api/rust-library-reference/nemo-relay-adaptive/error/enum-adaptiveerror) when validation reports errors, or any backend-construction error produced while building the configured state backend.

#### `validate_config`

<pre />

Validate an adaptive runtime configuration without constructing a runtime.

##### Parameters

* `config`: Configuration to validate.

##### Returns

A [`ConfigReport`](/reference/api/rust-library-reference/nemo-relay/plugin/struct-configreport) containing validation diagnostics.

#### `report`

<pre />

Return the configuration report captured during construction.

##### Returns

The [`ConfigReport`](/reference/api/rust-library-reference/nemo-relay/plugin/struct-configreport) associated with this runtime.

#### `wait_for_idle`

<pre />

Block until the telemetry drain has processed all pending events.

##### Notes

This method performs a simple polling wait and is intended for tests, shutdown paths, or other coordination points.

#### `build_cache_request_facts`

<pre />

Build cache-diagnostics facts for an annotated request.

##### Parameters

* `agent_id`: Agent identifier associated with the request.
* `provider`: Logical provider name associated with the request.
* `annotated_request`: Annotated request to analyze.

##### Returns

`Some(CacheRequestFacts)` when enough hot-cache state is available to derive them and `None` otherwise.

#### `bind_scope`

<pre />

Bind the runtime's ACG request rewrite to an active scope.

External framework integrations can bind the runtime to a session scope and then invoke `nemo_relay.llm.request_intercepts(...)` explicitly at the provider boundary. Once any scope is bound, this runtime's hosted ACG execution intercept becomes pass-through so external frameworks do not double-translate requests.

##### Errors

Returns an error when the runtime is not yet registered, when ACG is not configured for this runtime, or when the scope-local request intercept cannot be constructed or registered.

#### `register`

<pre />

Register all configured adaptive features with the shared runtime.

##### Returns

A [`Result`](/reference/api/rust-library-reference/nemo-relay-adaptive/error/type-result) that is `Ok(())` when registration succeeds.

##### Errors

Returns any error raised while seeding state or registering features.

#### `deregister`

<pre />

Deregister all previously registered adaptive features.

##### Returns

A [`Result`](/reference/api/rust-library-reference/nemo-relay-adaptive/error/type-result) that is `Ok(())` after registrations have been rolled back.

##### Errors

Returns any rollback error surfaced by the hosted plugin system.

#### `shutdown`

<pre />

Deregister the runtime and consume it.

##### Returns

A [`Result`](/reference/api/rust-library-reference/nemo-relay-adaptive/error/type-result) that is `Ok(())` when shutdown completes.

##### Errors

Propagates any error returned by [`Self::deregister`](/reference/api/rust-library-reference/nemo-relay-adaptive/struct-adaptiveruntime).

## Trait Implementations

### `impl Debug for AdaptiveRuntime`

<pre />

#### `fmt`

<pre />

### `impl Drop for AdaptiveRuntime`

<pre />

#### `drop`

<pre />