Adaptive Hints
Use Adaptive Hints when downstream model calls or provider adapters can safely receive guidance metadata from the adaptive runtime.
Adaptive hints register as LLM request intercepts. Lower numeric priority values run earlier in the intercept chain. The plugin sets the default priority relative to other middleware rather than as a standalone importance score.
plugins.toml Example
Add the following Adaptive Hints configuration to plugins.toml:
The latency_sensitivity learner produces request scheduling hints from
completed agent runs. The tool_parallelism learner produces tool execution
plans instead. This configuration allows later request intercepts to continue
running.
Plugin Configuration
Use plugin configuration when the application should let NeMo Relay own the Adaptive Hints request-intercept lifecycle. The following examples configure and activate Adaptive Hints through each supported language binding.
validate() resolves the same configuration layers as initialize() without
loading plugin code or acquiring the activation lease. Use Python/Rust
validate_exact(), Node.js validateExact(), or Go ValidateExact() when only
the supplied static configuration should be checked. For complete
layering rules, refer to Configure.
Python
Node.js
Rust
Add nemo-relay and nemo-relay-adaptive as direct Cargo dependencies.
Enable the macros and rt-multi-thread features on tokio for this example.
Learning From Completed Runs
Run managed model calls inside an agent scope. The learner updates hints asynchronously after the agent scope completes.
The examples use an in-memory backend with no initial history. The first run has no learned hints. Later runs can receive hints after learning finishes. The state is not retained across adaptive runtime restarts.
Manual API
To supply latency guidance before any runs have completed, set a value on the active scope before calling the model:
- Python:
nemo_relay.adaptive.set_latency_sensitivity(8). - Node.js:
adaptive.setLatencySensitivity(8). - Rust:
nemo_relay_adaptive::set_latency_sensitivity(8)?.
For manual runtime construction and lifecycle examples, refer to Manual API.
Fields
The following table describes Adaptive Hints settings:
Disable break_chain unless the adaptive hint should be the final request
transform. Adjust priority only when adaptive hints need to run before or
after known application middleware.
Expected Output
When learned or manual hints are available, the example configuration adds them
to the x-nemo-relay-adaptive-agent-hints header and nvext.agent_hints in the
request body. The hints do not replace the application callback or change the
returned value by themselves. Downstream code must explicitly interpret the
metadata before behavior changes.
Common Configuration and Runtime Issues
- Unknown adaptive hint fields when unknown fields are treated as errors.
inject_body_pathdoes not match the request shape expected by downstream provider adapters.- Hint injection is enabled before downstream model paths can consume or ignore the metadata safely.