Tool definition
Here’s a tool definition that works with OpenAI, Anthropic, or any framework that supports JSON Schema:tool_definition.py
Implementation
tools.py
query_economic_data(series_id="GDPC1", as_of="2023-10-26"), it gets back exactly what GDP was when the advance estimate was published — not today’s revised number. This matters for any agent reasoning about historical economic conditions.
Treasury yields tool
tools.py
Why as_of matters for agents
Without as_of, an agent answering “what did the economy look like in October 2023?” gets today’s revised data. The GDP number it sees ($22,841B) is $349B higher than what anyone actually knew in October 2023 ($22,492B).
For agents making decisions, generating analysis, or answering historical questions, as_of prevents hallucinating knowledge that didn’t exist yet.
Available series
Use
GET /v1/series?q=inflation to discover more. See the API Reference for the full endpoint documentation.