> This page is for NeMo Relay, version dev.
> 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
> - 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
> - v0.7.3: https://docs.nvidia.com/nemo/relay/v0.7.3/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.

# Adaptive

> Manual adaptive runtime, ACG, and hints APIs.

Use this reference for manual adaptive runtime APIs. For plugin-managed
configuration, start with [Adaptive Configuration](/nemo/relay/dev/configure-plugins/adaptive/configuration).

## Adaptive Configuration

An `AdaptiveConfig` combines state, telemetry, tool parallelism, hints, and ACG
settings. Use `AdaptiveRuntime` to register the configured components before
application work and shut them down afterward.

### Manual API

Use the manual runtime API when an integration needs to own adaptive lifecycle
directly instead of activating the top-level plugin component.

#### Python

```python
import asyncio

import nemo_relay

adaptive_config = nemo_relay.adaptive.AdaptiveConfig(
    agent_id="planner",
    state=nemo_relay.adaptive.StateConfig(
        backend=nemo_relay.adaptive.BackendSpec.in_memory(),
    ),
    telemetry=nemo_relay.adaptive.TelemetryConfig(
        subscriber_name="adaptive.telemetry",
        learners=["tool_parallelism"],
    ),
    tool_parallelism=nemo_relay.adaptive.ToolParallelismConfig(mode="observe_only"),
    adaptive_hints=nemo_relay.adaptive.AdaptiveHintsConfig(
        inject_body_path="nvext.agent_hints",
    ),
    acg=nemo_relay.adaptive.AcgConfig(provider="passthrough"),
)

runtime = nemo_relay.adaptive.AdaptiveRuntime(adaptive_config.to_dict())
async def main() -> None:
    await runtime.register()
    try:
        # Run instrumented application work here.
        runtime.wait_for_idle()
    finally:
        await runtime.shutdown()

asyncio.run(main())
```

#### Node.js

