pub struct OxiosEngine { /* private fields */ }Expand description
The kernel’s engine — wraps oxi-sdk’s Oxi instance.
Created via OxiosEngine::new() or OxiosEngine::builder().
Provides access to providers, models, routing, pooling, and agent construction.
§RFC-014 Phase D
authorizer / tracer / cost_tracker are optional, engine-level
observability and security handles. When set, they are propagated to
every agent built via OxiosEngine::oxi().agent() using
the new AgentBuilder::authorizer() / .tracer() / .cost_tracker()
API. All three are None by default, keeping the existing call sites
fully backward compatible.
Implementations§
Source§impl OxiosEngine
impl OxiosEngine
Sourcepub fn new(default_model_id: impl Into<String>) -> Self
pub fn new(default_model_id: impl Into<String>) -> Self
Create a new engine with the given default model.
Internally calls OxiBuilder::new().with_builtins() to load all
built-in models and providers.
Sourcepub fn from_config(
default_model_id: impl Into<String>,
config_api_key: Option<&str>,
) -> Self
pub fn from_config( default_model_id: impl Into<String>, config_api_key: Option<&str>, ) -> Self
Create a new engine with credentials from config.
Resolves API keys from CredentialStore for each known provider and injects them into the OxiBuilder. This enables the engine to create properly authenticated providers.
Resolution order (per provider): env var → config.toml → ~/.oxi/auth.json
Sourcepub fn builder() -> OxiosEngineBuilder
pub fn builder() -> OxiosEngineBuilder
Create an engine builder for advanced configuration.
Use this when you need credential injection, routing, or custom provider registration.
§RFC-014 Phase D
The builder also exposes .with_authorizer() / .with_tracer() /
.with_cost_tracker() for attaching engine-level observability
and security handles. All three are None by default.
§Example
use oxios_kernel::engine::OxiosEngine;
let engine = OxiosEngine::builder()
.default_model("anthropic/claude-sonnet-4-20250514")
.api_key("anthropic", "sk-ant-...")
.build();Sourcepub fn oxi(&self) -> &Oxi
pub fn oxi(&self) -> &Oxi
Get a reference to the underlying Oxi instance.
Use this when you need to pass the engine to oxi-sdk APIs directly
(e.g., AgentBuilder, MessageBus, AgentGroup).
RFC-014 Phase D: get the engine-level Authorizer, if any.
When Some, the authorizer is attached to every Agent built via
Oxi::agent().authorizer(...) in agent_runtime.rs::run_agent().
Sourcepub fn tracer(&self) -> Option<&Arc<Tracer>>
pub fn tracer(&self) -> Option<&Arc<Tracer>>
RFC-014 Phase D: get the engine-level Tracer, if any.
When Some, the tracer is attached to every Agent built via
Oxi::agent().tracer(...) in agent_runtime.rs::run_agent().
Sourcepub fn cost_tracker(&self) -> Option<&Arc<CostTracker>>
pub fn cost_tracker(&self) -> Option<&Arc<CostTracker>>
RFC-014 Phase D: get the engine-level CostTracker, if any.
When Some, the cost tracker is attached to every Agent built via
Oxi::agent().cost_tracker(...) in agent_runtime.rs::run_agent().
Sourcepub fn resolve_model(&self, model_id: &str) -> Result<Model>
pub fn resolve_model(&self, model_id: &str) -> Result<Model>
Resolve a model ID to a Model.
Sourcepub fn create_provider(&self, name: &str) -> Result<Arc<dyn Provider>>
pub fn create_provider(&self, name: &str) -> Result<Arc<dyn Provider>>
Create a provider for the given provider name.
Sourcepub fn default_model_id(&self) -> &str
pub fn default_model_id(&self) -> &str
Get the default model ID.
Sourcepub fn routing_control(&self) -> Option<&RoutingControl>
pub fn routing_control(&self) -> Option<&RoutingControl>
Get the routing control, if routing is enabled.
Sourcepub fn pooled_provider(&self, name: &str, rpm: u32) -> Result<Arc<dyn Provider>>
pub fn pooled_provider(&self, name: &str, rpm: u32) -> Result<Arc<dyn Provider>>
Get a rate-limited provider from the pool.
On first call for a provider name, creates a ProviderPool wrapping
the base provider with the given RPM/concurrency limits.
Subsequent calls return the same pooled instance.
If no rate limit is needed, returns the base provider directly.
Trait Implementations§
Source§impl Debug for OxiosEngine
impl Debug for OxiosEngine
Source§impl EngineProvider for OxiosEngine
impl EngineProvider for OxiosEngine
Source§fn create_provider(&self, provider_name: &str) -> Result<Arc<dyn Provider>>
fn create_provider(&self, provider_name: &str) -> Result<Arc<dyn Provider>>
Source§fn resolve_model(&self, model_id: &str) -> Result<Model>
fn resolve_model(&self, model_id: &str) -> Result<Model>
Source§fn default_model_id(&self) -> &str
fn default_model_id(&self) -> &str
Auto Trait Implementations§
impl !Freeze for OxiosEngine
impl !RefUnwindSafe for OxiosEngine
impl !UnwindSafe for OxiosEngine
impl Send for OxiosEngine
impl Sync for OxiosEngine
impl Unpin for OxiosEngine
impl UnsafeUnpin for OxiosEngine
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSendSync for T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.