Trelium DocsDocs
Recipes

Purchase Order Entry

How a Trelium agent turns a customer's purchase order into a draft sales order in your order system. Covers what comes in, the software used, the nine stages, the rules it checks, when a person steps in, which parts use AI, and three example POs.

A purchase order entry agent reads each customer PO that comes in by email. It works out who sent it and what they ordered, checks it against your records and rules, and creates a draft sales order in your order system. If everything checks out, the agent creates the draft without anyone needing to review it first, and the order desk still releases it. If something doesn't match, the agent stops and asks a person, so a wrong price or an unknown customer never turns into an order without someone checking it first.

Write your own version first

This recipe follows the example on Define a Workflow. Use the template on that page to write a version that fits your customers, your software, and your rules.

A PO entry agent at work, from Trelium's video AI Agent that automates the tedious task of entering Purchase Orders. The stages below explain each part of the job, and the screenshots come from a separate example build that uses a Google Sheet as the order system.

At a glance

PartIn this recipe
What comes in (inputs)A customer email with the PO attached as a PDF or spreadsheet, or typed in the email itself
Software it uses (systems)The inbox the POs arrive in, your order system, which holds your customers, items, agreed prices, and orders, and the quantity limit your team sets for each customer
StepsThe nine stages below, from the PO arriving to the job being recorded
Rules it checks (business rules)Known customer, known items, agreed prices, quantities within each customer's limit, PO not entered before, ship-to address and date given
How it checks (validation)It compares each rule with what is in your order system before entering anything
Problems it flags (exceptions)Anything that fails a check, such as a price below the agreed price or a customer it can't find
Where a person steps in (human review)A person deals with every problem, and signs off any line with a different price from the agreed one
What it produces (outputs)A draft sales order in your order system, a message to a person when something doesn't match, and a record of the job

What comes in

The agent works on the customer's email and anything attached to it. POs rarely arrive the same way twice. One customer sends a PDF, another sends a spreadsheet, and a third types the order into the email. The agent reads each one and picks out the same details every time. See Triggers & Inputs.

The software it uses

This recipe uses two pieces of software. The inbox is where POs arrive, and a shared inbox such as orders@ works better than one person's inbox. Your order system holds your customers, your items, the prices you agreed with each customer, and the orders themselves. If your agreed prices are kept somewhere else, such as a spreadsheet, the agent needs access to that too. The same goes for your quantity limits: the lowest and highest quantity your team accepts from each customer. Your team sets these limits, and the agent reads them wherever you keep them.

If your order system has a built-in connection for other software (called an API), the agent uses it. If not, it can log in and use the same screens your team does, which Trelium calls a browser agent. Check the Integrations page or ask the Trelium team about the system you use. You don't move your data or switch software, and your orders stay in your order system.

The nine stages

The agent's work is recorded in runs, and one run can handle more than one PO, as the Activity log example below shows. Every PO goes through these stages.

The Flow of an example PO entry agent, left to right: a new Gmail email with a subject starting PO, reading the email and the PDF or typed PO, looking up the customer, items, agreed prices, quantity limits, and past PO numbers in a Google Sheet, checking the business rules, then either emailing a person to review a problem or creating a draft sales order row, and finally recording the job in a PO log.

The Flow of an example PO entry agent. In this example build, a Google Sheet stands in for the order system. Problems go to a person by email, and clean POs become a draft sales order row.

1. The PO arrives

A new email in the orders inbox starts the job. Trelium calls this the trigger, and the email and its attachment are the input.

2. Read the email or document

The agent reads the email and any attachment, whatever form the customer used. This is reading and understanding, so AI does it. What it reads is treated as a first draft that the later stages check, not as a final answer.

A made-up email in Gmail titled PO LU-4471, Lakeside Uniforms, signed by Rachel Morgan, asking for delivery on November 12, 2026, with a PDF named PO_LU-4471.pdf attached. The sender's address is hidden.

PO 1 from the example below, as it arrives in the orders inbox: a short email with the PO attached as a PDF.

3. Work out who the customer is

