OpenAgentID documentation
Source referencesRust module referenceopenagent-skills-policy

openagent-skills-policy · rate

Declared module signatures, types, configuration, and source documentation.

Source: openagent-sdk/crates/openagent-skills-policy/rust/src/rate.rs. SHA-256: 97137171669e3ce11ad4761853f56ec30c9fcc38fcf99bee9d72ca15ed80b8a3.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

rate::RateLimiter

In-memory GCRA rate limiter keyed by skill name.

#[derive(Debug, Default)]
pub struct RateLimiter {

}

Source line: 23.

rate::RateLimitDecision

Result of consulting the rate limiter.

#[derive(Debug, Clone, Copy, PartialEq)]
pub enum RateLimitDecision {
    /// The invocation is allowed; TAT has been advanced.
    Allowed,
    /// The invocation is denied. Contains the number of *conceptual*
    /// invocations already consumed in the window.
    Denied {
        /// How many are currently considered used in the window.
        used: u64,
    },
}

Source line: 30.

rate::RateLimiter::new

Create a fresh limiter with no state.

#[must_use]
pub fn new() -> Self;

Source line: 44.

rate::RateLimiter::used

Peek at the number of theoretical invocations currently in use for skill, for observability/debugging.

#[must_use]
pub fn used(&self, skill: &str, limit: &RateLimit, now: OffsetDateTime) -> u64;

Source line: 72.

rate::RateLimiter::reset

Remove any stored state for the given skill.

pub fn reset(&mut self, skill: &str);

Source line: 92.

rate::RateLimiter::snapshot

Snapshot the current TATs — useful for persisting state.

#[must_use]
pub fn snapshot(&self) -> Vec<(String, f64)>;

Source line: 98.

On this page