langchain-gnews
LangChain tools for the GNews API: news from 80,000+ sources in 41 languages.
| Tool | Name seen by the model | Use it for |
|---|---|---|
GNewsTopHeadlines |
gnews_top_headlines |
Today's top headlines, ranked like Google News, by category, country and language: news briefings, daily digests |
GNewsSearch |
gnews_search |
Articles about a topic, company or person, filtered by language, country and date, over an archive since 2020 |
Web search tools return the most relevant pages. These tools return dated news articles with their source, filterable by country and language, including past periods.
Install
pip install langchain-gnews
Get a free API key at gnews.io/register, then:
export GNEWS_API_KEY="your-key"
Use with an agent
Requires langchain and a model integration, e.g. pip install langchain langchain-anthropic.
from langchain.agents import create_agent
from langchain_gnews import GNewsSearch, GNewsTopHeadlines
agent = create_agent("anthropic:claude-sonnet-5-5", tools=[GNewsTopHeadlines(), GNewsSearch()])
agent.invoke({"messages": [{"role": "user", "content": "Summarize this morning's top business headlines in France"}]})
Use directly
from langchain_gnews import GNewsSearch, GNewsTopHeadlines
GNewsTopHeadlines().invoke({"category": "business", "country": "fr", "lang": "fr"})
GNewsSearch().invoke({"q": '"NVIDIA" AND earnings', "lang": "en", "from_date": "2025-01-01", "to_date": "2025-03-31"})
Both return {"total_articles": int, "articles": [{"title", "description", "content", "url", "source", "published_at"}]}.
Options
| Option | Default | Effect |
|---|---|---|
api_key |
GNEWS_API_KEY |
GNews API key |
max_results |
10 |
Articles per call (up to your plan's limit) |
include_content |
True |
Include the article text. Set to False to save tokens. |
API errors (invalid key, quota reached, rate limit) are returned to the model as tool errors instead of raising.
What your plan returns
| Plan | Archive | Freshness | Article text |
|---|---|---|---|
| Free | last 30 days | 12-hour delay | truncated |
| Paid | since 2020 | real time | full |
See pricing and the API documentation.
Tests
pip install -e ".[test]"
pytest # unit tests
GNEWS_API_KEY=... pytest # adds integration tests against the live API
Metadata
Release files for langchain-gnews 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 | |
|---|---|---|---|
| langchain_gnews-0.1.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_gnews-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / langchain_gnews-0.1.0.tar.gz
| Download URL | langchain_gnews-0.1.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00e9f6846245e85f4089682d1dbf6719db370aae8ede59b3fd0c8ddd21420071
|
|
BLAKE2b-256 checksum How to use checksums |
60029c1c0719ac610761a7163186120ae2389921e1af100d089dc518c5f128a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / langchain_gnews-0.1.0-py3-none-any.whl
| Download URL | langchain_gnews-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07b83984f93dd0eda7bec1c26aa29d671ccd3b409e5b0462759fdd3808f6c733
|
|
BLAKE2b-256 checksum How to use checksums |
6b87128771d63fc1ecbe835ee182257a6981444dd8f9cbf6a5640cd18dc99e77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency log