IMF
Use this skill to answer questions that require IMF macroeconomic data,
World Economic Outlook data, or COFER reserve currency composition data.
Setup
Check whether the agent-gw Python SDK is available in the current Python environment, and install it only if the check fails:
python3 -c "import agent_gw" || python3 -m pip install "$(curl -s https://cdn.kimi.com/agentgw/pysdk/manifest.json | python3 -c "import json,sys; print(json.load(sys.stdin)['latest']['url'])")"
The SDK needs an API key from api_key=..., KIMI_API_KEY, or
~/.kimi/agent-gw.json.
Workflow
- Run
python3 scripts/imf_tool.py describe from the plugin directory to call
get_data_source_desc({"name": "imf"}).
- Read the returned Markdown carefully. It contains the overall data source
rules, country and region formats, indicator names, dataset constraints, and
each API's description, required parameters, optional parameters, defaults, and
allowed values.
- Select the API that best matches the user's question.
- Build
params exactly from the Markdown requirements. Pay attention to
country or region, indicator, year or date range, forecast versus historical
periods, dataset or source table, unit, and frequency requirements.
- Use
python3 scripts/imf_tool.py call to call call_data_source_tool.
- If the call fails, explain the failure reason from the response.
- If the call succeeds, save any returned files first, then answer using
resp.result.assistant; ignore resp.result.user unless display content is
specifically needed.
Common Use Cases
- Cross-country comparison of GDP growth, inflation, unemployment, government
debt, current account, trade balance, or other macroeconomic indicators.
- Historical macroeconomic trend analysis and World Economic Outlook forecasts.
- Policy research that requires IMF country, region, or global macro data.
- COFER analysis of official foreign exchange reserve currency shares such as
USD, EUR, CNY, JPY, GBP, CHF, AUD, and CAD.
Script
Use the bundled script from the plugin directory:
python3 scripts/imf_tool.py describe
After reading the Markdown and selecting an API:
python3 scripts/imf_tool.py call \
--api-name "<api name from markdown>" \
--params-json '{"required_param":"value"}'
For larger params, write a JSON object and pass
--params-file path/to/params.json.
The script:
- sends
{"name": "imf"} to get_data_source_desc
- sends
{"data_source_name": "imf", "api_name": ..., "params": ...} to
call_data_source_tool
- prints failure messages from
error.user or error.assistant
- saves returned files to each
files[].name path returned by the data source
- prints the joined
result.assistant texts on success
Expected call_data_source_tool response shape:
{
"is_success": bool,
"result": {"user": list[str], "assistant": list[str]} | None,
"error": {"user": list[str], "assistant": list[str]} | None,
"files": [{"name": str, "content": str}],
}
When files are returned, name is the file path or name to write. The path is
usually dictated by the selected API's params in the Markdown docs. If an API
does not need files, the response normally has no files to save.
1---2name: imf3description: IMF provides global macroeconomic data through the World Economic Outlook database, including historical statistics and forecasts for GDP growth, inflation, government debt, unemployment, trade balances, and other indicators across 190+ countries and regions, plus COFER reserve currency composition data.4---56# IMF78Use this skill to answer questions that require IMF macroeconomic data,9World Economic Outlook data, or COFER reserve currency composition data.1011## Setup1213Check whether the agent-gw Python SDK is available in the current Python environment, and install it only if the check fails:1415```bash16python3 -c "import agent_gw" || python3 -m pip install "$(curl -s https://cdn.kimi.com/agentgw/pysdk/manifest.json | python3 -c "import json,sys; print(json.load(sys.stdin)['latest']['url'])")"17```1819The SDK needs an API key from `api_key=...`, `KIMI_API_KEY`, or20`~/.kimi/agent-gw.json`.2122## Workflow23241. Run `python3 scripts/imf_tool.py describe` from the plugin directory to call25 `get_data_source_desc({"name": "imf"})`.262. Read the returned Markdown carefully. It contains the overall data source27 rules, country and region formats, indicator names, dataset constraints, and28 each API's description, required parameters, optional parameters, defaults, and29 allowed values.303. Select the API that best matches the user's question.314. Build `params` exactly from the Markdown requirements. Pay attention to32 country or region, indicator, year or date range, forecast versus historical33 periods, dataset or source table, unit, and frequency requirements.345. Use `python3 scripts/imf_tool.py call` to call `call_data_source_tool`.356. If the call fails, explain the failure reason from the response.367. If the call succeeds, save any returned files first, then answer using37 `resp.result.assistant`; ignore `resp.result.user` unless display content is38 specifically needed.3940## Common Use Cases4142- Cross-country comparison of GDP growth, inflation, unemployment, government43 debt, current account, trade balance, or other macroeconomic indicators.44- Historical macroeconomic trend analysis and World Economic Outlook forecasts.45- Policy research that requires IMF country, region, or global macro data.46- COFER analysis of official foreign exchange reserve currency shares such as47 USD, EUR, CNY, JPY, GBP, CHF, AUD, and CAD.4849## Script5051Use the bundled script from the plugin directory:5253```bash54python3 scripts/imf_tool.py describe55```5657After reading the Markdown and selecting an API:5859```bash60python3 scripts/imf_tool.py call \61 --api-name "<api name from markdown>" \62 --params-json '{"required_param":"value"}'63```6465For larger params, write a JSON object and pass66`--params-file path/to/params.json`.6768The script:6970- sends `{"name": "imf"}` to `get_data_source_desc`71- sends `{"data_source_name": "imf", "api_name": ..., "params": ...}` to72 `call_data_source_tool`73- prints failure messages from `error.user` or `error.assistant`74- saves returned files to each `files[].name` path returned by the data source75- prints the joined `result.assistant` texts on success7677Expected `call_data_source_tool` response shape:7879```python80{81 "is_success": bool,82 "result": {"user": list[str], "assistant": list[str]} | None,83 "error": {"user": list[str], "assistant": list[str]} | None,84 "files": [{"name": str, "content": str}],85}86```8788When files are returned, `name` is the file path or name to write. The path is89usually dictated by the selected API's params in the Markdown docs. If an API90does not need files, the response normally has no files to save.