Logistics · Playbook 34

I've worked in this sector

EDI exception handling

Every failed or mismatched EDI message diagnosed within minutes, with a proposed fix or a ready-to-send note to the partner's EDI desk. A person approves every resubmission, and a replay can never post the same order or invoice twice.

  • Event-driven integration
  • Agents with tools
  • Retrieval (RAG)
  • Human in the loop
  • Trading partner agreements
  • HMRC VAT invoicing
  • HMRC e-invoicing (2029)
  • GS1 UK standards
  • UK GDPR

At a glance

The problem
A few per cent of EDI messages fail validation or don't match, and each one is diagnosed by hand from raw segments and partner manuals
Typical volume
Around 250,000 messages a month with 60 customers and 200 suppliers; 2–4% raise an exception
Who's involved
EDI analysts, the integration team, customer service, finance, the warehouse, trading partners' EDI desks, your VAN provider
Pilot
6–8 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

A distributor's EDI runs all day without anyone noticing, until it doesn't. Retail customers send orders (EDIFACT ORDERS, often to the GS1 EANCOM subset) through a VAN. The distributor replies with order responses, sends despatch advices (DESADV, the ASN) as the trucks leave, and invoices (INVOIC) after delivery. Suppliers send the same in reverse, some in X12 (850, 856, 810) over AS2, some in GS1 XML, and a few in CSV over SFTP. A 3PL warehouse sends receipts and stock messages of its own.

A small share of those messages fail, and every failure lands on an EDI analyst. Some fail validation: a missing mandatory segment, a qualifier the map doesn't know, a reused control number. More fail on business rules: a GTIN that isn't in the product master, a price that doesn't match the agreed price, an ASN whose quantities or SSCCs don't match the order, an invoice for goods the warehouse hasn't received. The analyst opens the raw interchange, reads the segments, checks the partner's implementation guide, looks the order up in the ERP and the WMS, and works out whether the fix is ours or theirs.

The cost shows up elsewhere. A rejected order is a missed delivery slot. A late or wrong ASN can mean a retailer's compliance charge or a refused delivery. A rejected invoice is cash that arrives weeks late. And the classic failure of manual fixes is a resubmission that posts the same order or invoice twice.

What AI changes

  • Every exception is picked up the moment it happens, from the translator, the business validation rules, a negative functional acknowledgement (CONTRL, 997 or 999) or a missing AS2 receipt (MDN).
  • The agent reads the raw message, the error, the partner's implementation guide and the related order, ASN or receipt, then says what failed, why, and whose side the fix is on.
  • Where the fix is ours, it proposes one: a master-data correction, a cross-reference to add, a mapping change to test, or a corrected outbound message staged for approval.
  • Where the fix is the partner's, it drafts a note to their EDI desk from an approved template, quoting the interchange reference and the exact segment and value at fault.
  • An analyst approves every resubmission. Replays run from the stored original, through the same validation, and an idempotency check means a replay can never create a duplicate order, ASN or invoice.
  • Repeat causes are counted by partner and by root cause, so the integration team fixes problems at the source instead of clearing the same exception every day.

How success is measured

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

Time to resolve

From the exception being raised to the message being successfully processed.

ExampleFrom a day or more to under 2 hours

Diagnosis agreement

How often analysts agree with the agent's root cause. Very low means it isn't helping; near 100% can mean nobody is checking.

ExampleStable, and reviewed weekly

Duplicate postings

Orders, ASNs or invoices posted twice because of a resubmission.

ExampleZero

Repeat exceptions

Exceptions whose root cause has been seen before for the same partner.

ExampleFalling month on month

Missed or late ASNs

Despatch advices that missed a retailer's deadline or were rejected.

ExampleDown by half

Invoice rejections

Invoices rejected by customers, and the days of cash they delay.

ExampleMeasured against last year

UK regulation and controls

