Skip to main content

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/

CI PyPI

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"},
}))

What it printed on 4 Dec 2026 (the figures follow LTA’s latest round):

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(),
    system_prompt="Answer Singapore money questions with the tools. Give each figure's date and source, and link the page.",
)
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. LATE means a scheduled read of the source did not happen, so a newer figure may exist.
  • Reuse: data marked open is CC BY 4.0, free to republish with the credit line. facts-only series 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 as io.github.numbers-sg/data, so the LangChain tools and the MCP server always agree. Set NUMBERS_SG_ENDPOINT to point them elsewhere.
  • Not financial advice. General information from official sources.

Also from Numbers.sg

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-numbers-sg 0.1.1
File Size Uploaded Provenance Actions
langchain_numbers_sg-0.1.1.tar.gz 19.8 kB With provenance Details for langchain_numbers_sg-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-numbers-sg 0.1.1
File Interpreter ABI Platform Actions
langchain_numbers_sg-0.1.1-py3-none-any.whl Python 3 none any Details for langchain_numbers_sg-0.1.1-py3-none-any.whl

Total release size: 36.0 kB

Release files / langchain_numbers_sg-0.1.1.tar.gz

Download URL langchain_numbers_sg-0.1.1.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4de33cec7d8e9c964bfb6ac864a4a70c0bab9e3765958fab7b7426c67ffdd9eb
BLAKE2b-256 checksum
How to use checksums
364ab1d745541c146e1c0f71beaf6b09a237256ec4ad0124b94f78fb568e8818
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 log

Release files / langchain_numbers_sg-0.1.1-py3-none-any.whl

Download URL langchain_numbers_sg-0.1.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c5166ab4f0c6db378cb39fb32b559b08abf5bf6b989dfe2624fefe186c16c0e
BLAKE2b-256 checksum
How to use checksums
da053ef0a024f0fb2ff8c87d4a64c0ddc09b4f8308fbacfe461b31462a45bfd1
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 log

Security for langchain-numbers-sg 0.1.1

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.

Select from 2 files

Attestation for langchain_numbers_sg-0.1.1.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 log

A 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page