pub struct AdaptiveRuntime { /* private fields */ }Expand description
Hosted adaptive runtime that registers NeMo Flow 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§
Source§impl AdaptiveRuntime
impl AdaptiveRuntime
Sourcepub async fn new(config: AdaptiveConfig) -> Result<Self>
pub async fn new(config: AdaptiveConfig) -> Result<Self>
Create a new adaptive runtime from configuration.
§Parameters
config: Adaptive runtime configuration to validate and apply.
§Returns
A Result containing a new AdaptiveRuntime.
§Errors
Returns AdaptiveError::InvalidConfig when validation reports errors,
or any backend-construction error produced while building the configured
state backend.
Sourcepub fn validate_config(config: &AdaptiveConfig) -> ConfigReport
pub fn validate_config(config: &AdaptiveConfig) -> ConfigReport
Validate an adaptive runtime configuration without constructing a runtime.
§Parameters
config: Configuration to validate.
§Returns
A ConfigReport containing validation diagnostics.
Sourcepub fn report(&self) -> &ConfigReport
pub fn report(&self) -> &ConfigReport
Return the configuration report captured during construction.
§Returns
The ConfigReport associated with this runtime.
Sourcepub fn wait_for_idle(&self)
pub fn wait_for_idle(&self)
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.
Sourcepub fn build_cache_request_facts(
&self,
agent_id: &str,
provider: &str,
annotated_request: &AnnotatedLlmRequest,
) -> Option<CacheRequestFacts>
pub fn build_cache_request_facts( &self, agent_id: &str, provider: &str, annotated_request: &AnnotatedLlmRequest, ) -> Option<CacheRequestFacts>
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.
Sourcepub fn bind_scope(&mut self, scope_uuid: Uuid) -> Result<()>
pub fn bind_scope(&mut self, scope_uuid: Uuid) -> Result<()>
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_flow.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.