Skip to main content

SpawnerFactory

Trait SpawnerFactory 

Source
pub trait SpawnerFactory: Send + Sync {
    // Required method
    fn build(
        &self,
        agent_def: &AgentDef,
        hint: Option<&Value>,
    ) -> Result<Arc<dyn SpawnerAdapter>, CompileError>;
}
Expand description

Factory trait that interprets an AgentDef and builds the concrete SpawnerAdapter. Register one per kind. Parsing the spec, validating it, and baking the profile are the implementation’s job.

The signature was widened in v9 from (name, spec, hint) to (&AgentDef, hint) so the profile can be passed through. Most implementations still just pull &agent_def.name and &agent_def.spec, but Operator-backend factories consume agent_def.profile to bake the persona in.

Required Methods§

Source

fn build( &self, agent_def: &AgentDef, hint: Option<&Value>, ) -> Result<Arc<dyn SpawnerAdapter>, CompileError>

Build the concrete SpawnerAdapter for one AgentDef. hint is the matching entry (if any) from Blueprint.hints.per_agent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§