Skip to content

Recipes

Check an answer against a policy

Flag unsupported statements before a draft reply reaches the customer.

Start with a short explicit rule

Install the SDK and set NULLPROTOCOL_KEY as in the quickstart. Create an agent with ID policy-reviewer and instructions: “Compare the draft with the supplied policy. Identify contradictions and missing information. Do not invent exceptions.”

Validate the draft

policy.py
from nullprotocol import NullProtocol

with NullProtocol() as client:
    agent = client.load("policy-reviewer")
    result = agent.validate(
        "The draft must agree with the policy. Flag unsupported promises.",
        "We will refund your gift card in full.",
        reference="Unused goods may be returned within 30 days. Gift cards are not refundable.",
    )
    if not result.success:
        raise RuntimeError(result.error)
    if result.recommendation != "pass":
        print("Needs review:", result.reasoning)
    else:
        print("Passed the model review; apply application checks next.")

Treat it as a review signal

For the supplied rule, the draft contradicts the gift-card exception. Inspect the recommendation and reasoning, then try a supported statement and a statement the policy does not answer.

This is a reasoning task, even when the policy is short. Test the selected model on your real examples. Keep hard eligibility checks and financial decisions in code; a model recommendation does not authorize a refund.