Agent Harness Tutorial · Tech stack
L7 · Policy enforcement
Guardrails on the way in and on the way out. Family: Control · one turn, in order.
Why our choiceWe own every position and every rule; every check that protects money is ours. Vendors supply detectors behind one port, switched on by one YAML line.
| Option | Where from | Verdict | Why |
|---|---|---|---|
| Our positioned rules | ours | ✓ chosen | enforce() + evaluators.yaml, 30 checks |
| Content Safety via APIM | ours | ✓ chosen | prompt and answer |
| APIM allow-list + rate limit | ours | ✓ chosen | 30 calls a minute |
| AI Content Safety | Azure | ✓ used | Prompt Shields + harm, fails open |
| Prompt Shields on tool results | Azure | ◐ planned | F-124 |
| APIM llm-content-safety policy | Azure | ✗ dropped | two send-requests instead |
| Groundedness detection | Azure | ◐ planned | phase 2 |
| Llama Prompt Guard 2 | open source | ◐ planned | small classifier, F-132 |
| Presidio + spaCy | open source | · considered | to decide |
| LLM Guard | open source | ✗ dropped | mostly dropped |
| Llama Guard | open source | ✗ dropped | an LLM, too slow |
| NeMo Guardrails | open source | ✗ dropped | wants to own the loop |
| Guardrails AI | open source | ✗ dropped | overlaps LLM Guard |
How it works inside the harness: Checks.
Compared: Who provides each guardrail check?
| Option | From | Verdict | Kind | Where it runs | What it catches | Why |
|---|---|---|---|---|---|---|
| Our rules (harness + agent) | ours | chosen | rules in code | every position, before to reply | 30 checks, all built | every check that protects money |
| Azure Content Safety (via APIM) | Azure | chosen | service | gateway: prompt and reply | Prompt Shields, harm categories | allow-list, rate limit, harms |
| Llama Prompt Guard 2 | open source | to build | small classifier model | pre_model and tool results | prompt injection | fast; covers tool results (F-132) |
| Presidio | open source | to decide | classic ML (spaCy) | before the model | personal data to mask | the model may need identifiers |
| LLM Guard | open source | rejected | scanner library | not placed | invisible text, secrets, topics | normalised() and router cover it |
| Llama Guard | open source | rejected | LLM safety classifier | not placed | harmful content | too slow for every turn |
| NeMo Guardrails | open source | rejected | dialogue rails framework | not placed | topic and dialogue rails | wants to own the loop |
| Guardrails AI | open source | rejected | validator framework | not placed | output validators | overlaps LLM Guard |
DecisionOur own positioned rules make every check that protects money, and Azure Content Safety at the gateway adds Prompt Shields and harm screening. Prompt Guard 2 is the next addition for tool results; LLM Guard's Language scanner comes in only if we add Hindi replies.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
positions: # Inline, before the model is paid for: a fail ends the turn with the safe # reply, the refusal the loop already gives at PRE_MODEL (A11). pre_model: - {use: no_known_injection, on_fail: safe_reply} # Inline, on each tool result before it enters context: the result still goes # in, fenced as data like every result; any write later in the same run is # refused until the policyholder confirms it in a message of their own (A11). post_tool: - {use: no_instructions_in_result, on_fail: hold_writes} # Inline, before the policyholder reads it: a fail is the safe reply. Each runs # on the model's reply; those that need nothing but the reply also run on every # route's (a template's), where there are no tool results to ground against. reply: - {use: no_unclaimed_effect, on_fail: safe_reply} - {use: no_promise_of_cover, on_fail: safe_reply} - {use: no_ungrounded_entity, on_fail: safe_reply} - {use: no_superseded_state, on_fail: safe_reply} - {use: no_superseded_claim_state, on_fail: safe_reply} - {use: no_pii_echo, on_fail: safe_reply} - {use: money_in_rupees, on_fail: safe_reply} # After the turn, on what the policyholder was actually sent: a fail is a finding. online:
// WHAT IT IS // Azure AI Content Safety: a service that scores text for hate, sexual, // violence and self-harm content (0-7 severity), and "Prompt Shields", which // looks for a user trying to override the model's instructions. // // WHICH CONCERN IT SERVES // The Azure-provided inline check of Phase 1 (PLAN.html, "Azure-provided // inline checks"): with Groq behind APIM there are no Foundry guardrails, so // APIM sends each prompt and each completion here (infra/policies/ // groq-api.xml) and refuses the call on a high score. Its verdicts are // logged for the guardrail_log plug-in (Tier 4). // // REGION // South India, not Central India: Content Safety's region table lists // southindia (content harms and prompt shields) and no other Indian region // (learn.microsoft.com/azure/ai-services/content-safety/region-availability, // updated 18 Sep 2026, read 9 Oct 2026). Text crosses to South India and back. // // AUTH // Keys disabled (disableLocalAuth): APIM calls it with its own managed // identity, which holds "Cognitive Services User" here. // // EXPECTED DEV COST // $0 on F0: 5,000 text records a month, 5 requests a second // (azure.microsoft.com/pricing/details/cognitive-services/content-safety and // the Content Safety overview's rate table, read 9 Oct 2026). Each model call // is two to three records (prompt shield, prompt, completion); past 5,000 a // month F0 refuses (429) and APIM's policy lets the call through unscreened, // flagged on the trace. Azure allows a limited number of free (F0) accounts // of a kind per subscription; if one exists already, provisioning fails here.