Cross-sector rules are on the UK regulation map.

  • Trading partnersTrading partner agreements and implementation guides

    Each partner sets its own message versions, mandatory fields, timings and, often, charges for late or inaccurate ASNs. The agent works from the current version of each guide, held under change control, and every proposed fix is checked against that partner's rules before an analyst sees it.

  • HMRCVAT invoices (VAT Notice 700) and correcting errors (VAT Notice 700/45)

    An EDI invoice is a VAT invoice. If one is rejected, it is corrected at source and re-issued, or put right with a credit note, under finance's control. The agent never changes the amounts, VAT or tax point on an invoice in transit, and never edits a supplier's invoice to make it match.

  • HMRCMandatory e-invoicing from 1 April 2029 (roadmap published 28 October 2026)

    VAT invoices between VAT-registered businesses must be exchanged as structured e-invoices through Peppol, via a certified access point. PDFs and emails won't count. Existing EDI can continue, but the business must also be able to exchange e-invoices through the new framework, and HMRC plans guidance on EDI and legacy systems in autumn 2027.

  • GS1 UKGS1 identifiers and EDI standards (GTIN, GLN, SSCC, EANCOM, GS1 XML)

    Most business-rule failures are identifier problems: an unknown GTIN, a delivery location GLN that has changed, a reused SSCC. The agent checks identifiers against the product and partner master data and proposes corrections there, never in the message.

  • ICOUK GDPR and the Data Protection Act 2018

    Orders for home delivery and trade accounts carry names, addresses and phone numbers. That means a light DPIA, collecting only what's needed for diagnosis, masking personal data in prompts and logs where possible, a clear retention period, and a contract that stops providers training their models on your data.

  • NCSCCyber Essentials and supplier assurance

    The EDI gateway holds the keys that let partners trust your messages. AS2 private keys live in a vault or HSM, partner certificates are tracked with expiry alerts, access to the gateway is role-based, and the agent has no access to keys or connection settings at all.

The solution

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

EDI exception handling: reference architecture
  1. 01Channels

    • Retail customers via VAN
    • Suppliers via AS2 and SFTP
    • 3PL warehouse
    • Partners' EDI desks
  2. 02Intake

    • AWS Transfer FamilyLogic Apps AS2 + Integration AccountOpenAS2, or your existing EDI gatewayAS2 and SFTP gateway
    • B2B Data Interchange (X12) or your EDI translatorLogic Apps X12 and EDIFACTYour EDI translator, or open-source parsers (e.g. Smooks)Translate and validate
    • S3 with Object LockBlob immutable storageCeph with object lockRaw message archive
  3. 03Intelligence

    • Bedrock Knowledge BasesFoundry IQ (Azure AI Search)OpenSearch, or PostgreSQL with pgvectorPartner guides and mapping specs
    • Agent
      Bedrock AgentCoreFoundry Agent ServiceLangGraph on KubernetesEDI exception agent
  4. 04Orchestration

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

    • ERP: orders and invoices
    • WMS: receipts and despatch
    • Product and partner master data
  6. 06People

    • Person
      EDI analyst: approves fixes and replays
    • Person
      Integration team: mapping changes
    • Person
      Finance: invoice corrections
  • Cloud or platform service (AWSAzuresovereign / on-prem)
  • AI agent
  • A person decides
  • Your existing systems
  • Outside your organisation

Components, side by side

