Newspaper

NewspaperTools enable an Agent to read news articles using the Newspaper4k library.

Prerequisites

The following example requires the newspaper3k library.

1uv pip install -U newspaper3k

Example

The following agent will summarize the wikipedia article on language models.

1from kern.agent import Agent
2from kern.tools.newspaper import NewspaperTools
3
4agent = Agent(tools=[NewspaperTools()])
5agent.print_response("Please summarize https://en.wikipedia.org/wiki/Language_model")

Toolkit Params

ParameterTypeDefaultDescription
enable_get_article_textboolTrueEnables the functionality to retrieve the text of an article.

Toolkit Functions

FunctionDescription
get_article_textRetrieves the text of an article from a specified URL. Parameters include url for the URL of the article. Returns the text of the article or an error message if the retrieval fails.

Developer Resources