Logistics · Playbook 31

I've worked in this sector

Shipping and customs document processing

Every commercial invoice, packing list, bill of lading and certificate of origin read and cross-checked before the goods arrive, with declarations drafted and commodity codes suggested. A customs specialist confirms every code and submits every declaration.

  • Document AI
  • Agents with tools
  • Retrieval (RAG)
  • Human in the loop
  • HMRC CDS
  • UK Trade Tariff
  • Border Target Operating Model
  • Windsor Framework
  • UK CBAM
  • UK GDPR

At a glance

The problem
Shipping documents arrive as PDFs, scans and emails in every layout, and specialists re-key them into customs software against the clock
Typical volume
Around 1,500 import and export declarations a week, across road, sea and air
Who's involved
Customs specialists, operations, customs compliance, IT, the customs software supplier, clients' shipping teams
Pilot
8–10 weeks after a 2–3 week discovery
Platforms
AWS, Azure, or a sovereign or on-prem stack

An illustrative scenario. The numbers are typical examples, not a client case study. The cloud services and UK rules were checked on 9 November 2026.

The business problem

Every consignment brings a bundle of documents: a commercial invoice, a packing list, a bill of lading or air waybill, often a certificate of origin or a supplier's statement on origin, and for food, plants and animal products, health certificates. They come from hundreds of shippers, in their own layouts and languages, as PDFs, scans and photos attached to emails. A customs specialist reads them all, works out what the goods are, finds the right commodity code, and keys the declaration into the customs software that submits to HMRC's Customs Declaration Service (CDS).

Most of that time goes on reading and re-keying, not on judgement. Problems are found late. The invoice says 400 cartons and the packing list says 380. The gross weight on the bill of lading doesn't match. The Incoterm means freight and insurance must be added to reach the customs value, and nobody has the figure. A description like "parts" can't be classified at all. Each of these becomes a chase to the shipper, often when the goods are already at the port.

Mistakes are expensive, and the forwarder can carry them. If it acts as an indirect representative, it is jointly and severally liable with the importer for the duty and import VAT. A wrong commodity code can mean underpaid duty, a missed licence or SPS check, or goods held at the border. From January 2027, the commodity code also decides whether goods fall under the UK carbon border adjustment mechanism (CBAM).

What AI changes

  • Every document is read as it arrives, from any channel, and its key fields are extracted: parties, goods descriptions, quantities, weights, values, currency, Incoterm and origin.
  • Documents are cross-checked against each other, and against the booking, before the goods arrive. Mismatches go to operations with the exact fields that disagree, so the shipper is chased days earlier.
  • Each line gets suggested commodity codes, with the reasoning, the alternatives considered, and any previous confirmed code for the same product. The customs specialist decides.
  • Lines that may need extra controls are flagged: SPS goods under the Border Target Operating Model, licensable goods, CBAM goods, and preference claims that need proof of origin.
  • The declaration is drafted in the customs software, ready for the specialist to check, complete and submit. Nothing reaches CDS without a person.
  • Every suggestion, the specialist's decision and the reason for any change are logged, so the forwarder can show HMRC how each declaration was made.

How success is measured

Agree these, and measure the baseline, before anything is built. Example targets are typical, not promises.

Time to declaration ready

From the last document arriving to a draft the specialist can submit.

ExampleFrom hours to under 30 minutes

Issues caught before arrival

Share of document mismatches raised with the shipper before the goods reach the border.

ExampleMost of them, measured against today

Code acceptance rate

How often specialists accept the top suggested commodity code. Very low means it isn't helping; near 100% can mean people have stopped checking.

ExampleStable, and reviewed weekly

Amendments after submission

Declarations that later need amending or a voluntary disclosure.

ExampleFalling, measured against last year

Border holds for paperwork

Consignments held because of missing or inconsistent documents.

ExampleDown by half

Specialist time per declaration

Time moved from re-keying to checking and judgement.

ExampleDown by half

UK regulation and controls

