OpenAgentID documentation
Source referencesRust module referenceopenagent-skills-policy

openagent-skills-policy · policy

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

Source: openagent-sdk/crates/openagent-skills-policy/rust/src/policy.rs. SHA-256: 68313deafe836186c7c6805a142260bdd81f9f350dc30c0b1c4d900e29eaab6f.

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.

policy::MAX_SKILL_RULES

Maximum number of skill rules in a single policy document.

Mirrors Arsenal's MAX_RULES_PER_POLICY to keep the two in lockstep.

pub const MAX_SKILL_RULES: usize;

Source line: 21.

policy::CURRENT_VERSION

Current policy schema version.

pub const CURRENT_VERSION: u32;

Source line: 24.

policy::AuditLevel

How much detail to record for each invocation.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum AuditLevel {
    /// No audit event produced.
    None,
    /// Record only the skill name, DID, and a hash of the arguments.
    #[default]
    Hash,
    /// Record the full arguments JSON in the receipt.
    Full,
}

Source line: 29.

policy::RateLimit

A rate limit for a single skill.

The window is expressed as a human-friendly string (1s, 30m, 1h, 24h) which the engine parses at load time.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RateLimit {
/// Window length as a string (parsed to seconds at load time).

pub window: String,
/// Maximum invocations allowed within a single window.

pub max: u64
}

Source line: 44.

policy::TimeWindow

A time window during which a skill may be invoked.

Hours are interpreted in UTC. start_hour may be greater than end_hour to express an overnight window (e.g. 22..6).

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TimeWindow {
/// Inclusive start hour in UTC (0..=23).

pub start_hour: u8,
/// Exclusive end hour in UTC (0..=24). 24 means midnight.

pub end_hour: u8,
/// Optional weekday filter (0=Sunday..6=Saturday). Empty = all days.

#[serde(default)]
pub weekdays: Vec<u8>
}

Source line: 56.

policy::SkillRule

Per-skill policy rule.

Every field is optional; the engine applies only what is present.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SkillRule {
/// Whether the agent may invoke this skill at all.

///

/// Defaults to `true` when the skill appears in the policy map. Use

/// `allow: false` to explicitly deny while still documenting the rule.

#[serde(default = "default_allow")]
pub allow: bool,
/// Rate limit applied to this skill.

#[serde(default, skip_serializing_if = "Option::is_none")]
pub rate_limit: Option<RateLimit>,
/// JSON Schema that invocation arguments must satisfy.

///

/// Stored as a raw `serde_json::Value` to avoid premature compilation;

/// the engine compiles and caches it at load time.

#[serde(default, skip_serializing_if = "Option::is_none")]
pub arg_constraints: Option<serde_json::Value>,
/// Time windows during which the skill may be invoked. Empty = always.

#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub time_windows: Vec<TimeWindow>,
/// If `true`, the caller must supply a consent token alongside the

/// invocation context.

#[serde(default)]
pub require_consent: bool,
/// How much invocation detail to record in the audit chain.

#[serde(default)]
pub audit_level: AuditLevel
}

Source line: 70.

policy::DefaultRule

Default rule applied when a skill has no per-skill entry.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DefaultRule {
/// Whether unknown skills are allowed by default.

#[serde(default)]
pub allow: bool,
/// Default audit level for unknown skills.

#[serde(default)]
pub audit_level: AuditLevel
}

Source line: 122.

policy::SkillsPolicyDoc

A skills policy document, as loaded from YAML.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SkillsPolicyDoc {
/// Schema version. Must equal [`CURRENT_VERSION`].

pub version: u32,
/// DID of the agent this policy applies to.

pub agent: Did,
/// Per-skill rules keyed by skill name.

#[serde(default)]
pub skills: BTreeMap<String, SkillRule>,
/// Default rule applied when a skill has no entry in `skills`.

#[serde(default)]
pub default: DefaultRule,
/// Optional human-friendly description.

#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>
}

Source line: 142.

On this page