TypeScript: import { guards } from "@scute/harness". Python: from scute.harness import guards. Ruby: Scute::Guards.
Signatures#
| Guard | TypeScript | Python | Ruby |
|---|---|---|---|
| Permissions | guards.permissions({ mode, fileRequests, context }) | guards.permissions(mode, file_requests, context) | Scute::Guards.permissions(mode:, file_requests:, context:) |
| Verify the person | guards.verifyPerson({ when, methods, maxAge, message, mode }) | guards.verify_person(when, methods, max_age, message, mode) | Scute::Guards.verify_person(when:, methods:, max_age:, message:, mode:) |
| Approval | guards.approval({ when, message, mode }) | guards.approval(when, message, mode) | Scute::Guards.approval(when:, message:, mode:) |
| Requester only | guards.requesterOnly({ arg, when, mode }) | guards.requester_only(arg, when, mode) | Scute::Guards.requester_only(arg:, when:, mode:) |
| Grounding | guards.grounding({ args, minLength, requireTranscript, when, mode }) | guards.grounding(args, min_length, when, mode) | Scute::Guards.grounding(args:, min_length:, when:, mode:) |
| Args | guards.args(rules, { mode }) | guards.args(rules, mode) | Scute::Guards.args(rules, mode:) |
| Budget | guards.budget({ calls, perHour, usdPerRun, mode }) | guards.budget(calls, per_hour, usd_per_run, mode) | Scute::Guards.budget(calls:, per_hour:, usd_per_run:, mode:) |
| Content | guards.content({ pii, secrets, injection, providers, mode }) | guards.content(pii, secrets, injection, providers, mode) | Scute::Guards.content(pii:, secrets:, injection:, providers:, mode:) |
| Decoy | guards.decoy(tools, { report }) | - | Scute::Guards.decoy(tools, report:, mode:) |
| Custom | guards.define(name, before, { mode, after }) | guards.define(name, before, *, after, mode) | Scute::Guards.define(name, mode:, after:) { |call| } |
Every option is optional except rules (args), tools (decoy) and name (define).
Defaults#
| Guard | Option | Default |
|---|---|---|
| All | mode | The harness mode (enforce unless set) |
| permissions | fileRequests | true |
| verifyPerson | when | Every call |
| verifyPerson | maxAge | 900 seconds |
| verifyPerson | message | The person has to verify it's them before this. |
| approval | when | tier: "high" |
| requesterOnly | arg | |
| grounding | args | Automatic: id-like, email, phone, amount, account, number and IBAN keys, plus email- and phone-shaped values |
| grounding | minLength | 3 |
| grounding | requireTranscript | false |
| budget | every limit | Not enforced |
| content | pii | None |
| content | secrets | true |
| content | injection | block |
| decoy | report | true |
when#
verifyPerson, approval, requesterOnly and grounding take when:
| Form | Matches |
|---|---|
| { tier: "high" } or { tier: ["medium", "high"] } | Calls to tools of those tiers |
| { tools: ["refund_invoice"] } | Calls to those tools |
| { tier, tools } | Both must match |
| A function of the call returning a boolean | Your own test |
Reasons#
The reason codes built-in guards set, for logs and tests:
| Reason | Guard | Decision |
|---|---|---|
| Engine reason (outside_task, budget_exceeded, ...) | permissions | per engine answer |
| verification_required | verifyPerson | verify |
| confirmation_required | approval | approve |
| requester_unknown, not_requester | requesterOnly | deny |
| ungrounded | grounding | guide |
| no_transcript | grounding | proceed, or deny with requireTranscript |
| invalid_args | args | guide |
| budget_exhausted | budget | deny |
| secret_in_args, content_blocked, injection | content | deny |
| redacted, injection_flagged | content | transform (after) |
| decoy_called | decoy | deny |
| guard_error | any guard that throws | deny |
| invalid_decision | any guard with an unknown answer (TypeScript) | deny |