Skip to main content

policy

Rust AI Agent SDK Policy Module for PraisonAI Rust SDK. Provides policy engine for controlling agent behavior.

Example

use praisonai::policy::{PolicyEngine, PolicyRule, PolicyAction};

let mut engine = PolicyEngine::new();
engine.add_rule(PolicyRule::new("no-pii")
.pattern(r"\b\d{3}-\d{2}-\d{4}\b")
.action(PolicyAction::Block));

Import

use praisonai::policy::*;

Classes

PolicyResult

Result of a policy check.

PolicyRule

A policy rule.

PolicyEngine

Engine for evaluating policies.

PolicyAction

Action to take when a policy is triggered.

Functions

ssn_rule()

Create a rule to block PII (Social Security Numbers).

credit_card_rule()

Create a rule to block credit card numbers.

email_rule()

Create a rule to block email addresses.

phone_rule()

Create a rule to block phone numbers.

profanity_rule()

Create a rule to block profanity.

Rust Policy

Rust Security