The agent works out which customer sent the PO from clues in the email and the document, such as the sender, the company name, and the bill-to details. AI suggests a match, and stage 5 checks it against your customer list. If no customer fits, or more than one does, the agent doesn't guess.

4. Pick out the order details

The agent picks out the PO number, the item, quantity, and price on each line, the ship-to address, and the requested date. Customers often describe items in their own words, so matching each line to the right item in your system is also reading work. Everything it picks out is still a draft at this point.

5. Look things up

The agent looks up the customer, each item, and the price agreed with this customer in your order system, along with this customer's quantity limit. It also checks whether this PO number has been entered before. It looks these up at the time, so it works from today's prices and records, not an old copy.

6. Check against your rules

The agent compares what it read with your rules. Is the customer in your system? Is every item? Does each price match the agreed price? Is each quantity within this customer's limit? Is anything missing? These checks follow set rules and work the same way every time. See Validation & Exceptions.

7. Send problems to a person

If a check fails, the agent does not create the order. Trelium calls this an exception. The PO goes to a person, who sees what the agent wants to do and why it stopped. What happens next depends on the problem, as the table further down shows. See Human in the Loop.

8. Create the sales order draft

Once every check passes, and anything that needs a sign-off has one, the agent creates a draft sales order in your order system with the customer's PO number on it. This recipe is about new POs, so it always creates a new draft. A revised PO for an order you have already entered belongs in a separate order modification workflow, not in this one.

One row in a spreadsheet tab of draft sales orders: draft ID SO-DRAFT-LU-4471, customer Lakeside Uniforms, customer PO LU-4471, three lines (UNI-100, 200 at 14.50; UNI-210, 60 at 38.00; UNI-330, 100 at 6.25), total 5805, status Draft awaiting release, created 2026-10-15.

The draft sales order the agent created for PO 1, with the customer's PO number on it. Its status is awaiting release, because the order desk still releases it. In this example build the order system is a spreadsheet.

9. Keep a record

The job is saved in the agent's Activity log, its history of every job it has handled. The log shows each step the agent took, when it happened, and how the job ended. See Logs & Audit Trails.

One run opened in the agent's Activity log, marked Cancelled, with Gmail and Google Sheets icons, 147 credits used, started today at 14:10 and lasting 8 minutes 16 seconds. Below it is a list of timestamped steps such as Download Pdf Url, Extract Po From Pdf, Create Draft Order, Write Log Row, Send Review Email, Read Email Text, and Extract Po From Text, each with how long it took.

One run opened in the agent's Activity log. Each line is a step, with the app it used, when it ran, and how long it took. This run handled all three example POs: one became a draft order, and two were sent for review.

The rules it checks

Your rules decide what counts as a correct order. The agent checks each one against what is in your order system.

RuleWhat the agent compares
The customer is in your systemThe customer it found, against your customer list
Every item is in your systemEach item on the PO, against your items
Each price matches the agreed priceEach price on the PO, against the price agreed with this customer
Each quantity is within the limitEach quantity, against the lowest and highest quantity your team set for this customer
The PO hasn't been entered beforeThe PO number, against this customer's past orders
The ship-to address and requested date are thereWhat the agent picked out, against what every order needs

When something doesn't match

Each kind of problem goes to a person for a different reason. The person sees what the agent wants to do and why it stopped, so they don't have to start from scratch.

ProblemWhat the agent doesWhat the person does
Customer not foundStops before creating anything and sends the PO to a personWorks out who sent it
Price doesn't match the agreed priceHolds those lines until someone approves themReviews the flagged price difference
Item not foundSends the PO to a person with that line markedWorks out which item the customer meant
Quantity above or below the customer's limitSends the PO to a person with that line markedChecks whether the quantity is right
No ship-to address or requested dateAsks a person for the missing detailFills it in, and the agent carries on from there
PO number already enteredStops before creating anything and sends the PO to a personChecks whether it is a repeat or a new order

AI reads. Rules decide.

AI can misread a price or a customer name, just as a person can. That is why a price below the agreed price or an unknown customer stops the job, instead of going into your order system just because the AI read it that way.

Which parts use AI

