pub struct VifuRuntime { /* private fields */ }Expand description
A self-contained runtime for one application or project.
One runtime may register multiple providers, agents, and stable named endpoints. It can run directly inside a Rust host; Vifu Server and Agent Gateway are optional deployment components.
Implementations§
Source§impl VifuRuntime
impl VifuRuntime
pub fn new(project_id: impl Into<String>) -> Result<Self, RuntimeError>
pub fn with_store( project_id: impl Into<String>, store: Arc<dyn RuntimeStore>, ) -> Result<Self, RuntimeError>
pub fn project_id(&self) -> &str
Sourcepub fn set_monitor_observer(
&self,
observer: Option<RuntimeMonitorObserver>,
) -> Result<(), RuntimeError>
pub fn set_monitor_observer( &self, observer: Option<RuntimeMonitorObserver>, ) -> Result<(), RuntimeError>
Installs or clears the payload-safe runtime lifecycle observer.
Sourcepub fn set_monitor_io_observer(
&self,
observer: Option<RuntimeMonitorIoObserver>,
) -> Result<(), RuntimeError>
pub fn set_monitor_io_observer( &self, observer: Option<RuntimeMonitorIoObserver>, ) -> Result<(), RuntimeError>
Installs or clears the opt-in bounded invocation I/O observer.
pub fn register_provider( &self, name: impl Into<String>, provider: Arc<dyn AgentProvider>, ) -> Result<(), RuntimeError>
Sourcepub fn unregister_provider(&self, name: &str) -> Result<bool, RuntimeError>
pub fn unregister_provider(&self, name: &str) -> Result<bool, RuntimeError>
Removes a provider from the runtime registry.
An invocation that already acquired the provider keeps its own Arc
until that invocation finishes. New invocations fail normally until a
provider with the same name is registered again.
pub fn unregister_agent(&self, id: &str) -> Result<bool, RuntimeError>
pub fn unregister_endpoint(&self, name: &str) -> Result<bool, RuntimeError>
pub fn register_agent(&self, agent: AgentDefinition) -> Result<(), RuntimeError>
pub fn register_endpoint( &self, endpoint: EndpointDefinition, ) -> Result<(), RuntimeError>
pub fn agent_definitions(&self) -> Result<Vec<AgentDefinition>, RuntimeError>
pub fn endpoint_definitions( &self, ) -> Result<Vec<EndpointDefinition>, RuntimeError>
Sourcepub fn apply_manifest(
&self,
manifest: RuntimeManifest,
) -> Result<(), RuntimeError>
pub fn apply_manifest( &self, manifest: RuntimeManifest, ) -> Result<(), RuntimeError>
Replaces the portable agent and endpoint graph with a validated manifest. Provider implementations must be registered locally before activation.
pub fn apply_project_settings( &self, settings: ProjectSettings, ) -> Result<(), RuntimeError>
pub fn current_manifest(&self) -> Result<Option<RuntimeManifest>, RuntimeError>
pub fn current_project_settings( &self, ) -> Result<Option<ProjectSettings>, RuntimeError>
pub fn install_release( &self, release: &RuntimeRelease, ) -> Result<(), RuntimeError>
pub fn releases(&self) -> Result<Vec<RuntimeRelease>, RuntimeError>
pub fn active_release_version(&self) -> Result<Option<u64>, RuntimeError>
pub fn activate_release( &self, version: u64, ) -> Result<RuntimeRelease, RuntimeError>
pub fn restore_active_release( &self, ) -> Result<Option<RuntimeRelease>, RuntimeError>
pub fn bootstrap_release( &self, manifest: RuntimeManifest, ) -> Result<RuntimeRelease, RuntimeError>
pub fn bootstrap_project_settings( &self, settings: ProjectSettings, ) -> Result<RuntimeRelease, RuntimeError>
pub fn save_local_provider_binding( &self, binding: &LocalProviderBinding, ) -> Result<(), RuntimeError>
pub fn local_provider_bindings( &self, ) -> Result<Vec<LocalProviderBinding>, RuntimeError>
pub fn pending_traces( &self, limit: usize, ) -> Result<Vec<RuntimeTraceRecord>, RuntimeError>
pub fn acknowledge_traces( &self, trace_ids: &[String], ) -> Result<(), RuntimeError>
pub fn session( &self, session_id: impl Into<String>, ) -> Result<RuntimeSession, RuntimeError>
pub async fn invoke( &self, input: InvocationInput, ) -> Result<InvocationOutput, RuntimeError>
Sourcepub async fn invoke_with_cancellation(
&self,
input: InvocationInput,
cancellation: CancellationToken,
) -> Result<InvocationOutput, RuntimeError>
pub async fn invoke_with_cancellation( &self, input: InvocationInput, cancellation: CancellationToken, ) -> Result<InvocationOutput, RuntimeError>
Invokes an endpoint while honoring a cancellation signal owned by the embedding host.
Sourcepub async fn invoke_with_events_and_cancellation(
&self,
input: InvocationInput,
cancellation: CancellationToken,
events: ProviderEventSink,
) -> Result<InvocationOutput, RuntimeError>
pub async fn invoke_with_events_and_cancellation( &self, input: InvocationInput, cancellation: CancellationToken, events: ProviderEventSink, ) -> Result<InvocationOutput, RuntimeError>
Invokes an endpoint while forwarding real provider progress to an embedding host and honoring the host’s cancellation signal.
pub fn start_invoke( &self, input: InvocationInput, ) -> Result<InvocationHandle, RuntimeError>
pub fn poll_invocation( &self, handle: &InvocationHandle, ) -> Result<InvocationPoll, RuntimeError>
Sourcepub fn drain_invocation_events(
&self,
handle: &InvocationHandle,
) -> Result<Vec<InvocationEvent>, RuntimeError>
pub fn drain_invocation_events( &self, handle: &InvocationHandle, ) -> Result<Vec<InvocationEvent>, RuntimeError>
Drains incremental events produced since the previous call.
Sourcepub fn take_invocation(
&self,
handle: &InvocationHandle,
) -> Result<InvocationPoll, RuntimeError>
pub fn take_invocation( &self, handle: &InvocationHandle, ) -> Result<InvocationPoll, RuntimeError>
Returns the current poll state and removes it once it is terminal.
Pending and running invocations remain registered so callers can keep polling the same handle.
pub fn cancel_invocation( &self, handle: &InvocationHandle, ) -> Result<(), RuntimeError>
pub async fn execute_effects( &self, effects: Vec<EffectRequest>, ) -> Result<EffectExecution, RuntimeError>
pub async fn execute_effects_with_limit( &self, effects: Vec<EffectRequest>, limit: usize, ) -> Result<EffectExecution, RuntimeError>
pub fn export_snapshot(&self) -> Result<Vec<u8>, RuntimeError>
pub fn restore_snapshot(&self, bytes: &[u8]) -> Result<(), RuntimeError>
Trait Implementations§
Source§impl Clone for VifuRuntime
impl Clone for VifuRuntime
Source§fn clone(&self) -> VifuRuntime
fn clone(&self) -> VifuRuntime
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for VifuRuntime
impl !UnwindSafe for VifuRuntime
impl Freeze for VifuRuntime
impl Send for VifuRuntime
impl Sync for VifuRuntime
impl Unpin for VifuRuntime
impl UnsafeUnpin for VifuRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.