Cross-sector rules are on the UK regulation map.

  • HMRCCustoms Declaration Service and customs debt liability

    CDS is now the only route for UK customs declarations; the legacy CHIEF system has closed. The declaration stays the forwarder's legal act. As an indirect representative, the forwarder shares liability for duty and import VAT, so the AI drafts and a named specialist submits through the existing customs software. The AI never talks to CDS directly.

  • HMRCUK Trade Tariff, classification and Advance Tariff Rulings

    The AI suggests commodity codes from the current tariff and the forwarder's own confirmed history, and shows its reasoning. The specialist confirms. For high-value or disputed products, the design prompts the client to apply for an Advance Tariff Ruling (or a Binding Tariff Information decision for Northern Ireland), generally valid for three years, and records the ruling against the product.

  • Defra, APHA and port healthBorder Target Operating Model (SPS imports)

    Animal products, plants and some food need pre-notification in IPAFFS and health certificates, with checks based on risk category. The AI flags lines whose commodity codes suggest SPS controls and checks a certificate is present. It never decides a risk category, and the rules are held as configuration, because they are changing.

  • HMRCWindsor Framework (GB to Northern Ireland movements)

    Goods moved from Great Britain to Northern Ireland may move under the UK Internal Market Scheme if they are not at risk of entering the EU. The AI flags NI-bound consignments and the information the route needs. Whether goods qualify as not at risk is the specialist's decision, with evidence kept.

  • HMRCUK carbon border adjustment mechanism (from 1 January 2027)

    CBAM applies to imports of specified aluminium, cement, fertiliser, hydrogen, and iron and steel goods, identified by commodity code. The importer is liable, with a £50,000 registration threshold. The AI flags CBAM lines and the embedded-emissions data the client will need from its supplier.

  • HMRCStandard for Customs Intermediaries (June 2026)

    The voluntary standard, published with BSI, sets expectations for intermediaries, and HMRC has consulted on making registration mandatory. A logged, reviewable process for every declaration, with named people making each decision, is the kind of evidence it asks for.

  • ICOUK GDPR and the Data Protection Act 2018

    Shipping documents carry names, addresses and contact details, plus clients' commercially sensitive prices. That means a light DPIA, collecting only what's needed, a clear retention period aligned with customs record-keeping, UK processing where possible, and a contract that stops providers training their models on your data.

The solution

Showing AWSAzuresovereign / on-prem services. Switch with the toggle; every diagram and table on this page follows it.

Shipping and customs document processing: reference architecture
  1. 01Channels

    • Shipper and supplier emails
    • Client portal uploads
    • Carrier messages and electronic bills of lading
  2. 02Intake

    • Amazon SESLogic Apps email connectorYour existing mail serverInbound email
    • API GatewayAPI ManagementKong, or your existing API gatewayAPI for portals and carriers
    • Amazon S3Blob StorageCeph, or IONOS S3 Object StorageDocument store
  3. 03Intelligence

    • Textract + Bedrock Data AutomationContent Understanding (Document Intelligence)Docling plus an open-weight vision modelRead trade documents
    • Bedrock Knowledge BasesFoundry IQ (Azure AI Search)OpenSearch, or PostgreSQL with pgvectorTariff and procedures knowledge
    • Agent
      Bedrock AgentCoreFoundry Agent ServiceLangGraph on KubernetesDocument check agent
    • Agent
      Bedrock AgentCoreFoundry Agent ServiceLangGraph on KubernetesClassification assistant
  4. 04Orchestration

    • Step FunctionsLogic Apps / Durable FunctionsTemporalConsignment workflow
    • EventBridge + SQSEvent Grid + Service BusApache Kafka or RabbitMQEvents and queues
  5. 05Systems of record

    • Freight management system
    • Customs declaration software
    • Client product master and rulings
    • HMRC CDS, IPAFFS, GVMS
  6. 06People

    • Person
      Customs specialist: confirms codes, submits
    • Person
      Operations: chases shippers
    • Person
      Customs compliance: rulings and disclosures
  • Cloud or platform service (AWSAzuresovereign / on-prem)
  • AI agent
  • A person decides
  • Your existing systems
  • Outside your organisation

Components, side by side

