How to Pull FRED Economic Data in Codex
Codex is built for autonomous work, but it can’t reach out to economic data sources on its own. When you need it to analyze interest rate trends, validate a pricing model, or populate test data with real macro numbers, you’d normally have to fetch that data yourself first. AgentPatch adds FRED Series Data so Codex can pull it directly.
Why This Matters
Economic data shows up in more codebases than you’d expect. If you’re working on lending software, insurance pricing, real estate tools, or any financial product, you need actual Fed data to build and test against. Stale hardcoded values lead to bugs that only surface when your numbers don’t match reality.
Giving Codex access to FRED means it can fetch any of the 800,000+ time series in the Federal Reserve Economic Database. Each call returns structured metadata — title, units, frequency, seasonal adjustment — along with an array of date/value observations. Values come back as strings to avoid floating point precision issues, and missing data points are filtered out automatically.
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 building a rate comparison tool and ask Codex to pull real data for analysis:
“Fetch the federal funds rate (DFF) and 30-year mortgage rate (MORTGAGE30US) for the past year. Compare the two series and summarize the spread trend.”
Codex fetches both series and runs the analysis:
Fetching FRED series DFF (daily, 2025-02-27 to 2026-02-27)...
Fetching FRED series MORTGAGE30US (weekly, 2025-02-27 to 2026-02-27)...
Federal Funds Rate: 253 daily observations, range 4.25 - 5.50
30-Year Mortgage Rate: 52 weekly observations, range 6.08 - 7.22
Spread analysis (mortgage rate minus fed funds rate):
- Feb 2025: ~1.72 percentage points
- Aug 2025: ~1.55 percentage points
- Feb 2026: ~1.83 percentage points
The spread narrowed mid-year as mortgage rates fell faster than the
fed funds rate, then widened again. Writing this analysis to
analysis/rate-spread.md and creating a seed data file for the
comparison chart component.
Codex pulled two different time series, aligned them despite different frequencies, ran a comparison, and produced both a written analysis and seed data for your component. All autonomous.
Wrapping Up
Connecting AgentPatch to Codex gives it direct access to Federal Reserve economic data during any session. Pair it with fred-search to discover series IDs programmatically. The same connection also unlocks every other tool on the marketplace — no additional setup per tool. See what’s available at agentpatch.ai.