Human-in-the-loop workflows
Operations
Add approval gates to agent-generated email so a human signs off before anything goes out.
The canonical pattern
- Agent researches the recipient and composes a draft via
POST /v1/inboxes/{id}/drafts. The response has a draft id. - Your app notifies a reviewer (in-app banner, Slack DM, email to an approver mailbox, whatever you use).
- Reviewer opens the draft in your UI. Your UI calls
GET /drafts/{id}to show the current state. - Reviewer edits inline —
PATCH /drafts/{id}— or clicks Send —POST /drafts/{id}/send— or discards —DELETE /drafts/{id}.
Why drafts not "pending sends"
We deliberately don't have a "queue a send for later approval" endpoint. A draft IS the approval object. This keeps the API surface small and the state model unambiguous: a message either exists as a draft (not yet sent) or as a message (delivered to the relay). There's no third "pending approval" limbo state that can get wedged if your approval service is down.
Audit trail
Pair human-in-the-loop with an HTTP webhook on message.sent. Every send produces a webhook call you can log in your audit system, correlated by draft id → message id. You can also store reviewer metadata on the draft via the inbox.metadata field, if you need per-draft notes.