Hacker News

HackerNews enables an Agent to search Hacker News website.

Example

The following agent will write an engaging summary of the users with the top 2 stories on hackernews along with the stories.

1from kern.agent import Agent
2from kern.tools.hackernews import HackerNewsTools
3
4agent = Agent(
5 name="Hackernews Team",
6 tools=[HackerNewsTools()],
7 markdown=True,
8)
9
10agent.print_response(
11 "Write an engaging summary of the "
12 "users with the top 2 stories on hackernews. "
13 "Please mention the stories as well.",
14)

Toolkit Params

ParameterTypeDefaultDescription
enable_get_top_storiesboolTrueEnables fetching top stories.
enable_get_user_detailsboolTrueEnables fetching user details.
allboolFalseEnables all functionality.

Toolkit Functions

FunctionDescription
get_top_hackernews_storiesRetrieves the top stories from Hacker News. Parameters include num_stories to specify the number of stories to return (default is 10). Returns the top stories in JSON format.
get_user_detailsRetrieves the details of a Hacker News user by their username. Parameters include username to specify the user. Returns the user details in JSON format.

Developer Resources