Agent / human-in-the-loop

Add approval where an agent can cause change.

Bollard renders the review surface. Your agent runtime must pause before the side effect, persist the decision, and enforce it when the tool is resumed.

Approval lifecycle

  1. 1

    Tool request

    The agent proposes a consequential tool call.

  2. 2

    Policy check

    Your runtime blocks known-bad scope and decides whether review is required.

  3. 3

    Human approval

    Bollard shows the action, target, scope and consequence for an explicit decision.

  4. 4

    Execute and record

    Only an approved, current request runs. Store the decision and outcome.

Install the review surface

Add the Bollard namespace once

Merge this into components.json once. Then run npx shadcn@4.21.0 list to check registry resolution before installing with the short command.

{
  "registries": {
    "@bollard": "https://bollard-ui.vercel.app/r/{name}.json"
  }
}
npx shadcn@4.21.0 add @bollard/agent-pack

The pack includes agent-action-approve, ai-paste-guard and undo-toast.

Render the pending request

Pass a pending tool call into AgentActionApprove. Send its decision to your own server or agent harness, keyed to the exact pending call ID.

pending-agent-action.tsx
"use client"

import { AgentActionApprove } from "@/components/ui/agent-action-approve"

export function PendingAgentAction({ call, decide }) {
  return (
    <AgentActionApprove
      call={call}
      allowedHosts={["api.example.com"]}
      onDecision={async (decision) => {
        await decide({ callId: call.id, decision })
      }}
    />
  )
}

See the Agent Action Approve API for the call shape and available review options.

Enforce the decision at the tool boundary

A review UI is not authorization. Reject stale, missing, denied or scope-mismatched approvals in the same service that performs the side effect.
  • Bind an approval to one tool call, target and argument set.
  • Re-check the actor's authorization, target scope and policy immediately before execution.
  • Expire unanswered approvals and fail closed when the reviewer or policy service is unavailable.
  • Write the decision and execution result to your audit trail.

Use the agent-approval recipe for the related components and the playground to try the interaction before integrating it.