Shipping and customs document processing: components on AWS, Azure and a sovereign or on-prem stack
LayerAWSAzureSovereign / on-prem
Intake: email, portals, filesOne consignment reference on every document, from the moment it arrives.Amazon SES, API Gateway, S3Logic Apps connectors, API Management, Blob StorageYour mail server, Kong, Ceph or IONOS S3 Object Storage
Reading trade documentsTest on real scans: stamped certificates, multi-page invoices in other languages, handwritten packing lists.Amazon Textract, Bedrock Data AutomationAzure Content Understanding (includes Document Intelligence)Open-source parsing (e.g. Docling) plus an open-weight vision model
Reasoning and draftingAWS and Azure both offer a choice of models, including Claude. On-prem and sovereign options run open-weight models.Amazon BedrockMicrosoft FoundryOpen-weight models served with vLLM on your own GPUs, or IONOS AI Model Hub
Tariff knowledge (retrieval)Indexed from the UK Trade Tariff (HMRC publishes an API), the explanatory notes, and your own confirmed codes and rulings. Refresh it on a schedule and stamp each suggestion with the tariff version.Bedrock Knowledge BasesFoundry IQ, built on Azure AI SearchOpenSearch, or PostgreSQL with pgvector
Agent runtimeThe original Bedrock Agents closed to new customers on 30 July 2026; new builds use AgentCore.Amazon Bedrock AgentCoreFoundry Agent ServiceAn open-source agent framework (e.g. LangGraph) on Kubernetes
WorkflowOne workflow per consignment, which waits for missing documents rather than guessing.AWS Step FunctionsLogic Apps or Durable FunctionsTemporal, or n8n
Middleware and eventsAmazon EventBridge, SQSEvent Grid, Service BusApache Kafka or RabbitMQ
Link to the freight and customs softwareDrafts are written through the customs software's own API or import, so its CDS link and validation stay in charge.API Gateway, plus your existing integration platformAPI Management, plus your existing integration platformKong or your existing API gateway, plus your existing integration platform
Human reviewSpecialists review where they already work, with the source document beside each field.In the specialists' existing customs software and work queueIn the specialists' existing customs software and work queueIn the specialists' existing customs software and work queue
GuardrailsBedrock GuardrailsFoundry guardrails (Azure AI Content Safety)Open-source guardrails (e.g. NeMo Guardrails, Llama Guard)
Identity, keys, data protectionClient pricing is commercially sensitive. Keep each client's data separate.IAM Identity Center, KMS, MacieEntra ID, Key Vault, PurviewKeycloak or your existing Active Directory; OpenBao or HashiCorp Vault; an HSM
Monitoring and auditLog every suggestion, the tariff version used, and the specialist's decision and reason.CloudWatch, CloudTrailAzure Monitor, Log AnalyticsPrometheus, Grafana, OpenTelemetry
UK data residencyIONOS AI Model Hub runs in German data centres: EU, not UK, residency.eu-west-2 (London)UK South / UK WestYour own UK data centre, or a UK or EU provider

On a phone, the table shows the platform you pick. Sovereign / on-prem means open, portable components you can run in your own data centre or with a UK or European provider; IONOS is shown as one example, and others exist. What sovereign cloud means →

Hybrid and on-prem

Many organisations keep core systems and sensitive data on their own servers. This is how the same design works across both.

Stays on-prem

The freight management system, the customs declaration software and the client product master stay where they are, whether on your own servers or hosted by your suppliers. Nothing in this design moves them.

Uses cloud AI

Document reading, the tariff index and the two agents can run in AWS or Azure UK regions, or on your own GPUs with open-weight models if clients' contracts keep their data in your estate.

How they connect

A private link (AWS Direct Connect or Azure ExpressRoute), or a site-to-site VPN for a smaller operation, and the API layer. Only the documents and fields the AI needs are sent, and drafts come back as events onto your queue.

If the link drops

Documents keep arriving and queue safely on your side. Specialists work consignments by hand as they did before, starting with the ones closest to arrival, and the backlog is read when the link returns.

The agents

What each agent may do through its tools, what it may not, and where a person signs off. The limits are enforced by the platform, not the prompt.

Document check agent

May do

  • Read and classify each document in a consignment
  • Extract parties, goods lines, quantities, weights, values, currency, Incoterm and origin
  • Cross-check the documents against each other and against the booking
  • Work out what's missing for the customs value, such as freight and insurance to the UK border
  • Draft a query to the shipper for operations to review and send

May not do

  • Choose between two documents that disagree
  • Contact a shipper, client, carrier or HMRC
  • Change booking or client data in the freight system
  • Accept a document as proof of origin or as an SPS certificate

Where a person signs offOperations decides how each mismatch is resolved and sends every message to a shipper. The agent's permissions are enforced by the platform's identity and policy controls, not by instructions in a prompt.

Classification assistant

May do

  • Search the tariff, the explanatory notes and the client's confirmed codes and rulings
  • Suggest commodity codes for each line, with reasons and the alternatives it ruled out
  • Flag lines that may need SPS checks, a licence, CBAM reporting or proof of origin
  • Draft the declaration in the customs software, marked as a draft

May not do

  • Submit, amend or cancel a declaration
  • Confirm a commodity code or change a confirmed one
  • Claim a tariff preference, relief or special procedure
  • Decide that goods are not at risk of entering the EU

