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

# nemo_relay.adaptive

> Adaptive plugin configuration helpers.

Generated from `python/nemo_relay/adaptive.pyi`.

Module `nemo_relay.adaptive`.

Adaptive plugin configuration helpers.

## Classes

### `ConfigDiagnostic(TypedDict)`

One adaptive validation diagnostic.

### `ConfigReport(TypedDict)`

Validation report for adaptive configuration.

### `ConfigPolicy`

Policy for unsupported adaptive configuration.

#### Methods

##### `ConfigPolicy`

```python
def ConfigPolicy(unknown_component: UnsupportedBehavior = ..., unknown_field: UnsupportedBehavior = ..., unsupported_value: UnsupportedBehavior = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this policy to the canonical JSON object shape.

### `BackendSpec`

Adaptive state backend selection.

#### Methods

##### `BackendSpec`

```python
def BackendSpec(kind: str, config: JsonObject = ...) -> None
```

Create an instance.

##### `in_memory`

```python
def in_memory() -> 'BackendSpec'
```

Return an in-memory adaptive backend spec.

##### `redis`

```python
def redis(url: str, key_prefix: str = ...) -> 'BackendSpec'
```

Return a Redis adaptive backend spec.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this backend spec to the canonical JSON object shape.

### `StateConfig`

Adaptive state configuration.

#### Methods

##### `StateConfig`

```python
def StateConfig(backend: BackendSpec) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this state config to the canonical JSON object shape.

### `TelemetryConfig`

Built-in adaptive telemetry subscriber settings.

#### Methods

##### `TelemetryConfig`

```python
def TelemetryConfig(subscriber_name: str | None = ..., learners: list[str] = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this telemetry config to the canonical JSON object shape.

### `AdaptiveHintsConfig`

Built-in adaptive hints injection settings.

#### Methods

##### `AdaptiveHintsConfig`

```python
def AdaptiveHintsConfig(priority: int = ..., break_chain: bool = ..., inject_header: bool = ..., inject_body_path: str = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this adaptive-hints config to the canonical JSON object shape.

### `ToolParallelismConfig`

Built-in adaptive tool scheduling settings.

#### Methods

##### `ToolParallelismConfig`

```python
def ToolParallelismConfig(priority: int = ..., mode: Literal['observe_only', 'inject_hints', 'schedule'] = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this tool-parallelism config to the canonical JSON object shape.

### `AcgStabilityThresholds`

Prompt-stability classification thresholds for ACG.

#### Methods

##### `AcgStabilityThresholds`

```python
def AcgStabilityThresholds(stable_threshold: float = ..., semi_stable_threshold: float = ..., min_observations_for_full_confidence: int = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize these ACG stability thresholds to the canonical JSON object shape.

### `AcgConfig`

Adaptive Cache Governor settings.

#### Methods

##### `AcgConfig`

```python
def AcgConfig(provider: Literal['anthropic', 'openai', 'passthrough'] = ..., observation_window: int = ..., priority: int = ..., stability_thresholds: AcgStabilityThresholds | None = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this ACG config to the canonical JSON object shape.

### `AdaptiveConfig`

Canonical config document for the top-level adaptive component.

#### Methods

##### `AdaptiveConfig`

```python
def AdaptiveConfig(version: int = ..., agent_id: str | None = ..., state: StateConfig | None = ..., telemetry: TelemetryConfig | None = ..., adaptive_hints: AdaptiveHintsConfig | None = ..., tool_parallelism: ToolParallelismConfig | None = ..., acg: AcgConfig | None = ..., policy: ConfigPolicy = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this adaptive config to the canonical JSON object shape.

### `ComponentSpec`

Top-level adaptive component wrapper.

#### Methods

##### `ComponentSpec`

```python
def ComponentSpec(config: AdaptiveConfig | JsonObject, enabled: bool = ...) -> None
```

Create an instance.

##### `to_dict`

```python
def to_dict() -> JsonObject
```

Serialize this component to the canonical plugin shape.

### `AdaptiveRuntime`

Hosted adaptive runtime wrapper used by external framework integrations.

#### Methods

##### `AdaptiveRuntime`

```python
def AdaptiveRuntime(config: AdaptiveConfig | JsonObject) -> None
```

Create an instance.

##### `register`

```python
async def register() -> None
```

Register the configured adaptive features with NeMo Relay.

##### `deregister`

```python
def deregister() -> None
```

Deregister previously registered adaptive features.

##### `shutdown`

```python
async def shutdown() -> None
```

Deregister the runtime and release its owned resources.

##### `wait_for_idle`

```python
def wait_for_idle() -> None
```

Block until the adaptive telemetry drain has processed pending work.

##### `report`

```python
def report() -> ConfigReport
```

Return the validation report associated with this runtime.

##### `bind_scope`

```python
def bind_scope(scope_handle: ScopeHandle) -> None
```

Bind this runtime's ACG request rewriting to an active scope.

##### `build_cache_request_facts`

```python
def build_cache_request_facts(*, provider: str, request_id: str, annotated_request: object, agent_id: str, timestamp: str | None = ...) -> JsonObject | None
```

Build cache-diagnostics facts for an annotated request.

## Functions

### `validate_config`

```python
def validate_config(config: AdaptiveConfig | JsonObject) -> ConfigReport
```

Validate an adaptive config document without constructing a runtime.

### `build_cache_telemetry_event`

```python
def build_cache_telemetry_event(*, provider: str, request_id: str, usage: JsonObject | None = ..., request_facts: JsonObject | None = ..., agent_id: str, template_version: str, toolset_hash: str, model_family: str, tenant_scope: str, timestamp: str | None = ...) -> JsonObject | None
```

Build one canonical cache telemetry event from usage plus request facts.

### `set_latency_sensitivity`

```python
def set_latency_sensitivity(level: int) -> None
```

Set a request-local latency-sensitivity hint.

## Type Aliases And Constants

* `ADAPTIVE_PLUGIN_KIND`