Adaptive Cache Governor (ACG)
Use the Adaptive Cache Governor (ACG) when repeated LLM requests contain stable prompt sections that can benefit from provider prompt caching.
ACG decomposes LLM requests into Prompt IR, scores block stability across
observed runs, and plans provider-specific prompt-cache breakpoints. The acg
section is optional. Omit it to keep cache planning disabled.
plugins.toml Example
Add the following Adaptive Cache Governor configuration to plugins.toml:
This configuration enables adaptive telemetry and configures ACG to plan cache breakpoints for Anthropic-style request surfaces after it has enough observed prompt samples.
Plugin Configuration
Use plugin configuration when the application should let NeMo Relay own the Adaptive Cache Governor (ACG) runtime lifecycle. The following examples configure and activate ACG 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
Manual API
For manual runtime construction and lifecycle examples, refer to Manual API.
Fields
The following table describes Adaptive Cache Governor settings:
Use passthrough when you want ACG observations without provider-specific hint
translation. Set provider to the backend API surface the agent actually calls
when you are ready to apply cache planning.
Expected Output
When ACG is active, instrumented LLM calls still return the same application result. ACG records observations and, when enough stable prompt structure is available, emits adaptive diagnostics and cache-planning decisions through the adaptive runtime.
Prompt analysis uses borrowed normalized content views with separate policies for profile fingerprints and prompt IR. It retains existing message/block boundaries. Plain prose is whitespace-normalized; structured input is canonical JSON whose payload string values keep their whitespace. Media and provider-native parts contribute typed fingerprints rather than disappearing from stability analysis or being treated as prose. Tool-result identities retain the inner content type, so a structured result is distinct from literal text containing its serialized JSON. These analysis representations are not sent to the provider.
Media and opaque blocks require supplied token metadata for token-based cache planning. Without it, economics stops considering prefixes at that block, and Anthropic translation declines cache breakpoints spanning it. Character counts of fingerprints are not used as token counts. The full source-request fingerprint guard for prefixes beyond the leading scaffold remains in place.
ACG now stores learning observations and the agent bootstrap seed under the
::acg-ir=2 namespace. Existing unversioned state is retained but is not loaded
or mixed with the new representation; upgraded agents warm up from new samples.
This does not change the configured agent ID, storage backend APIs, or grouping of
growing conversations. Rust consumers matching BlockContentType must handle
the new StructuredInput and Opaque variants.
Provider-specific cache hints are useful only when the request surface supports them. Validate against representative LLM traffic before enabling ACG in production.
Common Configuration and Runtime Issues
provideris not one ofpassthrough,anthropic, oropenai.- Stability thresholds are outside the supported numeric range.
- ACG is enabled before the application emits managed LLM events.
- The configured provider does not match the real model API surface.