Skip to Content
Recodocs

An HR policy desk is only as safe as what the model cannot choose

The model picks which policy to read. The request fixes who is asking, a sensor checks every paragraph an answer that is not a refusal cites, and the hr_cases row waits for approval; the run's profile row is written when the run starts.

7 min read

Policy answers depend on who the employee is and which rules apply at the time of the question. A relevant-looking document may not be in force for that employee. The case tests the evidence boundary, rather than the model's general HR knowledge.

In the pilot's scripted test, a UK engineer asks what the India parental addendum says. The stand-in calls read on that document, and the tool returns a hidden stub that it is not in force for this employee on 29 October 2026. After that scripted read, the stand-in always returns the canned refusal, and the test asserts the hidden payload and refused true.

In a second test the engineer asks the desk to open an HR case about a leave dispute. The scripted model calls open_hr_case, and the run stops at awaiting_approval. hr_cases has zero rows until the approve route runs; the same database already holds the run profile.

The claim is that an HR policy desk is trustworthy only when the request, not the model, fixes who is asking, a host check decides which paragraphs an answer that is not a refusal may cite, and a human gate stands in front of the one write. A stronger model reads better. It does not earn those three decisions. Northwind Analytics is fictional and the policies are synthetic.

The argument

  1. Identity is request state. Country, group and as-of date arrive in the request. Tools filter by them in code, so an out-of-scope document comes back as hidden, not as text.
  2. The model chooses among four tools. It locates, expands, reads, or asks to open a case. It cannot change the profile.
  3. A citation is membership in a set. For an answer that is not a refusal, an id counts only if a tool returned it during the run.
  4. The one write is parked. open_hr_case needs approval, and hr_cases gains no row until then; run_profiles is already written.

Who is allowed to decide

The model is told who is asking, but the tools filter by the profile in code, so telling it is not what enforces the rule. A model that has read the India addendum could paraphrase it to a UK employee. The tools withhold out-of-scope paragraph text and return a hidden stub; that does not stop a paraphrase of text the model already has.

What the HTTP run may changeAn employee profile arrives on POST /v1/agent/runs. Inside the dashed process, Harness governs a native PydanticAI Agent that may call locate, expand, read or open_hr_case. Evidence tools filter by profile in code. verify_output keeps only paragraph ids tools returned. open_hr_case stops for approval before cases.sqlite gains a row.Employee askUK engineeringProfile in JSON body.Model cannot edit it.Stopped hereopen_hr_caseawaiting_approval.This processAgent runTrusted profilecountry, group, as_ofHarnessrun, approve, resumePydanticAI Agenttool choice per turnverify_outputparagraph ids in seenEvidencepolicies + graphlocate / expand / read.Profile filters in code.Casescases.sqliteWritten after approve.messageanswerrepairtoolsseen

Caption: profile and citations stay host-owned; the Agent only picks among registered tools.

On the left, the employee's question arrives with a profile in the JSON body, and the figure marks it as something the model cannot edit. Inside the dashed process the figure draws Trusted profile, Harness, PydanticAI Agent and verify_output; locate, expand and read are on the outside Evidence card. Documents that are out of scope, not yet effective, drafts or superseded are not returned. The orange card marks open_hr_case at awaiting_approval. The Cases card says the file is written after approve; in the service, hr_cases is inserted on approve, and the profile row is already in that file.

Note what is trusted. The service does not verify the profile. It takes it from the request, which the README describes as coming from the trusted HR system, and the demo's one bearer token both asks and approves. A real deployment must replace that with reviewer authentication. The boundary here is between the model and the request, not between the request and the world.

The model-driven decision loop is the one agent; the wiki compile script still makes structured model calls inside a deterministic workflow, and the ticket runner is a plain HTTP client. It is built with exactly four tools. Each tool has a policy: the three readers carry no effect and no approval. A tool without a policy is hidden from the model. Memory tools are switched off, so the helpdesk keeps no cross-conversation memory. A test pins this: the model was offered precisely locate, expand, read and open_hr_case, and only the last carries effect and approval.

What the evidence shows

Two kinds of evidence sit side by side and should not be blended. Five scripted tests exercise the guards with a fake model. The live ticket run and a separate end-to-end check used a real model; neither completes approve-then-resume. The guards come first.

From proposed ids to verify_outputTool results add paragraph ids to deps.seen via collect_ids. verify_output drops ids no tool returned and ids that are not paragraphs. A repair prompt sends the model back inside the Harness limit.HelpdeskAnswerValue: 10 daysLEAVE…#s1.p1FAKE#s1deps.seenLEAVE…#s1.p1from read()FAKE not in setparagraph_indexvalid paragraphsection id failsVerificationrepairablecheck: citationsModelRetry pathDraftids proposedseentool returnsCorpusparagraph onlySensorHarness repairUncited ids trigger feedback; UNREAD in tests ends refused after repair.

