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

Agent Harness Tutorial · End to end · Zoom level 3

How we take care of it: policyholder_asked

policyholder_asked catches a write Rohan never asked for.

Open: 11before loopopen ›Open: 22before modelopen ›Open: 33after modelopen ›Open: 44before toolopen ›Open: 55the toolopen ›Open: 66after toolopen ›Open: 77after loopopen ›Open: 88before replyopen ›It readsthe tool the model wants, and theconsent list from check point 1policyholder_askedrule · agentpassCarries onfailIf it failscall refused; model told whyWHERE IN THE CODE: F policy/__init__.py:228-243
The strip at the top shows every check point where this check runs, in dark.

How we took care of it.

  1. Reads always pass.
  2. A write runs only if consent holds tool:that-record or tool:*.
  3. If not, the call doesn't run. The model is told: ask Rohan, and don't say it has been done.
  4. The action is saved as "awaiting", so Rohan's "yes" next turn grants it.
It readsthe tool the model wants, and the consent list from check point 1
Kindrule
Provided byagent
If it failscall refused; model told why
Where in the codeF policy/__init__.py:228-243
Runs at4 · Before the tool
Real exampleFlow 13: a planted note made the model ask for request_payout; refused. Flow 11: withdraw needed a "yes" first.

More on this: 13 · Injection hidden in a claim note.

How it is done: the real code

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

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",
    )