Human-in-the-Loop Email Approvals
Keep humans in the loop for sensitive or high-stakes email sends. Use autonomy levels and the approval queue to build review workflows around your agent.
Fully autonomous agents are the goal for routine email - transactional confirmations, onboarding sequences, follow-up replies. But for outbound prospecting, legal communications, or any email your agent hasn't proven itself on yet, you want a human to review the draft before it goes out.
Molted's autonomy levels and approval queue give you fine-grained control over when humans review agent-proposed sends, without changing your agent code.
How it works
Every send request flows through two gates:
- Policy engine - checks deduplication, rate limits, suppression, and negative-signal budgets, plus consent for marketing sends when a tenant has opted into
requireConsentForMarketing(off by default) - Autonomy level and thread risk - decides whether a passing send goes straight to delivery or waits for human approval. This covers the mailbox's autonomy level (L1/L2), and separately, a reply on a thread whose inbound history was flagged for prompt injection (quarantined, rejected, or a high injection-risk score) - scoped to that thread, not the whole tenant.
Your agent always calls the same endpoint. The approval requirement is a mailbox setting - the agent proposes, the infrastructure decides whether to deliver immediately or route to the approval queue.
agent calls POST /v1/agent/request-send (or send_email, molted send)
│
▼
policy engine runs its rules
│
├── BLOCKED → status "blocked", reason returned to the agent
│
└── PASSED → autonomy level check
│
├── L1/L2 trigger → status "pending_approval" → a person reviews
│ │
│ approved → delivered
│ rejected → not delivered
│ 24h, no decision → expired, not delivered
│
└── L3 → status "queued", deliveredAutonomy levels
Set per mailbox. Default is L3 (fully autonomous).
| Level | Name | When to use |
|---|---|---|
| L1 | Assisted | Every send waits for approval. For new agents, high-stakes mailboxes, or any context where you want full visibility. |
| L2 | Guarded Auto | A send to a contact the mailbox has no prior contact with (no earlier message that actually went out to them, and nothing received from them) waits for approval. Replies and follow-ups to known contacts auto-send. Good for outbound prospecting where new contacts need review but ongoing threads do not. |
| L3 | Fully Autonomous | No approval required. Right for proven transactional agents with established patterns. |
Set up a supervised mailbox
Set a mailbox to L1 or L2 via the portal, CLI, or API:
molted mailboxes autonomy set YOUR_MAILBOX_ID --level 1curl -X PATCH "https://mailbox.molted.email/v1/agent/mailboxes/YOUR_MAILBOX_ID/autonomy" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"autonomyLevel": 1}'Your agent code does not change. The next send from this mailbox will be held for approval instead of delivered.
Lowering the level (more review) always works from an agent key. Raising it (less review) loosens a control, so it is a human decision: an agent key gets 403 human_decision_required with a decisionUrl for a person to open. See Loosening a control.
Check the approval queue
When a send is held, its result is status: "pending_approval" and it appears in the approval queue. A person reviews it in the portal; your agent or internal tools can read the queue:
molted approvals list --status pendingcurl "https://mailbox.molted.email/v1/send/approvals?status=pending" \
-H "Authorization: Bearer YOUR_API_KEY"Add &mailboxId=YOUR_MAILBOX_ID to see one mailbox's queue, or &requestId=REQUEST_ID (the requestId a held send returned) to find the approval of that one send, however many newer ones there are. A mailbox-scoped key only ever sees approvals on its own mailboxes, and asking for another mailbox returns 403 mailbox_scope_denied.
The response is an array of approval rows, newest first, at most 100:
[
{
"id": "5b7d9f1a-3c5e-4a7b-9d1f-3a5c7e9b1d3f",
"request_id": "1a3c5e7b-9d1f-4b3d-8f5a-7c9e1b3d5f7a",
"mailbox_id": "0c2e4a6b-8d1f-4a3c-9e5b-7d9f1b3a5c7e",
"status": "pending",
"decision_reason": null,
"decided_at": null,
"decided_by": null,
"recipient_email": "prospect@example.com",
"template_id": "_default",
"reply_to": null,
"send_reason": "Trial ends tomorrow",
"scheduled_at": null,
"attachments": [],
"payload_json": { "subject": "Following up on your trial", "html": "<p>Hi Sarah, just wanted to check in...</p>" },
"created_at": "2026-04-01T09:00:00Z",
"expires_at": "2026-04-02T09:00:00Z"
}
]See List send approvals for the details.
Approve or reject
Approving or rejecting a held send is a person's decision, made in the portal (Home shows what is waiting). An agent never approves its own sends: an approval or rejection made with an agent key comes back 403 human_decision_required with a decisionUrl (the portal page for that send) once your account enforces the human gate, which every new account does. Share that link with a person instead. With the MCP server, request_decision gives you the same link without trying. See Decisions need a human.
The one decision an agent may still make is withdrawing its own pending send: a rejection through PATCH /v1/send/approvals/:id of a send its own key created. Use molted approvals withdraw (or the MCP tool withdraw_send, in the policy toolset: ?toolsets=policy). molted overrides reject-send doesn't count: the thread-reject route it calls has no own-withdrawal exception.
molted approvals withdraw --request REQUEST_ID --reason "Tone too aggressive - rephrase"The same call over the API:
curl -X PATCH "https://mailbox.molted.email/v1/send/approvals/APPROVAL_ID" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"decision": "rejected", "withdraw": true, "reason": "Tone too aggressive - rephrase"}'decision is approved or rejected; reason is optional. Approved sends are delivered immediately. Rejected sends are not delivered. A pending approval nobody decides expires after 24 hours, and the send is rejected.
Build an approval workflow with your agent
A practical pattern: your agent submits the send, reads the status, and moves on; it learns the decision later from the event stream.
async function sendWithApproval(
to: string,
subject: string,
body: string
): Promise<{ delivered: boolean; reason?: string; requestId?: string }> {
const res = await fetch("https://mailbox.molted.email/v1/agent/request-send", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MOLTED_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
mailboxId: process.env.MOLTED_MAILBOX_ID,
recipientEmail: to,
templateId: "_default",
dedupeKey: `${to}-${subject}`,
payload: { subject, html: body, text: body },
}),
});
const result = await res.json();
if (result.status === "blocked") {
return { delivered: false, reason: `Policy block: ${result.reason}` };
}
if (result.status === "queued" || result.status === "scheduled") {
// No approval needed (an L3 mailbox, or a known contact on L2)
return { delivered: true, requestId: result.requestId };
}
if (result.status === "pending_approval") {
// L1, or a new contact on L2 - a person reviews it in the portal
console.log(`Send held for approval (${result.reason}). requestId: ${result.requestId}`);
return { delivered: false, reason: "pending_approval", requestId: result.requestId };
}
return { delivered: false, reason: "unknown" };
}import os
import requests
def send_with_approval(to: str, subject: str, body: str) -> dict:
"""Submit a send and return immediately. The decision arrives on the event stream."""
response = requests.post(
"https://mailbox.molted.email/v1/agent/request-send",
headers={
"Authorization": f"Bearer {os.environ['MOLTED_API_KEY']}",
"Content-Type": "application/json",
},
json={
"mailboxId": os.environ["MOLTED_MAILBOX_ID"],
"recipientEmail": to,
"templateId": "_default",
"dedupeKey": f"{to}-{subject}",
"payload": {"subject": subject, "html": body, "text": body},
},
timeout=10,
)
data = response.json()
if data["status"] == "blocked":
return {"delivered": False, "reason": f"Policy block: {data['reason']}"}
if data["status"] in ("queued", "scheduled"):
return {"delivered": True, "requestId": data["requestId"]}
if data["status"] == "pending_approval":
print(f"Send held for approval. requestId: {data['requestId']}")
print("Review in the portal: it waits on Home")
return {"delivered": False, "reason": "pending_approval", "requestId": data["requestId"]}
return {"delivered": False, "reason": "unknown"}React to approval decisions
Decisions are published on the event stream, not to webhooks: send.approval_pending when a send is held, send.approval_decided when a person approves or rejects it, and send.approval_expired when nobody decided in time. Run a handler with molted listen:
molted listen --pipe "node approvals.js" --events "send.approval_decided,send.approval_expired"import readline from "node:readline";
const rl = readline.createInterface({ input: process.stdin });
rl.on("line", (line) => {
const { event, data } = JSON.parse(line);
if (event === "send.approval_decided") {
// data: { approvalId, decision: "approved" | "rejected", decidedBy, mailboxId }
console.error(`Approval ${data.approvalId}: ${data.decision} by ${data.decidedBy}`);
// Notify your agent, update your CRM, or regenerate a rejected draft
}
if (event === "send.approval_expired") {
// data: { requestId, approvalId, mailboxId }
console.error(`Approval expired, send ${data.requestId} was not delivered`);
// Re-queue or abandon
}
});molted listen passes only the event payload. The decided event's send request id is the SSE envelope's entityId; read the stream directly (GET /v1/agent/events/stream) if your handler needs it, or match on approvalId. See Building a Reactive Agent for running a handler as a daemon.
Progressive trust: start supervised, graduate to autonomous
A reliable pattern for deploying new agents safely:
Phase 1 - L1 (Assisted): Every send is reviewed. Build confidence in the agent's output quality and volume. Review for tone, targeting accuracy, and edge cases.
Phase 2 - L2 (Guarded Auto): Once first-contact quality is proven, graduate to L2. New prospects are still reviewed, ongoing threads auto-send. This is the right steady state for most outbound agents.
Phase 3 - L3 (Fully Autonomous): After L2 is stable with no rejection patterns, graduate to L3 for high-confidence mailboxes (transactional, support replies, internal notifications).
A person switches levels at any time in the portal, or with their own credentials through the API or CLI - no code changes needed:
# Graduate from L1 to L2 after reviewing 100 sends
molted mailboxes autonomy set YOUR_MAILBOX_ID --level 2Run from an agent key, this asks for a human decision instead (raising the level loosens a control).
Separate mailboxes for different risk profiles
A single tenant can have multiple mailboxes with different autonomy levels. This lets you apply the right level of oversight per use case without a blanket policy:
| Mailbox | Autonomy | Use case |
|---|---|---|
outreach@yourdomain.com | L2 | Outbound prospecting - new contacts reviewed |
support@yourdomain.com | L3 | Support replies - proven patterns, auto-send |
enterprise@yourdomain.com | L1 | Enterprise outreach - always reviewed |
billing@yourdomain.com | L3 | Transactional dunning - fully automated |
Related
- Autonomy Levels - full reference for level configuration
- Approval Queues - every queue, and why decisions need a human
- Event Streaming - approval and delivery events
- Policy Simulation - test policy rules before going live
- LangChain Integration Guide - LangChain setup
- CrewAI Integration Guide - CrewAI setup
- AutoGen Integration Guide - AutoGen setup
AutoGen Integration Guide
Add a governed email mailbox to your AutoGen agents and multi-agent conversations. Send, receive, and track email with built-in policy enforcement.
OpenAI Agents SDK Integration Guide
Add a governed email mailbox to your OpenAI Agents SDK agents. Send, receive, and track email with built-in policy enforcement.