AI does the reading and understanding. Everything else follows set rules: given the same records and rules, the same input takes the same path (technical teams call these deterministic steps), as How Trelium Works explains.

StageDone byWhy
1. The PO arrivesSet rulesA new email in the inbox starts the job
2. Read the email or documentAIPOs come in many layouts and wordings
3. Work out who the customer isAIThe sender and company name have to be read and matched to a customer
4. Pick out the order detailsAIItems, quantities, and prices have to be read from the document
5. Look things upSet rulesCustomers, items, agreed prices, and quantity limits come straight from your records
6. Check against your rulesSet rulesEach rule is a comparison that works the same way every time
7. Send problems to a personA personWhen a check fails, a person decides instead of the agent guessing
8. Create the sales order draftSet rulesThe draft is only created after the checks pass and sign-offs are given
9. Keep a recordSet rulesEvery job is saved in the Activity log

Example: three POs on a Monday morning

Three POs arrive in the orders inbox before the order desk starts work. The customers, people, and numbers are made up.

flowchart LR
A[PO 1: Lakeside Uniforms every check passes] --> D[Draft sales order created]
B[PO 2: Ridgeway Hardware two lines below agreed price] --> E[Order desk lead approves the lines] --> D
C[PO 3: Bellmont Outfitters customer not found] --> F[Sent to the order desk]

The orange boxes are where a person steps in before anything is created. Any draft that is created still waits for the order desk to release it.

PO 1: everything checks out

Rachel Morgan, a buyer at Lakeside Uniforms, emails PO LU-4471 as a PDF with three lines. The agent reads the PDF, matches the sender and the bill-to name to Lakeside Uniforms in your customer list, and picks out the three lines, the ship-to address, and the requested date. Every item is in your system, every price matches, every quantity is within Lakeside Uniforms' limit, and the PO is new. The agent creates a draft sales order, and the job is saved in the Activity log. PO 1 needs no review before the draft is created. The order desk still releases it.

PO 2: a price that doesn't match

Ridgeway Hardware sends PO RH-2208 as a PDF with two lines. Both are priced at $4.10 each, but the price agreed with Ridgeway Hardware is $4.35, about 6 percent more. The price check fails on both lines, so the agent stops before creating anything and sends the order desk lead a request to review them.

A review email titled PO review, RH-2208, Ridgeway Hardware, held for price approval. It says the PO is on hold until someone approves the price difference and that no draft order was created. It lists items HW-501 and HW-502, each at a PO price of 4.10 against an agreed price of 4.35, then what the agent read from the PO: customer, PO number, ship-to address, PO date, date needed, and both lines.

The review request for PO 2. It arrives by email, says nothing was created, lists the two lines with the PO price next to the agreed price, and shows what the agent read from the PO.

The order desk lead reviews the flagged price difference, with the PO price and the agreed price side by side. Sales had agreed the lower price for this order, so the lead approves the two lines. The agent carries on and creates the draft sales order. The Activity log records the run and its steps.

PO 3: a customer the agent can't find

A buyer from Bellmont Outfitters emails PO BO-3390, typed into the message. The agent reads the email and picks out the lines, but it can't find Bellmont Outfitters in your customer list. Without a customer, it has no agreed prices to check against.

The agent stops before creating anything and sends the PO to the order desk, along with what it read. Nothing goes into the order system for this PO. The order desk deals with it the way they would deal with any new customer today.

A review email titled PO review, BO-3390, Bellmont Outfitters, sent to order desk. It says the PO was sent to the order desk for review and no draft order was created, because Bellmont Outfitters was not found in the customer list. It then lists what the agent read: PO number BO-3390, a ship-to address in Pittsburgh, no PO date, a date needed of November 20, 2026, and one line, BO-100, 40 at 11.00.

The message the order desk gets for PO 3. It says the customer could not be found, that nothing was created, and what the agent read from the email.

Before you build

Write your own plan with the Define a Workflow template, using your own customers, PO formats, and rules. Then try the agent on old POs your team has already entered, including a few that caused trouble. See Testing a Workflow.

Where to go next

On this page