EDI exception handling: components on AWS, Azure and a sovereign or on-prem stack
LayerAWSAzureSovereign / on-prem
Transport: AS2, SFTP, VANKeep your VAN mailbox and any Peppol access point with their providers. This layer only collects and delivers.AWS Transfer Family (AS2 and SFTP)Logic Apps AS2 (v2) with an Integration AccountOpenAS2, or your existing EDI gateway
Translation and mappingB2B Data Interchange supports X12 only, and check its region list before relying on it for UK residency. EDIFACT is widely used across Europe.AWS B2B Data Interchange for X12; your existing translator for EDIFACTLogic Apps X12 and EDIFACT actions with an Integration AccountYour existing EDI translator, or open-source parsers (e.g. Smooks)
Raw message archiveStore every interchange exactly as received or sent, before anything else touches it.Amazon S3 with Object LockBlob Storage with immutable storageCeph with object lock, or IONOS S3 Object Storage
Canonical message modelOne internal shape for an order, ASN and invoice, whatever the partner's format. Maps translate to and from it.JSON schemas in your code repositoryJSON schemas in your code repositoryJSON schemas in your code repository
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
Partner knowledge (retrieval)Indexed from partners' implementation guides, your mapping specs, GS1 and EANCOM documentation, and past resolved exceptions.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
Exception and replay workflowReplay is a fixed workflow step, not something the agent does.AWS Step FunctionsLogic Apps or Durable FunctionsTemporal
Events and queuesAmazon EventBridge, SQS (with dead-letter queues)Event Grid, Service Bus (with dead-letter queues)Apache Kafka or RabbitMQ
Idempotency storeKeyed on sender, interchange control reference and business document number.Amazon DynamoDBAzure Cosmos DBPostgreSQL
Link to ERP and WMSReuse the integration layer you have. Don't buy a new one for this.API Gateway, plus your existing integration platformAPI Management, plus your existing integration platformKong or your existing API gateway, plus your existing integration platform
Human reviewAnalysts approve where they already work, with the raw segments and the proposed fix side by side.In the EDI team's existing monitoring console or service deskIn the EDI team's existing monitoring console or service deskIn the EDI team's existing monitoring console or service desk
GuardrailsBedrock GuardrailsFoundry guardrails (Azure AI Content Safety)Open-source guardrails (e.g. NeMo Guardrails, Llama Guard)
Identity, keys, certificatesTrack every partner certificate's expiry. The agent never sees keys.IAM Identity Center, KMS, Secrets ManagerEntra ID, Key Vault (holds the Integration Account's AS2 keys)Keycloak or your existing Active Directory; OpenBao or HashiCorp Vault; an HSM
Monitoring and auditLog every diagnosis, every approval and every replay against the interchange reference.CloudWatch, CloudTrailAzure Monitor, Log Analytics, Integration Account B2B trackingPrometheus, 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 ERP, the WMS, the master data and, often, the EDI translator stay where they are. Many distributors run these on their own servers or with a managed EDI provider, and nothing in this design moves them.

Uses cloud AI

The exception agent, the partner-guide index and the replay workflow can run in AWS or Azure UK regions, or on your own servers with open-weight models if partner agreements keep message data in your estate.

How they connect

A private link (AWS Direct Connect or Azure ExpressRoute) and the API layer. The translator publishes exception events to the queue. Only the failing message, its error and the related records go to the agent, and proposed fixes come back as tasks, never as direct writes.

If the link drops

EDI keeps flowing, because transport, translation and posting don't depend on the AI. Exceptions queue on your side and analysts work them as they did before, and the agent catches up on diagnosis 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.

EDI exception agent

May do

  • Read the raw interchange, the translator's error and any CONTRL, 997, 999 or MDN response
  • Look up the partner's profile, implementation guide and mapping spec
  • Look up the related order, ASN, receipt or invoice in the ERP and WMS (read only)
  • Classify the failure and its root cause, and say whose side the fix is on
  • Propose a master-data correction, a cross-reference or a mapping change, as a draft for the owning team
  • Stage a corrected outbound message, or a replay of the stored original, for approval
  • Draft a note to the partner's EDI desk from an approved template

May not do

  • Resubmit, replay or send any message without approval
  • Change the business content of a message a partner sent: prices, quantities, items or dates
  • Create, change or cancel an invoice or credit note
  • Change a mapping, partner profile, certificate or connection in production
  • Change master data directly
  • Send anything to a partner itself

Where a person signs offAn EDI analyst approves every replay, every corrected message and every note to a partner. Mapping changes go through the integration team's change control and test pack. Anything touching an invoice goes to finance. The agent's permissions are enforced by the platform's identity and policy controls, not by instructions in a prompt.

Middleware and integration

Think of EDI as layers, because each one fails differently. Transport: AS2 over HTTPS with a signed MDN as the receipt, SFTP, or a VAN mailbox. Envelope: the EDIFACT UNB and UNH headers, or the X12 ISA, GS and ST headers, with their control numbers. Translation: EDIFACT, X12 or GS1 XML turned into one canonical internal shape. Business validation: does the GTIN exist, does the price match, is there an open order. Posting: into the ERP or WMS through the API layer. The agent's first job is to say which layer failed.

