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.