Trade Compliance Copilot
Outcome
Let the trade compliance specialist classify goods, validate restricted-party and licensing exposure, and assemble a defensible customs declaration file where every HS code, duty rate and exemption is traceable to a binding ruling, tariff schedule note or explanatory note.
| Portfolio attribute | Value |
|---|---|
| Primary persona | Compliance specialist |
| Primary aggregate | CustomsDeclaration |
| Cosmos DB containers | 3 |
| Grounding data | products, tariffs, rulings, shipment documents |
| Development estimate | USD 60-220 monthly dev estimate |
| Runtime options | Python FastAPI and C# ASP.NET Core |
Productivity hypothesis
These measures reflect the workflow, evidence, decision boundary, and industry risk for this use case.
| Impact type | Measure | Conservative internal assumption | Customer measurement |
|---|---|---|---|
| Productivity | Compliance evidence discovery time | 15-25% reduction | (baseline median evidence-search minutes - assisted median evidence-search minutes) / baseline median evidence-search minutes * 100 |
| Quality or risk | Citation and classification completeness | 5-10 percentage-point improvement | assisted percentage meeting the citation and classification-evidence rubric - baseline percentage |
Important: Conservative internal pilot assumptions only; not public benchmarks, commitments, or expected customer results. Validate against a comparable baseline or matched control cohort with mandatory human review.
Rationale: Products, tariffs, rulings, and documents make faster authoritative evidence assembly the most defensible impact.
Pilot guardrail: Compliance specialists review classification, tariff, ruling, and legal interpretation before action.
Customer validation plan
- Baseline the current workflow with representative users and tasks.
- Run the accelerator on the same task mix with human review retained.
- Measure compliance evidence discovery time and citation and classification completeness with the documented formulas.
- Replace internal assumptions with customer-observed results before a business case.
Why Azure Cosmos DB
This AI solution needs an operational data plane, not only a vector index:
- Hybrid vector and full-text retrieval combines semantic recall with exact identifiers, codes, names, and domain language.
- Hierarchical partition keys and metadata predicates keep tenant and domain boundaries in the normal query path.
- Operational JSON, source chunks, workflow and agent state, feedback, and audit records remain together for low-latency reads and governed writes.
- Change feed reacts to source and operational updates without polling.
- Autoscale throughput, configurable consistency, and multi-region distribution support variable demand and enterprise availability.
Domain workflow

| Stage | Actor | Input → output | Approval |
|---|---|---|---|
| 1. Commercial document extraction | Document ingestion pipeline | commercialInvoicePdf → LineItem | Policy controlled |
| 2. Candidate heading retrieval | Classification retriever | LineItem → candidateHeadingSet | Policy controlled |
| 3. Ruling and rule-of-origin grounding | Trade compliance copilot | candidateHeadingSet → ClassificationOpinion | Policy controlled |
| 4. Restricted-party and license screening | Screening service with specialist review | Declaration → ScreeningResult | Human required |
| 5. Specialist sign-off and broker filing | Compliance specialist | ClassificationOpinion → filedDeclaration | Human required |
Technical architecture

Cosmos DB data model
| Container | Hierarchical partition key | Documents | Search paths |
|---|---|---|---|
customsDeclarations | /tenantId, /declarationId | Declaration, LineItem, ScreeningResult, ClassificationOpinion | /descriptionVectorEmbedding, /rationaleVectorEmbedding, /descriptionVector, /rationaleVector |
tariffScheduleCatalog | /tenantId, /hsChapter | TariffRuleChunk | /chunkVectorEmbedding, /chunkVector |
customsRulingIndex | /tenantId, /rulingId | BindingRulingChunk | /chunkVectorEmbedding, /chunkVector |
Query contract
| Query | Container | Scope | Purpose |
|---|---|---|---|
| UnclassifiedLinesForDeclaration | customsDeclarations | single-partition | List the lines still needing a classification decision before the declaration can be filed. |
| TariffRuleHybridRetrieval | tariffScheduleCatalog | single-partition | Retrieve chapter notes and rules of origin relevant to a candidate heading in the importing jurisdiction. |
| PrecedentRulingLookup | customsRulingIndex | cross-partition-bounded | Surface binding rulings on similar commodities to support or challenge the proposed heading. Intentional cross-partition fan-out across the customsRulingIndex reference container, bounded by the tenant prefix, the candidate heading prefix and a precedent lookback window, returning only the top-ranked ruling chunks. |
| OpenScreeningHits | customsDeclarations | single-partition | Show unresolved restricted-party matches that block filing. |
Python and C# services route each document type to its declared container and hierarchical partition key. ETag-based writes protect mutable aggregates, while append-only records and bounded cross-partition queries preserve scale.
Azure deployment

Clone the source repository, authenticate with Azure, and run:
Set-Location accelerators/transportation-logistics/trade-compliance-copilot
az login
./Deploy.ps1 -Runtime python -Location eastus2
Change python to csharp to deploy the .NET implementation.
Explore the implementation
- Launch signed-in demo
- Implementation article
- Domain data model
- Workflow and API contract
- Python application
- C# application
- Domain container Bicep
- Platform Bicep
- Cost and configuration
- Source repository