Store first, then process. Every interchange is written to an immutable archive exactly as received or sent, with a fingerprint, before translation starts. Every later step refers back to it. That makes diagnosis possible weeks later, and it means a replay always starts from what the partner actually sent, not from someone's edited copy.

Idempotency is what makes replay safe. Each message carries a key built from the sender, the interchange control reference and the business document number: the order number and version, the ASN's shipment number, the supplier and invoice number. Before posting, the workflow checks the key. If it has already been posted, the replay is recorded and does nothing. Outbound corrections get new control numbers and use the message function the partner's guide allows (original, replacement or cancellation), so the partner's own duplicate checks work too.

Receipts are not the same as acceptance. An AS2 MDN proves the partner's server received the file. A CONTRL, 997 or 999 says whether the syntax was accepted. Only a business response, such as an order response or a remittance, says the content was. The workflow tracks all three with timers, so a missing acknowledgement becomes an exception instead of a surprise a week later.

Everything is queued, with dead-letter queues for what can't be processed. If the ERP is down, inbound orders wait safely and post in order when it returns. If the agent is down or switched off, exceptions go straight to analysts exactly as they do today. The EDI flow itself never depends on the AI.

Process and people

  • An exception taxonomy agreed up front (transport, envelope, syntax, code list, master data, business rule), so the agent, the analysts and the reports use the same words.
  • Approval rules: which exception types an analyst approves alone, which need the integration team, and which go to finance.
  • A library of approved partner templates, owned by the EDI lead, with the analyst editing and sending each one.
  • A monthly repeat-cause review by partner, feeding fixes back into mappings, master data and partner onboarding.
  • A certificate and connection register with named owners and expiry alerts, including partners' certificates as well as your own.
  • A named owner for every prompt, partner guide and mapping spec in the index, with change control like any other integration artefact.

Delivery plan

  1. 2–3 weeks

    Discovery

    Export three months of exceptions, classify them by layer and root cause, measure time to resolve, and check access to the archive, translator logs and partner guides.

  2. Gate · must be true to passBaseline agreed, top exception types and partners chosen, archive and log access confirmed, DPIA started.

  3. 6–8 weeks

    Pilot

    Inbound orders and outbound ASNs for the five busiest retail customers, in shadow mode: the agent diagnoses and proposes, analysts work as normal, and the two are compared. Idempotency checks go live first, before any automated replay.

  4. Gate · must be true to passDiagnosis agreement within agreed limits, zero duplicate postings in replay testing, and EDI lead sign-off.

  5. 4–6 weeks

    Production

    Proposals and staged replays go live for the pilot partners, with monitoring, the approval rules and a rollback plan.

  6. Gate · must be true to passMonitoring, support model, approval rules and analyst training in place.

  7. Ongoing

    Scale

    Add invoices (with finance), supplier flows and the 3PL one at a time, then use the same pipeline when Peppol e-invoicing arrives.

  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
ActivitySupply chain directorEDI and integration leadSolutions architectI can fill thisTechnical PMI can fill thisEngineersI can fill thisFinanceSecurityI can fill this
Business case and benefitsAccountableResponsibleConsultedConsultedInformedConsultedInformed
Target architectureInformedConsultedAccountable and ResponsibleConsultedConsultedInformedConsulted
Idempotency and replay designInformedConsultedAccountableConsultedResponsibleConsultedConsulted
Approval rules and partner templatesInformedAccountable and ResponsibleConsultedConsultedInformedConsultedInformed
Invoice correction rulesInformedConsultedConsultedInformedInformedAccountable and ResponsibleInformed
Go-live decisionAccountableResponsibleConsultedResponsibleInformedConsultedConsulted
Run, monitor and improveInformedAccountableConsultedConsultedResponsibleInformedConsulted

Business case and benefits

Supply chain director
A · Accountable
EDI and integration lead
R · Responsible
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
I · Informed
Finance
C · Consulted
Security
I · Informed

Target architecture

Supply chain director
I · Informed
EDI and integration lead
C · Consulted
Solutions architect
A/R · Accountable and Responsible
Technical PM
C · Consulted
Engineers
C · Consulted
Finance
I · Informed
Security
C · Consulted

Idempotency and replay design