Where a person signs offA customs specialist confirms every commodity code and submits every declaration through the existing customs software. Preference claims, reliefs and Northern Ireland decisions need the specialist's explicit sign-off, and new or disputed codes go to customs compliance.

Middleware and integration

The customs declaration software stays the only route to CDS. It is already recognised by HMRC, handles the submission, and returns HMRC's responses. The AI writes drafts into it through its API or import format, never around it.

Each consignment is a workflow keyed on one reference. Documents arrive in any order, by email, portal or carrier message, and each becomes an event. The workflow waits until the bundle is complete or a deadline passes, then raises what's missing. It never fills a gap with a guess.

Every document is stored once, with a fingerprint. If a shipper sends the same invoice three times, it is recognised and not processed three times. Every draft carries the consignment reference and a version number, so a retry updates the draft rather than creating a second declaration.

Electronic bills of lading and carrier messages arrive as structured data, so they skip document reading. Since the Electronic Trade Documents Act 2023, a qualifying electronic bill of lading has the same legal standing as paper, so expect more of them over time.

The AI can be switched off without stopping the business. If it's paused, documents go straight to specialists' queues, and they key declarations exactly as they did before.

Process and people

  • A named customs specialist submits every declaration, and their name is on the audit record.
  • Override reasons are captured whenever a specialist rejects a suggested code, and fed into the weekly review.
  • A weekly sample of confirmed codes is checked by customs compliance, weighted towards high-duty, SPS and CBAM goods.
  • Confirmed classifications become the client's product master, so the same product is never classified from scratch twice.
  • A named owner for the tariff index, the SPS and CBAM rule sets, and every prompt, with change control.
  • Operations and specialists trained before go-live, including what the AI can't see: goods it has never been shown, and documents that weren't sent.

Delivery plan

  1. 2–3 weeks

    Discovery

    Map today's process, measure the baseline, collect last quarter's real document bundles, and agree how drafts reach the customs software.

  2. Gate · must be true to passBaseline agreed, customs software integration route confirmed, DPIA started, and customs compliance involved.

  3. 6–8 weeks

    Pilot

    Imports for a handful of clients and one mode (for example, road freight from the EU), in shadow mode: the AI checks and suggests, specialists work as normal, and the two are compared.

  4. Gate · must be true to passExtraction accuracy and code acceptance within agreed limits on real documents, and compliance sign-off.

  5. 4–6 weeks

    Production

    Drafts go live for the pilot clients, with monitoring, support, the weekly sample review and a rollback plan.

  6. Gate · must be true to passMonitoring, support model, rollback plan and specialist training in place.

  7. Ongoing

    Scale

    Add modes, exports and clients one at a time, then reuse the pattern for SPS pre-notifications and CBAM reporting.

  8. Gate · must be true to passEach new flow passes the same pilot gate.

Roles and RACI

Who is responsible, accountable, consulted and informed, by activity
ActivityCustoms directorOperations managerSolutions architectI can fill thisTechnical PMI can fill thisEngineersI can fill thisCustoms complianceSecurityI can fill this
Business case and benefitsAccountableResponsibleConsultedConsultedInformedConsultedInformed
Target architectureInformedConsultedAccountable and ResponsibleConsultedConsultedConsultedConsulted
Integration with the customs softwareInformedConsultedAccountableResponsibleResponsibleConsultedConsulted
Classification rules and review sampleAccountableInformedConsultedInformedInformedResponsibleInformed
Accuracy testing on real documentsInformedResponsibleAccountableConsultedResponsibleResponsibleInformed
Go-live decisionAccountableResponsibleConsultedResponsibleInformedConsultedConsulted
Run, monitor and improveInformedAccountableConsultedConsultedResponsibleConsultedConsulted

Business case and benefits

Customs director
A · Accountable
Operations manager
R · Responsible
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
I · Informed
Customs compliance
C · Consulted
Security
I · Informed

Target architecture

Customs director
I · Informed
Operations manager
C · Consulted
Solutions architect
A/R · Accountable and Responsible
Technical PM
C · Consulted
Engineers
C · Consulted
Customs compliance
C · Consulted
Security
C · Consulted

Integration with the customs software

Customs director
I · Informed
Operations manager
C · Consulted
Solutions architect
A · Accountable
Technical PM
R · Responsible
Engineers
R · Responsible
Customs compliance
C · Consulted
Security
C · Consulted

Classification rules and review sample

Customs director
A · Accountable
Operations manager
I · Informed
Solutions architect
C · Consulted
Technical PM
I · Informed
Engineers
I · Informed
Customs compliance
R · Responsible
Security
I · Informed

