Logistics operations run on documents that resist traditional automation. Bills of lading, customs declarations, proof-of-delivery photos, and email threads contain critical structured data, but the formats vary by carrier, region, and lane. Large language models can extract entities, classify exceptions, and trigger downstream workflows, yet production deployments often stall when token costs scale linearly with document length. Oxlo.ai addresses this with request-based pricing: one flat cost per API call regardless of input size. For logistics teams processing long manifests or multi-turn agentic workflows, this model removes the penalty for context.
The Unstructured Data Problem
Freight forwarding and third-party logistics providers handle thousands of documents daily. A single shipment might generate a booking confirmation, a commercial invoice, a packing list, and arrival notices, each in a different layout. Traditional OCR and template-based extraction require brittle maintenance. LLMs generalize across layouts, but they also introduce new infrastructure concerns: prompt management, tool orchestration, and cost control. The goal is to treat documents as events that feed directly into transport management systems, warehouse management systems, and customer notification queues.
Agent Architecture for Logistics
A practical logistics agent combines three layers: ingestion, reasoning, and action. Ingestion covers text, PDFs, images, and EDI messages. Reasoning uses an LLM to parse intent, extract entities, and detect anomalies. Action relies on function calling to update TMS records, send alerts, or reroute cargo.
Because logistics workflows are stateful, multi-turn conversations are common. An agent might ask a shipper to clarify a harmonized system code, then call a rate API, then generate a customs entry. Each turn adds context. Under token-based billing, the cost of that conversation grows with every message. On Oxlo.ai, the cost stays flat per request, which makes stateful agents economically viable.
Code Example: Extracting Shipment Details
The following Python script uses the OpenAI SDK with Oxlo.ai to extract structured fields from an unstructured bill of lading. It defines a function schema so the model returns normalized JSON.
import os
import json
import openai
client = openai.OpenAI(
base_url="https://api.oxlo.ai/v1",
api_key=os.environ["OXLO_API_KEY"]
)
bol_text = """
SHIPPER: ACME Manufacturing Ltd. Shanghai, China
CONSIGNEE: Global Retail Inc. Los Angeles, CA
VESSEL: EVER GLORY V. 2412E
POL: Shanghai
POD: Los Angeles
CONTAINER: MSCU1234567, MSCU7654321
GROSS WEIGHT: 18,420 KGS
"""
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": "You are a logistics document parser."},
{"role": "user", "content": f"Extract structured data:\n\n{bol_text}"}
],
tools=[
{
"type": "function",
"function": {
"name": "extract_bol",
"description": "Extract bill of lading fields",
"parameters": {
"type": "object",
"properties": {
"shipper": {"type": "string"},
"consignee": {"type": "string"},
"port_of_loading
Top comments (0)