Skip to main content

StateKey

Trait StateKey 

Source
pub trait StateKey:
    'static
    + Send
    + Sync {
    type Value: Clone + Default + Serialize + DeserializeOwned + Send + Sync + 'static;
    type Update: Send + 'static;

    const KEY: &'static str;
    const MERGE: MergeStrategy = MergeStrategy::Exclusive;
    const SCOPE: KeyScope = KeyScope::Run;

    // Required method
    fn apply(value: &mut Self::Value, update: Self::Update);

    // Provided methods
    fn encode(value: &Self::Value) -> Result<Value, StateError> { ... }
    fn decode(value: Value) -> Result<Self::Value, StateError> { ... }
}

Required Associated Constants§

Source

const KEY: &'static str

Provided Associated Constants§

Source

const MERGE: MergeStrategy = MergeStrategy::Exclusive

Parallel merge strategy. Default: Exclusive (conflict on concurrent writes).

Source

const SCOPE: KeyScope = KeyScope::Run

Lifetime scope. Default: Run (cleared at run start).

Required Associated Types§

Source

type Value: Clone + Default + Serialize + DeserializeOwned + Send + Sync + 'static

Source

type Update: Send + 'static

Required Methods§

Source

fn apply(value: &mut Self::Value, update: Self::Update)

Provided Methods§

Source

fn encode(value: &Self::Value) -> Result<Value, StateError>

Source

fn decode(value: Value) -> Result<Self::Value, StateError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl StateKey for ContextMessageStore

Source§

const KEY: &'static str = "__runtime.context_message_store"

Source§

const MERGE: MergeStrategy = MergeStrategy::Commutative

Source§

type Value = ContextMessageStoreValue

Source§

type Update = ContextMessageAction

Source§

impl StateKey for ContextThrottleState

Source§

const KEY: &'static str = "__runtime.context_throttle"

Source§

type Value = ContextThrottleMap

Source§

type Update = ContextThrottleUpdate

Source§

impl StateKey for InferenceOverrideState

Source§

const KEY: &'static str = "__runtime.inference_override_state"

Source§

const MERGE: MergeStrategy = MergeStrategy::Commutative

Source§

type Value = InferenceOverrideStateValue

Source§

type Update = InferenceOverrideStateAction

Source§

impl StateKey for PendingWorkKey

Source§

const KEY: &'static str = "__runtime.pending_work"

Source§

type Value = PendingWorkState

Source§

type Update = bool

Source§

impl StateKey for RunLifecycle

Source§

const KEY: &'static str = "__runtime.run_lifecycle"

Source§

type Value = RunLifecycleState

Source§

type Update = RunLifecycleUpdate

Source§

impl StateKey for ToolCallStates

Source§

const KEY: &'static str = "__runtime.tool_call_states"

Source§

const MERGE: MergeStrategy = MergeStrategy::Commutative

Source§

type Value = ToolCallStateMap

Source§

type Update = ToolCallStatesUpdate

Source§

impl StateKey for ToolFilterState

Source§

const KEY: &'static str = "__runtime.tool_filter_state"

Source§

const MERGE: MergeStrategy = MergeStrategy::Commutative

Source§

type Value = ToolFilterStateValue

Source§

type Update = ToolFilterStateAction

Source§

impl StateKey for CompactionStateKey

Source§

const KEY: &'static str = "__context_compaction"

Source§

type Value = CompactionState

Source§

type Update = CompactionAction

Source§

impl StateKey for BackgroundTaskViewKey

Source§

const KEY: &'static str = "background_tasks"

Source§

type Value = BackgroundTaskView

Source§

type Update = BackgroundTaskViewAction

Source§

impl StateKey for ActiveAgentKey

Source§

const KEY: &'static str = "agent_handoff"

Source§

type Value = HandoffState

Source§

type Update = HandoffAction

Source§

impl StateKey for StopConditionStatsKey

Source§

const KEY: &'static str = "__runtime.stop_condition_stats"

Source§

type Value = StopConditionStatsState

Source§

type Update = StopConditionStatsState

Source§

impl StateKey for ActiveAgentIdKey

Source§

const KEY: &'static str = "__runtime.active_agent"

Source§

type Value = Option<String>

Source§

type Update = Option<String>

Source§

impl StateKey for FailedScheduledActions

Source§

const KEY: &'static str = "__runtime.failed_scheduled_actions"

Source§

type Value = Vec<FailedScheduledAction>

Source§

type Update = FailedScheduledActionUpdate

Source§

impl StateKey for PendingScheduledActions

Source§

const KEY: &'static str = "__runtime.pending_scheduled_actions"

Source§

type Value = Vec<ScheduledActionEnvelope>

Source§

type Update = ScheduledActionQueueUpdate