Accuracy testing on real documents

Customs director
I · Informed
Operations manager
R · Responsible
Solutions architect
A · Accountable
Technical PM
C · Consulted
Engineers
R · Responsible
Customs compliance
R · Responsible
Security
I · Informed

Go-live decision

Customs director
A · Accountable
Operations manager
R · Responsible
Solutions architect
C · Consulted
Technical PM
R · Responsible
Engineers
I · Informed
Customs compliance
C · Consulted
Security
C · Consulted

Run, monitor and improve

Customs director
I · Informed
Operations manager
A · Accountable
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
R · Responsible
Customs compliance
C · Consulted
Security
C · Consulted

R ResponsibleA AccountableC ConsultedI Informed· not involved

Where I'd fit

Option A

Lead the architecture

If there's no architect on the programme, I'd own the design end to end: the document pipeline, the tariff index, the agents' permissions, and the integration with your freight and customs software. I'd run the gates and report to your programme board.

Option B

Support your architect

If your partner or your own team already has an architect, I'd take on the document AI, the classification assistant and the customs-software integration under their lead, and give them a second senior opinion on the rest.

Where this goes wrong

  1. Goes wrong

    The demo used clean, typed invoices. Real bundles are scans, photos and invoices in other languages.

    How the design avoids it

    Pilot on last quarter's real bundles, every mode and every client in scope, not a curated sample.

  2. Goes wrong

    Suggested codes get accepted without thought, and duty is underpaid for months.

    How the design avoids it

    Reasons and alternatives shown with every suggestion, a weekly compliance sample, and acceptance rates watched for signs of rubber-stamping.

  3. Goes wrong

    Two documents disagree and the AI quietly picks one.

    How the design avoids it

    Mismatches are always raised to a person with both values shown. The AI never reconciles them on its own.

  4. Goes wrong

    The tariff index goes stale and suggests codes or measures that have changed.

    How the design avoids it

    A scheduled refresh from the official tariff, a version stamp on every suggestion, and an alert if the refresh fails.

  5. Goes wrong

    Someone wires the AI straight to CDS to save a step.

    How the design avoids it

    The customs software stays the only route to HMRC, and the agents' credentials can't submit anything.

On the horizon

Changes already announced or under way that affect this design. More in the UK horizon scan.

  1. From 1 January 2027
    The UK carbon border adjustment mechanism starts for specified aluminium, cement, fertiliser, hydrogen, and iron and steel goods. The first accounting period is calendar 2027, registration opens on 1 January 2028, and the first return and payment are due by 31 May 2028.

    Flag CBAM commodity codes now, and help clients ask their suppliers for embedded-emissions data before the first goods land.

  2. Mid-2027 at the earliest
    A UK–EU SPS agreement. A draft text was reported in early November 2026 but isn't final. The government's stated aim is for it to take effect in mid-2027, removing most export health and phytosanitary certificates for GB–EU agrifood trade. Until then, the Border Target Operating Model applies.

    Hold SPS rules as configuration, not code, so the change is a rule update rather than a rebuild.

  3. After the 2026 consultation
    Mandatory registration for customs intermediaries. HMRC consulted from June to September 2026 on making registration a condition of using its systems, alongside the voluntary Standard for Customs Intermediaries. No date has been set.

    Keep the audit trail of who decided what on every declaration, so it can support registration and compliance checks.

  4. 2027 onwards
    The future of customs data. HMRC and HM Treasury's call for evidence (June to September 2026) asked about customs data and digital trade. The Single Trade Window was paused in late 2024 and HMRC has re-engaged with industry, with no launch date.

    Keep the extracted data in a clean, structured model of your own, so it can feed whatever submission route comes next.

Questions to ask your partner or vendor

Good answers are specific. Vague answers to any of these are worth following up.

Copy them into your next supplier meeting

  1. How do drafts reach our customs software, and does that route keep its validation and CDS link in charge?
  2. How will we measure extraction and classification accuracy on our own document bundles?
  3. Which actions can the agents take without a person, and where is that enforced?
  4. How is the tariff index kept current, and can we see which version produced each suggestion?
  5. Where is our clients' data processed and stored, and is it used to train anyone's model?
  6. What does it cost to run per thousand consignments, at our volume?

Planning something like this?

Whether you need someone to lead the design or to support the architect you already have, let's talk it through.

Sam Naseem
Sam NaseemBirmingham, UK · UK & Europe
Available now