Skip to main content

AdaptiveRuntime

Struct AdaptiveRuntime 

Source
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

Source

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.

Source

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.

Source

pub fn report(&self) -> &ConfigReport

Return the configuration report captured during construction.

§Returns

The ConfigReport associated with this runtime.

Source

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.

Source

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.

Source

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.

Source

pub async fn register(&mut self) -> Result<()>

Register all configured adaptive features with the shared runtime.

§Returns

A Result that is Ok(()) when registration succeeds.

§Errors

Returns any error raised while seeding state or registering features.

Source

pub fn deregister(&mut self) -> Result<()>

Deregister all previously registered adaptive features.

§Returns

A Result that is Ok(()) after registrations have been rolled back.

§Errors

Returns any rollback error surfaced by the hosted plugin system.

Source

pub async fn shutdown(self) -> Result<()>

Deregister the runtime and consume it.

§Returns

A Result that is Ok(()) when shutdown completes.

§Errors

Propagates any error returned by Self::deregister.

Trait Implementations§

Source§

impl Debug for AdaptiveRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for AdaptiveRuntime

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.