All work

Freight quote requests: from email to filled form in a second

For a software company serving air freight: forwarders' emails asking for a price become a filled quote request form, with the AI model running in the client's own AWS account in the EU.

Client
Air freight software
Scope
Proof of concept
Role
AI Engineer

What it does

The system reads emails with a model running in the client's own AWS account in the EU and fills the quote form in about a second. When an email contradicts itself, the form says so instead of quietly picking one number.

In numbers

from email to filled form
~1 s
Typical time from sending the email to a filled quote form.
AI cost per 1,000 emails
< $1
Average AI model cost per 1,000 emails.

The problem

  • Freight forwarders ask for prices by email: free text in several languages, tables pasted as runs of numbers, dates like “next Monday”, notes about dangerous goods. Someone has to turn each of them into a quote form.
  • The client wanted the reading done in its own AWS account, at least as fast as before, always giving the same form for the same email, with a model it can replace without rebuilding the system.

One email, from the inbox to a quote form

The model does one job: it reads what the email says. Everything that can be calculated or checked is done by ordinary code.

Step types
  • Input
  • Deterministic code
  • Language model
  • Gate that can stop the run
  • Output
  1. Input

    The email arrives

    The client's tool passes the email to the service. A malformed request is turned away before any model is called.

  2. Deterministic code

    The email made readable

    Headers, text and tables become clean text. The email is marked as data, so the model treats instructions hidden inside it as content, not as commands.

  3. Language model

    Facts read from the email

    A model running on AWS in the EU writes down only what the email states: route, pieces, dimensions, weights, dates and special handling, always in the same layout.

  4. Gate that can stop the run

    Complete, or a clear error

    An answer that is cut off, blocked or in the wrong layout ends in an error. The form never receives half the data.

  5. Deterministic code

    Totals calculated by code

    Sums, weight per piece and dates are worked out by code, not by the model. If the email's own total disagrees with its pieces, the email's number stays and a warning goes with it.

  6. Output

    Form filled, every call recorded

    The answer arrives in the format the client's tool already knows. Each call is recorded with its duration and cost.

Decisions that shaped it

The model reads, code counts

Language models are good at understanding messy emails but make mistakes in arithmetic. So the model only writes down what is in the email, and totals, per-piece weights and dates are calculated by code. The numbers on the form add up, and the answer is faster because the model writes less.

A contradiction is shown, not settled

One sample email listed pieces whose weights added up to well under the total it stated a line later. A model left to itself tends to pick one of the numbers without saying so. Here the email’s own total stays on the form and a warning tells the operator that the email contradicts itself. A person decides before the price goes out.

A full answer or a clear error

The layout of the answer is enforced while the model writes it and checked again in code. A reply that is cut off or malformed is rejected as a whole, so the form is never half filled with values nobody can trust.

Twelve models tried on real and synthetic emails

Not every model is available on AWS in the EU, so the comparison covered the twelve that are, on the client’s sample emails and on synthetic ones built like them. The client got a recommendation together with which differences between models were real and which were chance at this sample size. The model is a single setting, so it can be swapped later without touching the code.

These rules were worked out together with the client, to fit how they work. In your company they may look different, and I will fit the system to the way you work.

Built with

  • Amazon Bedrock
  • API Gateway
  • AWS Lambda
  • DynamoDB
  • S3
  • CloudWatch
  • Terraform
  • Python