Building a Demographic Research Workflow with Claude Code
Demographic research usually involves a lot of manual data gathering — visiting Census Bureau tables, downloading CSVs, cross-referencing variables. With AgentPatch connected, Claude Code can pull population, income, education, and housing data directly from the American Community Survey and assemble a demographic profile in a single session.
Why This Matters
Whether you’re scoping a new market, writing a grant proposal, or building a civic data product, the first step is usually the same: build a demographic profile of a region. That means pulling total population, age distributions, income levels, education attainment, racial composition, and housing data — then making sense of it together.
Doing this manually means navigating data.census.gov, decoding table IDs, and stitching together multiple exports. With the Census Data tool, Claude Code handles the data collection so you can focus on interpretation and next steps.
Setup
Install the AgentPatch CLI (zero dependencies, Python 3.10+):
pip install agentpatch
Set your API key:
export AGENTPATCH_API_KEY=your_api_key
Then use it:
ap search "web search"
ap run agentpatch google-search --input '{"query": "test"}'
Get your API key from the AgentPatch dashboard.
Run this command to add AgentPatch as an MCP server:
claude mcp add -s user --transport http agentpatch https://agentpatch.ai/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
Replace YOUR_API_KEY with your actual key from the AgentPatch dashboard. Claude Code discovers all AgentPatch tools automatically.
Example
You’re putting together a regional profile for a client presentation. You tell Claude Code:
“Build a full demographic profile for Harris County, Texas. I need population, median age, income stats, education levels, racial breakdown, and housing data. Format it as a report I can paste into a slide deck.”
Claude Code makes multiple calls to the Census Data tool, pulling different variable groups:
Fetching population and age data for Harris County, TX...
Fetching income and poverty data...
Fetching education data...
Fetching racial demographic data...
Fetching housing data...
Harris County, Texas — Demographic Profile (2023 ACS 5-Year Estimates)
POPULATION
- Total population: 4,728,030
- Median age: 33.8
INCOME & EMPLOYMENT
- Median household income: $61,705
- Per capita income: $33,147
- Poverty rate: 15.2%
- Unemployment rate: 5.1%
EDUCATION
- Bachelor's degree or higher: 33.4%
DEMOGRAPHICS
- White: 1,683,280 (35.6%)
- Black: 898,326 (19.0%)
- Hispanic: 2,033,053 (43.0%)
- Asian: 340,418 (7.2%)
- Foreign-born: 1,183,208 (25.0%)
HOUSING
- Total housing units: 1,782,435
- Median home value: $213,800
- Median rent: $1,148
- Health insurance coverage: 77.8%
Writing this to output/harris-county-profile.md. Want me to also
generate comparison data for surrounding counties?
Claude Code pulled 16 variables across five categories, formatted them into a clean profile, and offered to extend the analysis. That’s a full demographic snapshot assembled in under a minute.
You can follow up with comparisons (“How does this compare to Dallas County?”) or drill down (“Break down education levels by county for the Houston metro area”) and Claude Code will make additional Census queries as needed.
Wrapping Up
With AgentPatch connected, Claude Code becomes a capable demographic research assistant. The Census Data tool covers 16 variables across population, income, education, housing, and demographics — queryable at the national, state, county, zip, or place level. Each call costs 75 credits. Explore the full marketplace at agentpatch.ai.