Structured reply event (reply.event)
A structured object representing an inbound email reply. injection_score + sender_reputation are computed on every event; intent, entities, and urgency are added when opt-in classification is enabled.
A structured reply event (reply.event) is the structured object Mails.ai delivers to your agent when an inbound email arrives. Every reply received by an agent address — whether a response to an outbound the agent sent, or an unsolicited inbound to its public-facing address — is normalized into a structured reply event before it reaches your code.
What is in the event
Two fields are computed on every event, plus the raw body for fallback:
injection_score— 0–1 prompt-injection risk. See injection_score.sender_reputation— reputation graph score for the sender domain + identity. Workspace-scoped today, designed to propagate network-wide as the cohort grows.
Enable opt-in classification (+$0.003 per event) and three more fields are populated:
intent— the classified action: one ofschedule_demo,request_pricing,unsubscribe,refund_request,abuse_attempt,support_request,express_interest,general_inquiry.entities— structured data extracted from the body: dates, amounts, names, emails, durations, timezones.urgency— 0–1 score. Threshold for paging your agent vs. queueing for batch.
Why it matters
Without structured reply events, every agent that reads inbound email re-implements MIME parsing, threading, intent classification, and entity extraction. Each is a class of bugs. Structured reply events let your agent code switch against structured fields rather than regex through bytes — here with opt-in classification enabled:
agent.onReply((event) => {
if (event.injection_score > 0.5) return;
switch (event.intent) {
case "schedule_demo": return calendar.createEvent(event.entities);
case "unsubscribe": return suppressionList.add(event.from);
}
});Read the structured reply events post for the full rationale and complete event-shape JSON.
What to read next.
Built for agents.
Self-serve at every volume.
Public API opens Q3 2026. Drop ~6 lines into your agent and ship.
$ npm install @mailsai/sdk