Supplier payments by email with an AI agent
An AI accounts payable agent receives supplier invoices by email, reads the attached file as text, and prepares the payment. The risk is invoice fraud: a message that looks like the supplier and says the bank details have changed, so the money goes to an account the attacker controls.
Updated
How an AI agent processes invoices that arrive by email
An accounts payable agent turns an emailed invoice into a payment record. The email part of the job is reading the message and the file attached to it.
- Give the agent an inbox and ask suppliers to send invoices to that address.
- When a message is delivered, find the attachment that has readable text. Attachments carry
has_textandpages. - Read the attachment as text. Text is read from PDF, Word, Excel, PowerPoint and OpenDocument files on arrival, and instructions aimed at an AI are taken out.
- Match the invoice against your own records before anything is paid.
const pdf = msg.attachments.find((a) => a.has_text);
const { text } = await mail.messages.attachmentText(msg.id, pdf!.id);
// Held mail answers 403 message_withheld: no new bank details reach Riley.{
"name": "read_attachment_text",
"arguments": { "message_id": "msg_7c2ndq8xk4v9tb3wmz6r", "attachment_id": "att_9k3mx7qd2vb8tn4wc6hz" }
}Riley is the agent in the sample. Asking for the attachment text of a held message answers 403 message_withheld.
The real invoice and the bank details change
The job has two sample messages: a supplier invoice, which got a deliver verdict, and a request to pay a new bank account, which got hold. The verdicts below are the ones the live engine gave on November 20, 2026.
The invoice comes from Harborline Logistics at billing@harborline-logistics.example, with the subject "Invoice 4471 for October freight". It asks for $18,400, due December 1, to the account on file. It is signed by Marcus Hale in accounts, and a PDF is attached.
The second message uses the same company name, the same signer and the same PDF name. Its address is billing@harborline-logistic.example, one letter short of the real domain. The subject is "Invoice 4471: our bank details have changed". It says the supplier changed banks this week and asks for payment today to a new account, in the name Harborline Holdings.
| Message | Verdict | Summary, as the engine wrote it |
|---|---|---|
| Invoice 4471 for October freight | deliver, level safe | No threats found. |
| Invoice 4471: our bank details have changed | hold, level danger | The message says payment details have changed, the pattern of invoice fraud. |
The second message carries one signal, "Payment request with the marks of invoice fraud". Its advice is to confirm with the sender through a channel you already trust before paying.
In an inbox that accepts first and checks after
An inbox that accepts mail first and checks after delivers the bank change to the agent beside the real invoice. Both name the same invoice number and the same amount, so the agent has no reason to doubt the second. If it updates the payee and pays today as asked, the transfer has left before anyone reviews the message.
The FBI IC3 2025 report puts business email compromise losses at $3.05 billion. In a Trotta Mail inbox the held message waits outside the inbox, and the agent's key gets the verdict in fixed words and nothing the sender wrote.
Setting up a payables agent well
A payables agent should read and prepare. Review, bank changes and approval stay with a human.
- A separate inbox for payables. Keep supplier mail in an inbox of its own, with a key limited to that inbox.
- A human reviews held mail. Someone in finance reads the message in the Held folder and releases or discards it. See held mail.
- Bank changes are confirmed out of band. Call the supplier on a number already on file, never one from the message.
- The agent never changes payee details. No filter catches everything: a reworded request with no technical tell can still be delivered.
- Lockdown, if suppliers are known. In
lockdownmode your own organization and allow-listed senders that prove who they are get through. Everything else is held.
Questions
Can an AI agent process invoices that arrive by email?
Yes. The agent reads the text of an attached PDF, Word or Excel file through the API or the read_attachment_text MCP tool. The text comes in the safe view, with instructions aimed at an AI taken out.
How can an AI agent pay invoices safely?
Keep three things with a human: reviewing held mail, changing a supplier's bank details, and approving the payment. The agent reads and prepares.
What happens to an email that says a supplier's bank details changed?
In the saved sample it got a hold verdict with level danger, and the summary says it follows the pattern of invoice fraud. A held message is kept out of the inbox until a human releases it.
Does screening catch every fake invoice?
No filter catches everything. A cleverly reworded scam with no technical tell can still be delivered, which is why uncertain mail is held for a human and payment approval should stay with one.