ovrule-lab
v0.2.2
Published
TypeScript SDK for Ovrule case-file classification, guardrails, and receipt verification.
Maintainers
Readme
Ovrule SDK
TypeScript client for Ovrule case-file classification, guardrails, and receipt verification.
Install
npm install ovrule-labOn the first successful classify() or guard() call in a process, the SDK prints the full Ovrule ASCII banner plus a permalink to the created case. Later successful audits print only the case permalink. Set OVRULE_QUIET=1 to suppress all SDK logs. You can also run npx ovrule-lab at any time to print the banner manually.
1. Simple classify
import { classify } from "ovrule-lab";
const receipt = await classify("Support agent wants to refund $5,000 without manager approval.");
console.log(receipt.decision);
console.log(receipt.summary);2. guard() around an agent tool call
import { guard } from "ovrule-lab";
const result = await guard({
scenario: "Finance agent wants to wire $18,000 to a new vendor after bank details changed.",
policyPack: "finance",
});
if (!result.allowed) {
console.error(result.decision, result.suggestedFixes);
throw new Error("Tool call blocked by Ovrule.");
}
await issueWireTransfer();3. LangChain middleware integration
import { OvruleClient } from "ovrule-lab";
const ovrule = new OvruleClient({ baseUrl: "https://your-ovrule-deployment.vercel.app" });
export async function beforeToolInvoke(input: string) {
const guard = await ovrule.guard({
scenario: input,
policyPack: "general",
});
if (!guard.allowed) {
return {
blocked: true,
receipt: guard.receipt,
fixes: guard.suggestedFixes,
};
}
return { blocked: false };
}API
classify(action, options?)guard(action, options?)verify(receipt, signature)
