Harness

Guards API

Signatures, options and defaults of every built-in guard in TypeScript, Python and Ruby.

TypeScript: import { guards } from "@scute/harness". Python: from scute.harness import guards. Ruby: Scute::Guards.

Signatures#

GuardTypeScriptPythonRuby
Permissionsguards.permissions({ mode, fileRequests, context })guards.permissions(mode, file_requests, context)Scute::Guards.permissions(mode:, file_requests:, context:)
Verify the personguards.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:)
Approvalguards.approval({ when, message, mode })guards.approval(when, message, mode)Scute::Guards.approval(when:, message:, mode:)
Requester onlyguards.requesterOnly({ arg, when, mode })guards.requester_only(arg, when, mode)Scute::Guards.requester_only(arg:, when:, mode:)
Groundingguards.grounding({ args, minLength, requireTranscript, when, mode })guards.grounding(args, min_length, when, mode)Scute::Guards.grounding(args:, min_length:, when:, mode:)
Argsguards.args(rules, { mode })guards.args(rules, mode)Scute::Guards.args(rules, mode:)
Budgetguards.budget({ calls, perHour, usdPerRun, mode })guards.budget(calls, per_hour, usd_per_run, mode)Scute::Guards.budget(calls:, per_hour:, usd_per_run:, mode:)
Contentguards.content({ pii, secrets, injection, providers, mode })guards.content(pii, secrets, injection, providers, mode)Scute::Guards.content(pii:, secrets:, injection:, providers:, mode:)
Decoyguards.decoy(tools, { report })-Scute::Guards.decoy(tools, report:, mode:)
Customguards.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#

GuardOptionDefault
AllmodeThe harness mode (enforce unless set)
permissionsfileRequeststrue
verifyPersonwhenEvery call
verifyPersonmaxAge900 seconds
verifyPersonmessageThe person has to verify it's them before this.
approvalwhentier: "high"
requesterOnlyargemail
groundingargsAutomatic: id-like, email, phone, amount, account, number and IBAN keys, plus email- and phone-shaped values
groundingminLength3
groundingrequireTranscriptfalse
budgetevery limitNot enforced
contentpiiNone
contentsecretstrue
contentinjectionblock
decoyreporttrue

when#

verifyPerson, approval, requesterOnly and grounding take when:

FormMatches
{ 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 booleanYour own test

Reasons#

The reason codes built-in guards set, for logs and tests:

ReasonGuardDecision
Engine reason (outside_task, budget_exceeded, ...)permissionsper engine answer
verification_requiredverifyPersonverify
confirmation_requiredapprovalapprove
requester_unknown, not_requesterrequesterOnlydeny
ungroundedgroundingguide
no_transcriptgroundingproceed, or deny with requireTranscript
invalid_argsargsguide
budget_exhaustedbudgetdeny
secret_in_args, content_blocked, injectioncontentdeny
redacted, injection_flaggedcontenttransform (after)
decoy_calleddecoydeny
guard_errorany guard that throwsdeny
invalid_decisionany guard with an unknown answer (TypeScript)deny