Human approval for AI agents belongs just before an action with meaningful consequences. An agent can draft an email and suggest recipients. Sending it is the point where a reviewer should be able to approve, reject, or ask for changes.
Put the approval gate before the action
A clear flow has three parts. First the agent prepares a proposal. Then the reviewer sees the exact recipients, subject, body, and attachments. Finally the system checks that the approved proposal is still current before it executes the send. If an attachment or recipient changes, ask for a fresh decision.
Try a pause-and-resume flow locally
The Agent Patterns HTTP demo uses deterministic agents and can run without AWS credentials. After following the setup instructions, send this Bash request to the local API.
curl -X POST http://localhost:8000/patterns/human_in_the_loop/run \
-H 'Content-Type: application/json' \
-d '{"message":"please email the team"}'
The demo returns a pending_approval status and a resume_token. Replace the placeholder below with the token from your run. This exercises the demo’s rejection branch.
curl -X POST http://localhost:8000/patterns/human_in_the_loop/resume \
-H 'Content-Type: application/json' \
-d '{"token":"REPLACE_WITH_RESUME_TOKEN","approved":false}'
Plan for retries and restarts
The demo stores approvals in memory by default. For a workflow that must survive a restart, use durable storage and record who approved which version of the proposal. Bind the token to the action and the authorized reviewer, give it an expiry, and make execution safe to retry. A network timeout after a send should never lead to a second email.
Test rejection and expiry alongside approval. Verify that neither rejection nor expiry calls the action. Then retry the same approval and check that the action runs at most once.