The Node.js binding exposes `adaptive.AdaptiveRuntime` for manual lifecycle
ownership. Construct it from `adaptiveConfig` in the
[Per-Language Plugin Configuration example](/nemo/relay/dev/configure-plugins/adaptive/configuration#per-language-plugin-configuration),
then call `register()`, `waitForIdle()`, and `shutdown()`.

#### Rust

```rust title={"adaptive_configuration.rs"} maxLines={0}
// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    use nemo_relay_adaptive::{
        AcgComponentConfig, AdaptiveConfig, AdaptiveHintsComponentConfig, AdaptiveRuntime,
        BackendSpec, StateConfig, TelemetryComponentConfig, ToolParallelismComponentConfig,
    };

    let adaptive = AdaptiveConfig {
        agent_id: Some("planner".into()),
        state: Some(StateConfig {
            backend: BackendSpec::in_memory(),
        }),
        telemetry: Some(TelemetryComponentConfig {
            subscriber_name: Some("adaptive.telemetry".into()),
            learners: vec!["tool_parallelism".into()],
        }),
        tool_parallelism: Some(ToolParallelismComponentConfig::default()),
        adaptive_hints: Some(AdaptiveHintsComponentConfig {
            inject_body_path: "nvext.agent_hints".into(),
            ..AdaptiveHintsComponentConfig::default()
        }),
        acg: Some(AcgComponentConfig {
            provider: "passthrough".into(),
            ..AcgComponentConfig::default()
        }),
        ..AdaptiveConfig::default()
    };

    let mut runtime = AdaptiveRuntime::new(adaptive).await?;
    runtime.register().await?;

    // Run instrumented application work here.

    runtime.wait_for_idle();
    runtime.shutdown().await?;
    Ok(())
}

```

**Expected outcome:** Registration and shutdown complete without error. These
examples do not print output.

## Adaptive Cache Governor (ACG)

### Manual API

Use the manual runtime API when an integration needs to own adaptive lifecycle
directly instead of activating the top-level plugin component.

#### Python

```python
import asyncio

import nemo_relay

adaptive_config = nemo_relay.adaptive.AdaptiveConfig(
    agent_id="planner",
    state=nemo_relay.adaptive.StateConfig(
        backend=nemo_relay.adaptive.BackendSpec.in_memory(),
    ),
    telemetry=nemo_relay.adaptive.TelemetryConfig(learners=["acg"]),
    acg=nemo_relay.adaptive.AcgConfig(provider="anthropic"),
)

runtime = nemo_relay.adaptive.AdaptiveRuntime(adaptive_config.to_dict())
async def main() -> None:
    await runtime.register()
    try:
        # Run instrumented application work here.
        runtime.wait_for_idle()
    finally:
        await runtime.shutdown()

asyncio.run(main())
```

#### Node.js

The Node.js binding exposes ACG through the adaptive plugin component helpers.
Use the [Plugin Configuration example](/nemo/relay/dev/configure-plugins/adaptive/acg#plugin-configuration)
when activating ACG from Node.js.

#### Rust

```rust title={"acg.rs"} maxLines={0}
// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    use nemo_relay_adaptive::{
        AcgComponentConfig, AdaptiveConfig, AdaptiveRuntime, BackendSpec, StateConfig,
        TelemetryComponentConfig,
    };

    let adaptive = AdaptiveConfig {
        agent_id: Some("planner".into()),
        state: Some(StateConfig {
            backend: BackendSpec::in_memory(),
        }),
        telemetry: Some(TelemetryComponentConfig {
            learners: vec!["acg".into()],
            ..TelemetryComponentConfig::default()
        }),
        acg: Some(AcgComponentConfig {
            provider: "anthropic".into(),
            ..AcgComponentConfig::default()
        }),
        ..AdaptiveConfig::default()
    };

    let mut runtime = AdaptiveRuntime::new(adaptive).await?;
    runtime.register().await?;

    // Run instrumented application work here.

    runtime.wait_for_idle();
    runtime.shutdown().await?;
    Ok(())
}

```

**Expected outcome:** Registration and shutdown complete without error. These
examples do not print output.

## Adaptive Hints

### Manual API

Use the manual runtime API when an integration needs to own adaptive lifecycle
directly instead of activating the top-level plugin component.

#### Python

```python
import asyncio

import nemo_relay

adaptive_config = nemo_relay.adaptive.AdaptiveConfig(
    agent_id="planner",
    state=nemo_relay.adaptive.StateConfig(
        backend=nemo_relay.adaptive.BackendSpec.in_memory(),
    ),
    telemetry=nemo_relay.adaptive.TelemetryConfig(learners=["tool_parallelism"]),
    adaptive_hints=nemo_relay.adaptive.AdaptiveHintsConfig(
        inject_body_path="nvext.agent_hints",
    ),
)

runtime = nemo_relay.adaptive.AdaptiveRuntime(adaptive_config.to_dict())
async def main() -> None:
    await runtime.register()
    try:
        # Run instrumented application work here.
        nemo_relay.adaptive.set_latency_sensitivity(8)
    finally:
        await runtime.shutdown()

asyncio.run(main())
```

#### Node.js

The Node.js binding exposes Adaptive Hints through the adaptive plugin component
helpers. Use the [Plugin Configuration example](/nemo/relay/dev/configure-plugins/adaptive/adaptive-hints#plugin-configuration)
when activating Adaptive Hints from Node.js.

#### Rust

```rust title={"adaptive_hints.rs"} maxLines={0}
// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    use nemo_relay_adaptive::{
        AdaptiveConfig, AdaptiveHintsComponentConfig, AdaptiveRuntime, BackendSpec, StateConfig,
        TelemetryComponentConfig, set_latency_sensitivity,
    };

    let adaptive = AdaptiveConfig {
        agent_id: Some("planner".into()),
        state: Some(StateConfig {
            backend: BackendSpec::in_memory(),
        }),
        telemetry: Some(TelemetryComponentConfig {
            learners: vec!["tool_parallelism".into()],
            ..TelemetryComponentConfig::default()
        }),
        adaptive_hints: Some(AdaptiveHintsComponentConfig {
            inject_body_path: "nvext.agent_hints".into(),
            ..AdaptiveHintsComponentConfig::default()
        }),
        ..AdaptiveConfig::default()
    };

    let mut runtime = AdaptiveRuntime::new(adaptive).await?;
    runtime.register().await?;

    // Run instrumented application work here.
    set_latency_sensitivity(8)?;

    runtime.shutdown().await?;
    Ok(())
}

```

**Expected outcome:** Registration and shutdown complete without error. These
examples do not print output.