cleandataengineering.aiAgent Harness, drawn simply
You are here: End to end › Checks › 4 · Before the tool

Agent Harness Tutorial · End to end · Zoom level 2

Check point 4: Before the tool

The model has asked for a tool. Is this something Rohan actually asked for, and is it safe right now?

Where: for every tool call the model asks for.

The strip at the top is the whole turn; the dark box is where you are. Click a check, or what it catches, to see how we took care of it. Dashed boxes are not built yet.
CheckCatchesKindProvided byIf it fails
policyholder_askeda write Rohan never asked forruleagentcall refused, model told why
hold writesany write after a result that carried instructionsruleharnesscall refused
tool-call budgetmore than 8 a trip, 24 a turnruleharnessstop the turn
freshnessan irreversible write against a stale rowruleharnessre-read the row first
approval gatea payout over ₹25,000workflowharness + DBOSwait for a person

This is where a fooled model is stopped. In a real attack test, a note planted in a claim told the model to call request_payout, and it did ask. policyholder_asked refused, because Rohan never asked for a payout, and the model was told: "the policyholder has not asked for request payout on CLM-019900. Ask them whether they want it, and do not say it has been done". The approval gate is drawn on the approval flow.

How it is done: the real code

Cut from the live repositories each time the site is built, so it always matches what runs.

claims_fnol/policy/__init__.py:228The rule that stops a fooled model
def policyholder_asked(ctx: Context) -> Verdict:
    """P-OWN-WORDS, AHC-0116: an action runs only on a record the policyholder's
    own words asked for it on — read from what they said, never from a tool's
    result, so an instruction planted in a claim note moves nothing."""
    if ctx.position is not Position.PRE_TOOL or ctx.tool_name not in CONSENTED_TOOLS:
        return ALLOW
    record = ctx.arguments.get("id") or ctx.arguments.get("claim_id")
    consented = ctx.identity.consented
    if f"{ctx.tool_name}:{record}" in consented or f"{ctx.tool_name}:{ANY_POLICY}" in consented:
        return ALLOW
    action = ctx.tool_name.replace("_", " ")
    return block(
        "policyholder-asked",
        f"the policyholder has not asked for {action} on {record}. Ask them whether they"
        " want it, and do not say it has been done",
    )

Look inside