pub struct ConsensusEngine { /* private fields */ }Expand description
Stateless consensus engine for synthesizing agent outputs.
The engine takes a slice of AgentOutput values and produces a
ConsensusResult containing the consensus label, confidence score,
deduplicated findings, dissent tracking, and condition extraction.
The engine is stateless: each call to determine
is independent and the engine is safe to share across threads.
Implementations§
Source§impl ConsensusEngine
impl ConsensusEngine
Sourcepub fn min_agents(&self) -> usize
pub fn min_agents(&self) -> usize
Returns the minimum number of agents required by this engine’s configuration.
Sourcepub fn new(config: ConsensusConfig) -> Self
pub fn new(config: ConsensusConfig) -> Self
Creates a new consensus engine with the given configuration.
If config.min_agents is 0, it is clamped to 1.
Sourcepub fn determine(
&self,
agents: &[AgentOutput],
) -> Result<ConsensusResult, MagiError>
pub fn determine( &self, agents: &[AgentOutput], ) -> Result<ConsensusResult, MagiError>
Synthesizes agent outputs into a unified consensus result.
§Errors
MagiError::InsufficientAgentsif fewer thanmin_agentsare provided.MagiError::Validationif duplicate agent names are detected.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConsensusEngine
impl RefUnwindSafe for ConsensusEngine
impl Send for ConsensusEngine
impl Sync for ConsensusEngine
impl Unpin for ConsensusEngine
impl UnsafeUnpin for ConsensusEngine
impl UnwindSafe for ConsensusEngine
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
Mutably borrows from an owned value. Read more