What Is the US Trade Deficit? How AI Agents Answer Complex Trade Questions
Your AI can answer trade policy questions with live data from UN Comtrade, Census Bureau, Treasury, FRED, and BLS through Pipeworx TradeGuard — 22 tools.
“What is the US trade deficit with China?” is a simple question with a complicated answer. The number depends on which source you use (Census vs. Comtrade), which goods you include (goods only vs. goods and services), and which time period you’re looking at.
An AI answering from training data gives you a stale number with no source attribution. An AI with Pipeworx TradeGuard pulls live data from the Census Bureau, UN Comtrade, and the US Treasury — the same sources that trade policy analysts and economists use — and can show you exactly where the number comes from.
What’s inside TradeGuard
UN Comtrade
The United Nations maintains the most comprehensive international trade database in the world — bilateral trade flows for 200+ countries, broken down by HS commodity code.
comtrade_trade_data— bilateral trade flows between any two countries by commodity and yearcomtrade_top_partners— top import/export partners for any countrycomtrade_top_commodities— top traded commodities between any two countriescomtrade_country_codes— reference data for Comtrade country identifiers
Census Bureau International Trade
The authoritative source for US import and export data, published monthly with detailed commodity and country breakdowns.
census_imports— US imports by HS code, country, and monthcensus_exports— US exports by HS code, country, and monthcensus_trade_balance— trade balance with any country or region, monthlycensus_trade_trends— year-over-year trade trend analysis
US Treasury
Customs duty revenue, government receipts, exchange rates, and national debt data.
treasury_customs_revenue— customs duty collections (direct measure of tariff revenue)treasury_receipts— federal government receipts by categorytreasury_debt— national debt datatreasury_exchange_rates— official Treasury exchange rates
FRED and BLS
Economic context: FRED trade balance time series, import/export price indices, CPI, and macro indicators. BLS import/export price indices and employment data.
Example: Trade deficit deep dive
Ask your AI: “What is the US trade deficit with China and how has it changed?”
TradeGuard chains:
census_trade_balance— current US-China trade balance with monthly breakdowncensus_trade_trends— year-over-year trend showing whether the deficit is growing or shrinkingcomtrade_top_commodities— what the US buys from China and what it sellstreasury_customs_revenue— how much tariff revenue is being collectedfred_get_series— broader trade deficit series for historical context
Five data sources, one coherent answer with full provenance.
Example: Tariff impact analysis
Ask: “How have tariffs on steel imports affected trade volumes and customs revenue?”
TradeGuard chains:
census_imports— steel import volumes by country, monthlytreasury_customs_revenue— customs duty revenue trendscomtrade_top_partners— which countries supply US steel importsbls_get_series— steel import price indicesfred_get_series— industrial production and steel consumption indicators
Example: Export opportunity research
Ask: “What are the top US exports to the EU by commodity?”
TradeGuard returns:
comtrade_top_commodities— ranked commodity exports to EU countriescensus_exports— detailed monthly export data by HS codeget_exchange_rate— current USD/EUR rate for value context
Who uses this
- Trade policy analysts tracking bilateral trade flows and tariff impacts
- Importers and exporters monitoring duties, volumes, and market shifts
- Supply chain managers identifying sourcing risks and alternative markets
- Economists analyzing trade balances, terms of trade, and macro impacts
- Journalists investigating trade policy claims with actual data
Connect
{
"mcpServers": {
"pipeworx-trade": {
"url": "https://gateway.pipeworx.io/mcp?vertical=trade"
}
}
}
Or call ask_pipeworx with any trade question.
Trade data is produced by the Census Bureau, United Nations, US Treasury, Federal Reserve, and BLS. These are the definitive sources — not estimates, not projections, not commentary. When your AI says the trade deficit is a specific number, it can cite exactly where that number comes from.