Toldagent: an agent that drafts customs declarations
The question. Can an agent with human approval draft correct Danish import declarations from invoices and shipping papers?
what I built
An MCP server with the 2026 customs code table, a customs value calculator and exchange rates, plus one tool that can only write drafts. A person approves every draft. It reads PDFs and scans with local text recognition.
Python · MCP · Claude subagents · pdftotext · Apple Vision OCR · EU Publications Office data
what happened
- Baseline with no model: 1 of 50 correct 8-digit customs codes.
- Version 1 got 29 of 50 and version 2 got 31 of 50. The customs value was within 1 percent in 50 of 50.
- On 25 cases the agent was never tuned on, version 2 got 14 correct codes and version 1 got 13. So the gain from version 2 is not proven.
- On 7 real PDFs and scans it got 4 of 7 codes and 7 of 7 values. A rule-based baseline got 0 of 7 on the new layouts.
Cost. Estimated at about 1.2 to 1.5 kroner per declaration. Never measured.
what broke
- Version 2 was tuned on the mistakes version 1 made on the same 50 cases, so its score on them was too optimistic. The held-out set showed it.
decision
Stopped. Importers are a different customer from the rest of my work, and cold email to businesses is not allowed in Denmark. No customers and no emails sent.
Every number on this page comes from the project's own logs, analytics or database. Back to the lab.