Skip to main content

GovernanceStateStore

Trait GovernanceStateStore 

Source
pub trait GovernanceStateStore: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        scope: &'life1 GovernanceScope,
    ) -> Pin<Box<dyn Future<Output = Result<Option<GovernanceState>, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn set<'life0, 'async_trait>(
        &'life0 self,
        scope: GovernanceScope,
        expected_epoch: u64,
        frozen: bool,
        reason: Option<String>,
        issued_by: Option<SubjectRef>,
    ) -> Pin<Box<dyn Future<Output = Result<GovernanceState, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GovernanceState>, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

Core traits and types.

Always available regardless of feature flags. Includes:

  • Agent - The fundamental trait for all agents
  • Tool / Toolset - For extending agents with capabilities
  • Session / State - For managing conversation context
  • Event - For streaming agent responses
  • AdkError / Result - Unified error handling Stores freeze state per scope with compare-and-swap updates.

Every backend passes adk_core::governance_state_store_conformance_tests! (feature conformance).

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, scope: &'life1 GovernanceScope, ) -> Pin<Box<dyn Future<Output = Result<Option<GovernanceState>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns the state of scope, or None when it was never set.

Source

fn set<'life0, 'async_trait>( &'life0 self, scope: GovernanceScope, expected_epoch: u64, frozen: bool, reason: Option<String>, issued_by: Option<SubjectRef>, ) -> Pin<Box<dyn Future<Output = Result<GovernanceState, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sets the state of scope when its current epoch equals expected_epoch (0 when the scope has no state) and returns the new state at epoch expected_epoch + 1.

§Errors

Returns GOVERNANCE_CONFLICT_CODE when the epoch moved; the error’s current_epoch metadata holds the epoch to re-read from.

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<GovernanceState>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Returns every scope’s state, ordered by GovernanceScope::key.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§