Supply chain director
I · Informed
EDI and integration lead
C · Consulted
Solutions architect
A · Accountable
Technical PM
C · Consulted
Engineers
R · Responsible
Finance
C · Consulted
Security
C · Consulted

Approval rules and partner templates

Supply chain director
I · Informed
EDI and integration lead
A/R · Accountable and Responsible
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
I · Informed
Finance
C · Consulted
Security
I · Informed

Invoice correction rules

Supply chain director
I · Informed
EDI and integration lead
C · Consulted
Solutions architect
C · Consulted
Technical PM
I · Informed
Engineers
I · Informed
Finance
A/R · Accountable and Responsible
Security
I · Informed

Go-live decision

Supply chain director
A · Accountable
EDI and integration lead
R · Responsible
Solutions architect
C · Consulted
Technical PM
R · Responsible
Engineers
I · Informed
Finance
C · Consulted
Security
C · Consulted

Run, monitor and improve

Supply chain director
I · Informed
EDI and integration lead
A · Accountable
Solutions architect
C · Consulted
Technical PM
C · Consulted
Engineers
R · Responsible
Finance
I · Informed
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 layers, the canonical model, the idempotency and replay design, the agent's permissions, and the links to your ERP and WMS. Order and supply platforms live or die by their EDI, because EDI is where your platform meets everyone else's, so the replay and reconciliation design comes first. 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 EDI layer, the exception agent and the replay workflow under their lead, and give them a second senior opinion on the rest.

Where this goes wrong

  1. Goes wrong

    The agent "fixes" a message by editing its contents, and the ERP now holds an order the customer never sent.

    How the design avoids it

    Partner content is never edited. Fixes go into master data, cross-references or mappings, and the stored original is replayed.

  2. Goes wrong

    A resubmission posts the same order or invoice twice.

    How the design avoids it

    Idempotency keys checked before every posting, so a replay of something already posted does nothing.

  3. Goes wrong

    An AS2 certificate expires on a Friday night and a major customer's orders stop.

    How the design avoids it

    A certificate register with alerts well ahead of expiry, a renewal runbook agreed with each partner, and monitoring for missing MDNs.

  4. Goes wrong

    The same exception is cleared by hand every day for months.

    How the design avoids it

    Repeat causes counted by partner and root cause, with a monthly review that fixes them at the source.

  5. Goes wrong

    A partner receives an off-script email that promises something the business can't do.

    How the design avoids it

    Approved templates only, and an analyst edits and sends every note.

On the horizon

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

  1. 15 March 2027, then 15 March 2029
    Public TLS certificates already last at most 200 days (since 15 March 2026). The maximum falls to 100 days in March 2027 and 47 days in March 2029, under a CA/Browser Forum decision.

    If partners reach your AS2 endpoint over HTTPS with a public certificate, automate its renewal now, and keep the AS2 signing and encryption certificates in the same register.

  2. Spring 2027 to 1 April 2029
    Mandatory B2B and B2G e-invoicing on Peppol. HMRC plans a technical consultation on standards and access point certification in spring 2027, guidance on EDI and legacy systems in autumn 2027, and go-live on 1 April 2029.

    Keep one canonical invoice model, so the same invoice can go out as EDIFACT, X12 or Peppol. Choose a certified Peppol access point provider rather than building one.

  3. Expected 2027
    The Commercial Payments Bill, introduced in May 2026 and still before Parliament, would cap payment terms for large firms paying smaller suppliers at 60 days and make late-payment interest mandatory.

    Measure the days lost to rejected invoices now. Faster fixes for invoice exceptions will matter more once terms are capped.

  4. Late 2026 to 2028
    The Cyber Security and Resilience Bill brings medium and large managed service providers into regulation, with duties set by secondary legislation by about 2028.

    If a managed provider runs your EDI or VAN, expect new duties on them and update your contracts and supplier assurance.

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 you stop a replay from posting the same order or invoice twice?
  2. Where is the original message kept, and can anyone change it?
  3. Which actions can the agent take without a person, and where is that enforced?
  4. How do you handle EDIFACT, not just X12, on the platform you're proposing?
  5. Who owns the partner guides and mapping specs the agent relies on after you leave?
  6. How will this carry over to Peppol e-invoicing in 2029?

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