home
docs
EconDash

Python SDK

Official Python client for the EconDash API, plus LangChain, LlamaIndex and CrewAI tools. pip install econdash, then search indicators, load series into pandas and cite sources.

The official Python package wraps the REST API: typed models, clear errors, sync and async clients, and optional pay-per-call for AI agents (x402 on Base, MPP on Tempo and Solana). LangChain, LlamaIndex and CrewAI use this same client: Agent frameworks.

Install

pip install econdash

Python 3.10+. Dependencies: httpx and pydantic.

First calls

from econdash import EconDash

ed = EconDash()                                   # free trial, no key needed

ed.search_indicators("inflation")[:3]             # list[Indicator]
ed.get_indicator("gdp-nominal")                   # source, licence, freshness
s = ed.get_series("gdp-nominal", "USA", start=2000)
ed.list_countries()
ed.top_countries("gdp-nominal", year=2024, limit=10)
ed.cite("gdp-nominal", "USA").citation.text

Indicators accept the slug from chart URLs (gdp-nominal in /chart/gdp-nominal/USA) or the API code (world_bank__gdp_nominal).

Into pandas

import pandas as pd

df = pd.DataFrame([p.model_dump() for p in s.data]).set_index("date")

Trial, API keys, pay per call

Without a key the client uses the free trial: 300 requests/day, 30/minute, 10 countries (USA, CHN, DEU, JPN, GBR, FRA, IND, BRA, RUS, KOR) and 50 core indicators. Anything else (another country or indicator, or more requests) answers 402. The client then raises EconDashPaymentRequired, unless you gave it an API key or a wallet.

For full access create a key in the dashboard:

ed = EconDash(api_key="ed_...")   # or set ECONDASH_API_KEY

A key from an active subscription opens every indicator and country with full history and no per-IP trial limits, on every method including cite(): 10,000 requests per month, per-endpoint limits of 60–120 requests per minute. With a key the client never pays per call.

Errors

ExceptionHTTPMeaning
EconDashAuthError401 / 403Bad key or inactive subscription
EconDashNotFound404Unknown indicator or country
EconDashRateLimitError429Quota exhausted, see retry_after
EconDashPaymentRequired402Outside the trial: pay per call or use a key. challenge holds the x402 requirements, www_authenticate the MPP ones

Pay per call (x402 and MPP)

AI agents without an account can pay each call in USDC, see Agent payments. Payments are off by default. The client pays only with a wallet and max_usd_per_call, refuses anything more expensive before signing. Calls the free trial covers are not paid; once the free quota is used up they are paid like any other call.

RailInstallArgument
x402, USDC on Basepip install "econdash[x402]"x402_signer=Account.from_key(...) (eth-account)
MPP, USDC on Tempopip install "econdash[tempo]" (Python 3.11+)tempo_account=TempoAccount.from_key(...) (pympp)
MPP, USDC on Solanapip install "econdash[solana]"solana_keypair=Keypair.from_base58_string(...) (solders)
from econdash import EconDash
from solders.keypair import Keypair

ed = EconDash(
    solana_keypair=Keypair.from_base58_string(AGENT_SOLANA_KEY),
    max_usd_per_call=0.05,
)
ed.get_series("gdp-nominal", "ZWE")   # outside the trial: one paid call
ed.get_series("gdp-nominal", "USA")   # inside the trial: free

With several wallets the client tries x402, then Tempo, then Solana. On Solana the API waits for on-chain confirmation, so a paid call can take up to ~40 seconds.

Async

from econdash import AsyncEconDash

async with AsyncEconDash() as ed:
    s = await ed.get_series("cpi-inflation-rate-percent", "DEU", start=2010)

Citing

Every indicator carries source_url, license_name and attribution_text; ed.cite(...) returns ready text, short and Markdown citations. To cite the package itself, use the "Cite this repository" button on GitHub.

Agent frameworks

LangChain, LlamaIndex and CrewAI call this same client. The free trial, an API key and pay-per-call work as described above. A 402 becomes a sentence for the model, and that sentence has no figures. Nothing is charged unless the client was given a wallet and max_usd_per_call.

The tools cover the same catalog, across ten categories: macro, markets, labor, demographics, real estate, energy, transport, health, education and tech.

LangChain

pip install langchain-econdash
from langchain_econdash import EconDashToolkit

tools = EconDashToolkit().get_tools()

Four tools: econdash_search_indicators, econdash_get_series, econdash_get_metadata, econdash_compare_countries. Search returns slugs and no numbers. A series is the last 20 points, the unit, freshness, a citation and the chart link. Compare takes 1–8 ISO3 codes, each fetched on its own.

LlamaIndex

pip install llama-index-tools-econdash
from llama_index.tools.econdash import EconDashReader, EconDashToolSpec

tools = EconDashToolSpec().to_tool_list()
docs = EconDashReader().load_data(
    indicators=["gdp-nominal"],
    countries=["USA", "DEU"],
)

The same four operations, named search_indicators, get_series, get_metadata and compare_countries. EconDashReader returns one document per indicator and country. The text is that short summary plus the source and the licence. Metadata is slug, iso3, source_url, data_changed_at and license. A series whose licence forbids redistribution is skipped and not fetched: Yahoo Finance, Case-Shiller, ICE / Trading Economics, "no redistribution" or "не распространять".

CrewAI

pip install crewai-econdash
from econdash import EconDash
from crewai_econdash import EconDashCompareTool, EconDashSearchTool, EconDashSeriesTool

client = EconDash()
tools = [
    EconDashSearchTool(client=client),
    EconDashSeriesTool(client=client),
    EconDashCompareTool(client=client),
]

Three tools: econdash_search_indicators, econdash_get_series and econdash_compare_countries. Metadata stays on the client, through get_indicator. Pass one shared EconDash() so the tools use the same key or wallet.

Source and examples: github.com/econdash/econdash-python.