Guardrails: Sandboxing, Approval Gates, and Human-in-the-Loop

9 min read Module 7 of 9 Topic 20 of 25

What you'll learn

  • Combine terminal-backend isolation with explicit approval gates for defense in depth
  • Configure actions that require human confirmation before executing
  • Design approval policies that scale with deployment trust level
  • Recognize which categories of action almost always warrant a human in the loop
Building this at your company? For enterprise and company teams taking this to production: book a 30-minute session with our AI engineers for architecture guidance, code review, and a rollout plan for your use case.
Book a Team Session

Defense in Depth, Not a Single Layer

Lesson 19 shrank what’s possible by curating toolsets and skills down to what a deployment actually needs. This lesson is about the actions you do choose to enable: sandboxing where they run, and gating the riskiest ones behind explicit approval, so a capability being available isn’t the same as it executing unsupervised.

flowchart TB
    REQ["Model requests\na tool call"] --> CHECK1{"Is this toolset\nenabled at all?\n(Lesson 19)"}
    CHECK1 -->|no| BLOCKED["Blocked: never\nreaches execution"]
    CHECK1 -->|yes| CHECK2{"Does this action\nrequire approval?"}
    CHECK2 -->|yes| GATE["Human confirmation\nrequired"]
    CHECK2 -->|no| SANDBOX["Executes inside the\nconfigured terminal\nbackend, Module 5"]
    GATE -->|approved| SANDBOX
    GATE -->|denied| BLOCKED

    style REQ fill:#EEF0F7,stroke:#6366F1,color:#0F172A
    style CHECK1 fill:#EEF0F7,stroke:#6366F1,color:#0F172A
    style CHECK2 fill:#EEF0F7,stroke:#6366F1,color:#0F172A
    style BLOCKED fill:#fee2e2,stroke:#ef4444,color:#0F172A
    style GATE fill:#fff7ed,stroke:#f59e0b,color:#0F172A
    style SANDBOX fill:#f0fdf9,stroke:#0D9488,color:#0F172A

Layer 1: Sandboxing (Where It Runs)

You already configured this in Module 5. Revisit it here as a safety decision, not just a deployment one: the Docker or serverless (Daytona/Modal) terminal backends contain the blast radius of a shell command gone wrong to an isolated environment, rather than your host machine. For any deployment reachable by more than just you (Module 6), running local as the terminal backend means a mistake or a successfully-manipulated agent has your full local user permissions to work with.

terminal:
  backend: "docker"   # isolates execution from your host, per Module 5

Layer 2: Approval Gates (What Requires Confirmation)

For actions that are hard to undo, configure explicit human confirmation before execution:

# ~/.hermes/config.yaml
agent:
  require_approval:
    - tool: "send_email"
    - tool: "execute_shell"
      match: "rm -rf*"          # pattern-match specific dangerous invocations
    - tool: "*"
      when: "platform == 'discord-public'"   # gate everything on a low-trust surface

In an interactive session, this surfaces as a confirmation prompt before the action runs:

Hermes wants to run:
  rm -rf ./build

Approve? [y/N]

Layer 3: Human-in-the-Loop for Unattended Contexts

Here’s the tension worth naming directly: approval gates assume someone is present to respond. A cron job (Lesson 17) running every 15 minutes with nobody watching cannot meaningfully wait on a y/N prompt. For unattended contexts, the real guardrail has to live upstream, in Lesson 19’s curation, not in a gate that will just hang or auto-deny.

cron:
  - name: "error-rate-alert"
    schedule: "*/15 * * * *"
    prompt: "Check the error dashboard; report if error rate exceeds 2%"
    # This job's toolset is scoped to read-only monitoring tools.
    # It structurally cannot reach an approval-gated action,
    # because it was never given the tools that would trigger one.
    platform_toolsets:
      cli: ["web_search"]

The design principle: for interactive, human-present surfaces, use approval gates for risky actions. For unattended surfaces, use tight toolset curation so the job never needs to ask.

Which Actions Almost Always Deserve a Gate

A practical heuristic, regardless of how trusted the surface otherwise is:

CategoryExampleWhy it deserves a gate
Externally visibleSending an email, posting a message, making an API call a third party seesA mistaken send is attributed to you and often can’t be un-sent
FinancialMaking a payment, changing a subscriptionDirect, sometimes irreversible cost
DestructiveDeleting files, dropping a database, force-pushingOften unrecoverable without a backup
Read-only lookupsSearching the web, reading a dashboardLow stakes: a bad read is cheap to notice and correct

The asymmetry is the point: a wrong search result costs you a moment of confusion. A wrongly sent email or deleted file may cost you something you cannot get back. Gate the second category even on surfaces you otherwise trust.

Exercise: for your current deployment, list every enabled tool from hermes tools and classify each using the table above. Add a require_approval entry for at least one destructive or externally-visible action, then trigger it deliberately and confirm the approval prompt actually appears before it executes.

Knowledge Check

3 questions to test your understanding

1 Lesson 19 covered curating which tools load at all. Why do you still need approval gates and sandboxing for the tools you did choose to enable?

2 A cron job (Lesson 17) is configured to run unattended every 15 minutes and has shell access enabled. What's the tension between 'unattended' and 'approval gate,' and how would you resolve it?

3 Which category of action does this lesson argue almost always warrants a human in the loop, regardless of how trusted the surface is?

Go further with expert guidance

Ready to build production AI?
Talk to our R&D team.

These courses give you the foundation. Our embedded AI teams take you from prototype to production in 30–90 days, with your team, your codebase, your goals. Book a free strategy call to see how we can accelerate your AI initiative.

30 minutes · No obligation · Expert AI engineers, not sales reps

AI Architecture Review

Audit your current stack and identify high-impact improvements

Project Review

Get expert feedback on your AI implementation and codebase

Team Mentoring

Upskill your engineers with hands-on AI coaching sessions

AI Strategy

Define your AI roadmap, prioritization, and implementation plan