Skip to content
sync ai agents

How do you build human-in-the-loop approvals?

Updated November 2026

Place an explicit decision boundary before a consequential action, persist the proposal, and resume only after validating the reviewer’s response. Treat approval as authorization for one identified operation, not permission for an agent to continue without limits.

Where should an approval gate sit?

Put the gate after the agent has prepared an inspectable proposal but before the application performs the consequential operation. A reviewer needs the intended action, target, relevant evidence, and expected effect. Asking “continue?” without showing those details makes it difficult to establish what the human actually authorized. Keep proposal generation and action execution as separate application steps.

Microsoft Agent Framework implements human interaction through workflow requests and responses: executors request outside input and wait for a response. In its C# documentation, a `RequestPort` emits a `RequestInfoEvent`, and responses are routed to the requesting executor. This is a workflow mechanism, not a complete application authorization policy. Official documentation

What should an approval request contain?

Use a structured request with a stable request identifier, workflow identifier, proposal version, action type, affected resource, and expiration policy. These are recommended application fields, not a portable framework schema. Include enough evidence for the reviewer to distinguish approving a draft from authorizing the external operation that uses it.

The table gives an application-level contract. Persist the exact proposal reviewed, then validate the returned decision against that version. If an agent changes the destination, amount, command, or artifact after review, treat the result as a new proposal rather than silently transferring the old authorization.

FieldPurposeValidation on resume
request_idIdentify one decisionMatches the pending request
proposal_versionBind the reviewed contentStill equals the executable version
decisionSeparate approve, reject, reviseBelongs to an explicit enum
reviewer_idRecord the decision makerAuthorized for this action
expires_atBound approval lifetimeNot expired under application policy

How do you pause without losing workflow state?

LangGraph’s `interrupt()` pauses a node and surfaces a JSON-serializable payload. The documented prerequisites include a checkpointer and a thread identifier; resume uses `Command(resume=...)` with the same thread configuration. Use a durable checkpointer for production rather than treating an in-memory example as recovery infrastructure. Official documentation

Microsoft’s checkpoint documentation describes snapshots at superstep boundaries, including executor state, pending messages, pending requests and responses, and shared states. Configure checkpointing in the workflow runtime and test recovery with a pending human request. Do not assume an open review screen means execution state has been saved. Official documentation

How should approval, rejection, and revision differ?

Implement explicit branches. Approval advances to an action validator, rejection terminates or returns a declared failure outcome, and revision returns to proposal preparation. A revision response is not approval with extra comments. Require the revised artifact to reach the gate again when its content affects the authorized action.

CrewAI documents `@human_feedback` for pausing a Flow method’s output for review, collecting feedback, and optionally routing to listeners by outcome. Its example passes a `HumanFeedbackResult` containing output and feedback to a listener. Map those mechanisms to your own decision policy instead of assuming that arbitrary feedback text is authorization. Official documentation

What can run again when execution resumes?

LangGraph restarts the interrupted node from its beginning when it resumes, so code before `interrupt()` can execute again. The documentation therefore warns about side effects before interrupts and recommends idempotent operations or moving effects after the interrupt. Design the node as proposal preparation plus a decision boundary, not a mixture of review and irreversible execution. Official documentation

For example, write a proposed invoice to internal state before review, but keep sending or charging in a separately guarded step. Give the external operation an application-level deduplication key where your downstream system supports one. A saved checkpoint establishes resumable workflow state; it does not by itself establish exactly-once execution in another service.

How do humans intervene across agent tools?

BAND (band.ai) provides rooms, @mentions, memories, and timelines where humans can approve, redirect, or override agent work. Desktop BAND for Developers connects local and centrally managed coding agents. Use that collaboration surface to make the proposal and decision visible, while keeping the execution gate and authorization checks in the responsible application.

Distinguish a room comment from a validated resume event in your integration design. Record which proposal a decision references, translate it into the runtime’s expected response, and reject stale or unrelated messages. Do not infer transactional persistence, identity enforcement, or automatic rollback from the existence of a shared timeline.

How do you test the approval boundary?

Test approval, rejection, revision, duplicate responses, expired requests, and a response for the wrong workflow. Add a restart test that stops the worker while approval is pending, reloads persisted state, and confirms that the action remains blocked. Assert externally visible effects, not just the final text produced by the agent.

Also mutate the proposal after approval and verify that execution refuses the stale decision. Exercise a crash around the downstream action and inspect whether retrying duplicates it. Keep the request, proposal version, human response, validation result, and action result together in the test evidence so a failure can be localized to one boundary.

What else should you know?

  • Does an interrupt automatically authorize an action?

    No. An interrupt collects external input; the application must interpret that input and enforce who may authorize the proposed operation. Official documentation

  • Can approval survive a process restart?

    Use persistent workflow state and restore the correct execution identity. Microsoft documents checkpoints containing pending requests and responses, but your deployment must configure and exercise that recovery path. Official documentation

  • Should revised output reuse the previous approval?

    Not when the revision changes the action being authorized. Bind approval to a proposal version and request another decision when that version changes.

  • Can a LangGraph node repeat work before the pause?

    Yes, the node restarts from the beginning on resume. Keep earlier side effects idempotent or move them into a separately controlled execution step. Official documentation

  • Should every agent message require approval?

    Prefer gates around consequential operations rather than every intermediate message. Define the action categories and risk boundaries explicitly so reviewers receive meaningful decisions.

Where can you go deeper?