car-policy 0.15.2

Policy engine for Common Agent Runtime
Documentation
# car-policy

Declarative policy engine for the [Common Agent Runtime](https://github.com/Parslee-ai/car).

## What it does

Evaluates actions against registered policy rules before execution. Policies are closures
that inspect the action and current state, returning a violation reason or passing. Panicking
policies are caught and treated as violations. This is the enforcement layer for agent guardrails.

## Usage

```rust
use car_policy::PolicyEngine;

let mut engine = PolicyEngine::new();
engine.register("no_rm", Box::new(|action, _state| {
    if action.tool.as_deref() == Some("shell_exec") {
        Some("shell execution is forbidden".into())
    } else {
        None
    }
}), "Block shell execution");

let violations = engine.check(&action, &state);
```

Part of [CAR](https://github.com/Parslee-ai/car) -- see the main repo for full documentation.