ferrin-policy
Policy-based tool approval for Ferrin. A PolicyClient evaluates a policy
path with a JSON input and returns a decision document; policy_approval
turns the client into a ferrin_core::generate_text::ApprovalPolicy whose
decisions (allow, deny, requires-approval, not-applicable) become
tool approval statuses, and capability_middleware restricts the tools
offered to the model through the same client. HttpPolicyClient speaks the
OPA REST Data API; RegoPolicyClient (feature rego) evaluates Rego
policies in-process with regorus.
Part of the Ferrin workspace. Design:
docs/01-architecture/18-policy-approval.md, ADR 0020.
Example
use HttpPolicyClient;
use policy_approval;
use UrlPolicy;
The policy receives { "tool": { "name", "tool_call_id", .. }, "input", "messages", "tools_context" } and answers with
{ "decision": "allow" | "deny" | "requires-approval" | "not-applicable", "reason"? },
a legacy { "allow": bool } or a bare boolean. A null result (an undefined
rule) is not applicable and falls through to the tool's own needs_approval;
evaluation errors deny the call unless FailureMode::FallThrough is chosen.
Features
| Feature | Default | Effect |
|---|---|---|
rego |
off | RegoPolicyClient: in-process Rego evaluation with regorus |