Skip to content

Agent guardrails and human-in-the-loop

Permissions, validation and approval gates that keep autonomous systems inside safe boundaries.

7 MIN READUPDATED 2026-11-18Agents & agentic AI
ORIGINAL DIAGRAM · AGENT LOOPPLANnext stepTOOL CALLtyped inputOBSERVEresultVERIFYcheckGOALinstruction

Original agent diagram — not a copied image

§ 01Key concepts
GuardrailA rule that constrains inputs, tool calls or outputs before they take effect.
Approval gateA step where a person must confirm a high-impact action.
Least privilegeGranting an agent only the tools and data it needs for its task.
§ 02When to use
  • Agents can write to external systems.
  • Mistakes are expensive or hard to reverse.
  • Regulated or audited environments.
§ 03How it works
  1. 01Classify tools by impact: read, write, irreversible.
  2. 02Validate tool arguments against a strict schema before execution.
  3. 03Require approval for write or irreversible actions.
  4. 04Log the decision, approver and outcome for replay.
§ 04Use cases & scenarios

Order agent with a read/write split

Context
An assistant can look up orders and cancel them.
Problem
Giving every action the same permission level risks unauthorized cancellations.
Approach
Allow lookups automatically and require approval for cancellation; deny everything else by default.
Outcome
Useful automation with a hard boundary around writes.

Refund above the approval limit

Context
An agent receives a refund request for a large amount.
Problem
The request is valid in shape but exceeds the agent's spending authority.
Approach
Validate amount and caller scopes server-side before calling the payment service.
Outcome
The request is rejected or escalated instead of being paid out.
§ 05Examples

Tool risk tiers for an order agent

yaml
read:
  lookup_order: auto
write:
  cancel_order: approval_required
irreversible:
  issue_refund: approval_required + dual_control
default: deny

Deny by default and only gate high-impact tools — gating every read creates approval fatigue.

Server-side validation before a refund

python
def issue_refund(args, caller):
    if not ORDER_ID.match(args["order_id"]): raise Invalid()
    if args["amount"] > 5000 and "finance" not in caller.scopes: raise Forbidden()
    return payments.refund(idempotency_key=args["key"], **args)

Validate schema, limits and scopes in code. A prompt instruction is not a security boundary.

§ 06Trade-offs

Strict approvals

Up: Strong control and audit

Down: Slower, higher human workload

Automatic execution

Up: Fast and scalable

Down: Requires excellent validation and rollback

Output filters

Up: Catch unsafe content

Down: False positives can block valid work

§ 07Implementation checklist
  • Deny by default; allow tools explicitly per agent.
  • Validate arguments server-side, not only in the prompt.
  • Make approval requests show the exact action and payload.
  • Log every override and failed validation.
§ 08Configuration reference
KeyTypical valueNote
approval_required_forwrite actionsExplicit tool list.
validationstrict schemaReject unknown fields.
audit_retentionpolicy-drivenKeep records for replay.
§ 09Troubleshooting
SymptomCauseFix
Agent exceeds its scopeBroad tool permissionsSplit tools into read/write and scope per role.
Approval fatigueToo many low-risk gatesOnly gate irreversible or high-impact actions.
§ 10Frequently asked questions

Where should guardrails live?

In your application and tool layer, not only in the prompt. Prompts can be bypassed; server-side validation cannot.

When is full autonomy acceptable?

For reversible, low-impact actions with measurable success criteria and automatic rollback.

More in Agents & agentic AI