pub struct AgentConsensus { /* private fields */ }Expand description
Simplified agent consensus for response voting
Provides a simpler consensus mechanism for AI agents to vote on responses without the full complexity of Ringtail threshold signatures.
Implementations§
Source§impl AgentConsensus
impl AgentConsensus
Sourcepub fn new(threshold: f64, min_responses: usize) -> Self
pub fn new(threshold: f64, min_responses: usize) -> Self
Create new agent consensus with threshold
Sourcepub fn with_timeout(self, timeout_secs: u64) -> Self
pub fn with_timeout(self, timeout_secs: u64) -> Self
Set query timeout
Sourcepub fn min_responses(&self) -> usize
pub fn min_responses(&self) -> usize
Get minimum responses
Sourcepub async fn submit_query(&self, query: &str) -> [u8; 32]
pub async fn submit_query(&self, query: &str) -> [u8; 32]
Submit a new query for consensus
Sourcepub async fn submit_response(
&self,
query_id: &[u8; 32],
agent_id: &str,
response: &str,
) -> Result<()>
pub async fn submit_response( &self, query_id: &[u8; 32], agent_id: &str, response: &str, ) -> Result<()>
Submit a response from an agent
Sourcepub async fn try_consensus(&self, query_id: &[u8; 32]) -> Result<Option<String>>
pub async fn try_consensus(&self, query_id: &[u8; 32]) -> Result<Option<String>>
Try to reach consensus on a query
Sourcepub async fn cleanup_expired(&self)
pub async fn cleanup_expired(&self)
Remove expired queries
Sourcepub async fn active_queries(&self) -> usize
pub async fn active_queries(&self) -> usize
Get number of active queries
Auto Trait Implementations§
impl Freeze for AgentConsensus
impl !RefUnwindSafe for AgentConsensus
impl Send for AgentConsensus
impl Sync for AgentConsensus
impl Unpin for AgentConsensus
impl !UnwindSafe for AgentConsensus
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