langchain-numbers-sg
LangChain tools for Singapore's money numbers: SORA, T-bill auctions, Singapore Savings Bonds, COE results, CPF rates and retirement sums, income tax, ABSD and BSD, inflation, the SP electricity tariff and SGD exchange rates, plus five calculators (stamp duty, take-home pay, income tax, CPF contributions, Savings Bond returns).
Every answer says where the figure came from (MAS, LTA, CPF Board, IRAS, SingStat, SP Group), the date of the row, when Numbers.sg last read the source, and whether that read is late. It also gives the page to link and a CC BY 4.0 credit line. Free, no API key.
Full guide with worked examples: https://numbers.sg/developers/langchain/
Install
pip install -U langchain-numbers-sg
Use it without a model
from langchain_numbers_sg import NumbersSGGetValue
print(NumbersSGGetValue().invoke({
"id": "coe-results", "field": "quota_premium_sgd", "where": {"category": "A"},
}))
COE bidding results, every round since 2010: quota_premium_sgd = S$130,100, as of 2026-11.
Meaning: The quota premium: what every successful bidder in the category pays.
Row: {"month":"2026-11","round":2,"closing_date":"2026-11-18","category":"A",...}
Source last read: 2026-12-04T08:50:00+08:00 (Singapore time).
Published by: Land Transport Authority (LTA), via data.gov.sg; Department of Statistics (SingStat)
Link: https://numbers.sg/cars/coe-results/
Credit: Source: Land Transport Authority, via data.gov.sg and Department of Statistics, compiled by Numbers.sg (numbers.sg/cars/coe-results/), CC BY 4.0
Use it in an agent
from langchain.agents import create_agent
from langchain_numbers_sg import NumbersSGToolkit
agent = create_agent("anthropic:claude-sonnet-5-5", tools=NumbersSGToolkit().get_tools())
agent.invoke({"messages": [{"role": "user", "content":
"I earn S$6,000 a month and I'm 30. What reaches my bank, and how does that compare with the latest 6-month T-bill yield on a year's savings?"}]})
Any chat model that supports tool calling works. Python 3.10 or later; create_agent needs LangChain 1.0+.
The tools
| Tool | What it answers |
|---|---|
NumbersSGListDatasets |
Which dataset answers a question, and its id |
NumbersSGGetValue |
One figure, ready to quote, with date, source and link |
NumbersSGGetDataset |
Rows for trends and comparisons (up to 500; a link to all) |
NumbersSGStampDuty |
BSD and ABSD on a Singapore property, tier by tier |
NumbersSGTakeHomePay |
Salary after CPF and tax, or the salary for a take-home figure |
NumbersSGIncomeTax |
Resident income tax with every relief |
NumbersSGCPFContribution |
CPF on a month's pay, with the account split |
NumbersSGSSBReturns |
Every interest payment on a Savings Bond, or a switch compared |
NumbersSGToolkit |
All eight |
The calculators run the same engines as the calculators on numbers.sg, which are checked against CPF Board's and IRAS's own worked examples. Each answer lists the rules it used, when they were last checked and their official sources.
Good to know
- Errors come back as sentences, not exceptions, so the model can recover (for example, "No dataset …: list_datasets gives every id").
- Freshness is part of every answer.
LATEmeans a scheduled read of the source did not happen, so a newer figure may exist. - Reuse: data marked
openis CC BY 4.0, free to republish with the credit line.facts-onlyseries can be quoted; check the publisher's terms before republishing a whole series. See https://numbers.sg/data/licence/. - One endpoint: the tools call
https://numbers.sg/api/mcp, the server listed in the official MCP registry asio.github.numbers-sg/data, so the LangChain tools and the MCP server always agree. SetNUMBERS_SG_ENDPOINTto point them elsewhere. - Not financial advice. General information from official sources.
Also from Numbers.sg
- REST API (JSON and CSV, no key): https://numbers.sg/developers/
- Open datasets: GitHub · Hugging Face · Kaggle · Zenodo DOI
Maintainer
Jeremiah Say (ORCID 0009-0009-2025-7691), who runs Numbers.sg. Issues and pull requests welcome. MIT licence.
Metadata
Release files for langchain-numbers-sg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_numbers_sg-0.1.0.tar.gz | 19.7 kB | With provenance | Details for langchain_numbers_sg-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_numbers_sg-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_numbers_sg-0.1.0-py3-none-any.whl |
Total release size: 36.4 kB
Release files / langchain_numbers_sg-0.1.0.tar.gz
| Download URL | langchain_numbers_sg-0.1.0.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51540673127c23edf04a60da97becaed1bb830a216fdf4be65ea4c9d26a52b4c
|
|
BLAKE2b-256 checksum How to use checksums |
819881586e6af2d56d2cfe3d9dcb4c8d3b38a4a4c94602817ec07f045780035d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / langchain_numbers_sg-0.1.0-py3-none-any.whl
| Download URL | langchain_numbers_sg-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4af5def761868fc8e9994c4462766c912c89084ca89176e2a9eb4a78d072a53
|
|
BLAKE2b-256 checksum How to use checksums |
d377af14cad0aafbfb856b9624d8ef3691b6a11adc474a26420c69a507ba5113
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logSecurity for langchain-numbers-sg 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for langchain_numbers_sg-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.