Back to Blog

AI Agents and Logistics Data Access

What an AI agent may read and write in a TMS or WMS, which actions need a human, and how to test an agent against real freight documents.

Esnaj Team

An AI agent is a system that can select and execute actions against your tools and APIs, not just generate text. In logistics that distinction decides the entire design: a text model that drafts a reply to a customer is a different risk from an agent that can book a slot, change a rate, or release a container.

The first question is not which model to use. It is which actions may run without a human.

Action classes and supervision

ClassExamplesSupervision
Read internal recordsShipment status, stock, invoicesLog the query; no approval needed
Read external documentsInbound PDFs, emails, EDI payloadsTreat as untrusted input; validate before acting
Draft outputCustomer reply, exception summary, checklistHuman sends
Write internal, reversibleTag a shipment, create a task, flag an exceptionAllowed with an audit trail and undo
Write operationalUpdate an ETA, reassign a delivery, book a slotApproval or a rule the agent may not redefine
Write financialChange a rate, approve an invoice, issue a creditHuman signature, always
Delete or releaseDelete records, release goods from customs holdNot delegated

Most teams get value from the first three classes. The fourth is where automation becomes real work. The last three are where an agent becomes an incident.

Prompt injection is a logistics problem

Logistics ingests documents written by parties it does not control: supplier invoices, packing lists, carrier emails, scanned CMRs. Any of those can contain text that reads like an instruction. An agent that treats document content as instructions can be steered by the document.

The defenses are structural, not prompt-level:

  • Separate content from instructions. Document text is data. Tool calls come from a fixed, reviewed set, not from text the document contains.
  • Validate before writing. An invoice number extracted from a PDF is a string until it matches a known supplier and open order.
  • Limit blast radius. Read-only credentials for the agent; write operations through a narrow service with its own authorisation.
  • Rate and value limits. A booking agent that can create 4,000 slots has a different failure mode from one capped at five per hour.

Keep the deterministic core

Rules that are auditable should stay deterministic. If a customer’s rate is a formula, a rules engine applies it. If a shipment is late by a defined threshold, an event triggers an alert.

Agents are best at triage: reading a messy document, deciding which of twelve exception categories applies, summarising a thread, proposing the next action. That is genuinely useful, and it is also the part that fails silently. So log every decision, with the input, the tool call, the output and the model version. When a customer asks why a shipment was reprioritised, “the model decided” is not an answer.

How to test before production

TestMethodPass condition
Extraction accuracy50 real documents, reviewed reference valuesField-level accuracy agreed per field, not overall
Exception routingKnown exceptions with expected categoriesCorrect category and no silent drop
Refusal behaviourDocuments containing instructionsAgent does not act on them
Tool permissionAttempt a forbidden writeBlocked and logged
RepeatabilitySame input twiceSame decision, or an explained difference
Cost per documentMeasured tokens and callsWithin the agreed budget

A demo with five clean documents proves nothing. The review queue is where the project is won or lost — the OCR accuracy article makes the same point for extraction, and it applies directly here.

The wider risk picture is covered in Agentic AI for supply chain risk and compliance. For the document layer an agent needs, see document extraction. The same permission model has to hold in the system the agent acts on, which is why it belongs in custom software development rather than in a prompt. To scope an agent against your own exception queue, contact Esnaj.

Frequently Asked Questions

Q: What is the difference between an AI assistant and an AI agent? A: An assistant produces text or suggestions. An agent executes actions against systems. The second needs permissions, audit logging and a rollback path.

Q: Should an AI agent be allowed to change rates or approve invoices? A: No. Financial writes should stay with a human signature. Agents can prepare the decision and assemble the evidence.

Q: Can prompt injection come from a scanned document? A: Yes. Any text a supplier or carrier controls can contain instructions, which is why document content must be treated as data and tool calls must come from a fixed reviewed set.