The email infrastructure for autonomous document processing.

Developers building document processing agents need primitives to receive attachments via email, read their contents, and reply with extracted data or confirmation. Loomal provides the email API so your agent can process documents the moment they arrive in the inbox.

API Primitives used

  • mail_list_messages
  • mail_get_thread
  • mail_reply
  • mail_send

Detect incoming documents

Monitor the inbox for new emails with attachments. Filter by sender or label to isolate document submissions.

Retrieve attachments

Load the full message including attachments. Access document content for parsing and extraction.

Return results

Reply to the sender with extracted data, validation results, or confirmation of processing.

Track processing status

Label threads as processing, completed, or needs-review. Keep the pipeline organized.

Documents arrive by email. Processing them should not require a human.

Contracts, invoices, tax forms, and applications still arrive as email attachments — hundreds per day in many organizations. Someone has to open each one, extract the relevant data, enter it into a system, and reply with confirmation. This manual loop is slow, error-prone, and does not scale.

Developers building document agents need email infrastructure that receives attachments, provides their content for parsing, and sends replies with results. Loomal provides mail_list_messages for intake, mail_get_thread for attachment access, and mail_reply to close the loop with senders.

How to build it.

  1. mail_list_messages
    Receive documents
    Your agent monitors the inbox with mail_list_messages, detecting new emails with attachments. It filters by label to separate document submissions from general mail.

  2. mail_get_thread
    Extract and process
    The agent retrieves the full message with mail_get_thread, accesses the attachment, and runs extraction logic — parsing fields, validating data, or classifying the document type.

  3. mail_reply
    Reply with results
    The agent replies to the sender using mail_reply with the extracted data, any validation errors, or a confirmation that the document was processed successfully.

Example prompt

“Check the documents inbox for new submissions. Extract company name, amount, and date from any invoices. Reply to each sender confirming receipt and flag anything over $10,000 for manual review.”

What developers build.

Invoice data extraction

Build agents that receive invoices via email, extract line items and totals, and push structured data to your accounting system.

Application processing

Build agents that receive application forms via email, validate completeness against required fields, and reply with confirmation or a detailed list of missing information.

Contract review intake

Build agents that receive contracts via email, extract key terms, renewal dates, and liability clauses, label by urgency, and route to the appropriate legal reviewer.

Expense report processing

Build agents that receive expense receipts via email, extract amounts, categories, and merchant names, and reply with approval status based on your company's expense policy rules.

Why not use a document processing platform?

Document processing platforms require you to upload files to their portal or set up complex integrations. But your documents already arrive by email. Adding a separate upload step is friction that slows the process and confuses senders.

Loomal meets documents where they arrive. mail_list_messages detects them, mail_get_thread retrieves them, and mail_reply closes the loop — all in the same email thread. No portals, no uploads, no extra steps for the sender.

Encrypted in transit

All email communication uses TLS encryption. Documents are never transmitted in plaintext.

Isolated processing

The document agent operates in its own identity. It cannot access other mailboxes or unrelated data.

Processing audit log

Every document received, processed, and responded to is logged with timestamps for compliance.

Process documents at inbox speed.

Automatically.