How to Search FRED Economic Data from Codex
Codex CLI is built for autonomous coding tasks, but when those tasks involve economic data, the agent needs to know which FRED series to pull. Series IDs like CPIAUCSL or GDPC1 aren’t something you memorize — and neither does the model. AgentPatch’s FRED Search tool lets Codex look up the right series from FRED’s catalog of 800,000+ economic data series while it works.
Why This Matters
If you’re building anything that consumes economic data — a dashboard, a forecasting model, an ETL pipeline — you need specific FRED series IDs. The naming conventions aren’t intuitive. Is it GDP or GDPC1? Is the CPI series you want CPIAUCSL or CPILFESL? Does the one you picked have monthly or quarterly frequency?
Without search, Codex would either hardcode a series ID from training data (which might be wrong or suboptimal) or ask you to go look it up. With FRED Search, Codex can query the catalog directly, compare options by frequency and seasonal adjustment, and pick the right one for your use case.
Setup
Add AgentPatch to ~/.codex/config.toml:
[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"
Then set your API key:
export AGENTPATCH_API_KEY=your_api_key
Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.
Example
You’re having Codex scaffold a data ingestion script and tell it:
“Create a Python script that pulls consumer price index data from FRED. Use the main headline CPI series, monthly, seasonally adjusted.”
Codex searches FRED to find the exact series:
Searching FRED for "consumer price index seasonally adjusted monthly"...
Found CPIAUCSL — "Consumer Price Index for All Urban Consumers: All Items
in U.S. City Average". Monthly frequency, seasonally adjusted, units are
an index (1982-84=100). Last updated February 12, 2026. Popularity: 95.
Creating fred_cpi_ingest.py using series_id="CPIAUCSL"...
Codex didn’t guess the series ID. It searched, confirmed the metadata matched the requirements, and used the correct ID in the generated code. If you’d asked for core CPI excluding food and energy, it would have found CPILFESL instead.
This pattern scales to any economic indicator. Codex can search for GDP deflators, federal funds rates, housing price indices, or anything else in FRED’s catalog — then immediately use the series ID in the code it’s writing.
Wrapping Up
Connecting AgentPatch to Codex gives it access to FRED Search and the full tool marketplace. Each FRED search costs 50 credits, and the same MCP connection unlocks web search, email, maps, and everything else. No per-tool setup required. Browse the marketplace at agentpatch.ai.