Caption: verify_output is the citation gate; the model does not own deps.seen.

The figure follows a model's proposed answer to the check. The answer carries ids, say LEAVE…#s1.p1 and a made-up FAKE#s1. Values under id, section and cites that a tool result puts in front of the model go into a set called seen, and a hidden tool result adds none. When the answer is not refused, the sensor keeps an id only if it is in that set and in the paragraph index; a refusal is accepted without that check. The made-up id fails the first test. A section id fails the second. Either sends the model back with a repair message inside the run's limit. In the scripted test, the stand-in cites LEAVE-BEREAVEMENT-V1#s1.p1 without any tool having returned it, gets the message "not returned by any tool", and after repair refuses with no ids. The sensor is code reading the run's own record. A paragraph in a prompt asking for honest citations could not do this.

open_hr_case before cases.sqliteToolPolicyeffect + approvalDeferredToolRequestsrun pausesPOST …/approveBearer tokenopen_casehr_cases rowtest_effect_tool_awaits_approval: count() is 0 until approve; then 1.

Caption: the only effect tool waits for POST /v1/agent/runs/{run_id}/approve.

The last figure shows the write. The scripted model calls open_hr_case, the call parks, and count() reads zero. A test then posts the approval and the run resumes. The count reads one. The approval-gated tool did not execute until the reviewer approved.

The live run is real but narrow. On 29 October 2026 the ticket runner ran 44 tickets three times each on the synthetic corpus, with gpt-6-luna.

MeasureResult
Runs completed132 of 132
Accuracy, overall1.000
Superseded or out-of-scope values stated0
Gold paragraph cited0.992
Citation precision0.745
Median latency16.6 s

Gold paragraph cited is 0.992 and citation precision is 0.745, so cited ids are not only the gold paragraphs; median latency is a separate 16.6 s. For a non-refusal, the sensor accepts a cited id only when a tool returned it and it is a paragraph id; the tools filter which documents are in force. It does not guarantee that every citation was needed. That is a boundary worth knowing before you promise auditors "every answer is sourced". The README says this is one run on one synthetic corpus and not a general accuracy claim.

Two gaps are open. Approve-then-resume with a live model is unverified, because live runs proved only the pause before approval, and the resume is covered by the fake-model tests. And a rate limit from the model provider surfaced as an unhandled 500 or a reset connection, not a typed retryable error. That defect was found live and not fixed.

What would falsify the claim is a completed answer that is not a refusal citing an id no tool returned, or an hr_cases row before approval. The tests assert neither occurs.

The turn we scripted

The happy path in the pilot test stands in for a bereavement-leave question without live inference. The scripted model takes three steps. It calls locate with the terms bereavement and leave over sections. It reads the first section the locator returned. It then answers, citing the first paragraph id that the read returned. The answer text is canned in the script, so the number of days in it is not a policy fact. What the test establishes is the plumbing.

The request is an ordinary call to /v1/agent/runs with a bearer token and the UK engineering profile. The response says completed, refused is false, the answer starts with Value: , and every cited id belongs to the corpus's paragraphs. A request without an employee returns 422. That is validation the model never sees, and it is the cheapest form of the whole argument: if the profile is missing, the run does not start.

Read this turn as one observation of mechanism. It shows that locate, read, structured output and the citation sensor chain in a single run when the model behaves. It does not show that the model picks the right section for an ambiguous ticket. The live table above is the nearest thing to that evidence, and it carries the caveats already given.

The one check to copy

Copy the intersection, not the Northwind policy nouns. The sensor's core is two comprehensions:

stray = [i for i in output.ids if i not in deps.seen]
nonparagraph = [
    i for i in output.ids if i in deps.seen and i not in deps.evidence.paragraphs
]

deps.seen is filled by the tools, not by the model, and a refused answer skips the id check. Keep beside it the test that forces a citation no tool returned, test_verify_rejects_an_id_no_tool_returned, which asserts the repair message and the refusal that follows. For writes, keep test_effect_tool_awaits_approval_and_writes_no_case_first: it asserts awaiting_approval, zero rows, then exactly one row after the approve route.

The pattern ports to payroll, benefits or safety. Make the stable id of an evidence unit a paragraph, record the ids a tool result puts in front of the model, hidden nodes excluded, and accept only the intersection for any answer that is not a refusal. Put any write behind a policy that names approval. Neither check mentions HR.

Close

A people helpdesk is easy to describe as retrieval plus a chat box. The pilot describes something narrower. The model chose reads on a policy graph. The request decided which employee and date applied, the filter decided which documents were in force, the sensor decided which ids an answer that is not a refusal could cite, and a reviewer decided whether a case existed. A better model improves the reads and leaves the other four decisions where they were.

To extend it, add an effect only with a policy that names approval, and write the test before the prompt. The synthetic corpus is enough to prove the guards. It is not enough to promise that every live paraphrase stays inside them.

How is this page?

Last updated on