pub struct SupervisorBuilder { /* private fields */ }Expand description
Builder for creating an AgentSupervisor.
Created via OxicodeBuilder::supervisor().
Implementations§
Source§impl SupervisorBuilder
impl SupervisorBuilder
Sourcepub fn policy(self, policy: SupervisorPolicy) -> Self
pub fn policy(self, policy: SupervisorPolicy) -> Self
Set the restart policy.
Sourcepub fn snapshot_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn snapshot_dir(self, dir: impl Into<PathBuf>) -> Self
Set the directory for persisting snapshots.
Sourcepub fn with_agent_decorator(self, decorator: Arc<dyn AgentDecorator>) -> Self
pub fn with_agent_decorator(self, decorator: Arc<dyn AgentDecorator>) -> Self
Attach an crate::observability::AgentDecorator that wraps every
supervisor-spawned agent.
When set, SupervisorBuilder::build clones the built Oxicode
into the supervisor and configures it to route spawns through
Oxicode::agent(config) + decorator.decorate(builder) instead
of the bare Agent::new(provider, config, tools) fast path.
Use crate::observability::ObservabilityDecorator to bundle audit / authorizer /
tracer / cost-tracker — those hooks then actually run on
every spawned agent (no longer silent no-ops).
Replaces the four deprecated no-op setters with_audit,
with_authorizer, with_tracer, with_cost_tracker, which
emitted tracing::warn! and dropped their arguments.
Sourcepub fn build(self) -> Result<(Oxicode, AgentSupervisor)>
pub fn build(self) -> Result<(Oxicode, AgentSupervisor)>
Build the supervisor.
Creates an Oxicode instance internally and constructs the
supervisor with a file-based snapshot store. When
with_agent_decorator was
called, the built Oxicode is cloned into the supervisor so
every spawn routes through the decorator.
Auto Trait Implementations§
impl !Freeze for SupervisorBuilder
impl !RefUnwindSafe for SupervisorBuilder
impl !UnwindSafe for SupervisorBuilder
impl Send for SupervisorBuilder
impl Sync for SupervisorBuilder
impl Unpin for SupervisorBuilder
impl UnsafeUnpin for SupervisorBuilder
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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.