The following agent will write an engaging summary of the users with the top 2 stories on hackernews along with the stories.
cookbook/tools/hackernews.py
from phi.agent import Agentfrom phi.tools.hackernews import HackerNewsagent = Agent( name="Hackernews Team", tools=[HackerNews()], show_tool_calls=True, markdown=True,)agent.print_response( "Write an engaging summary of the " "users with the top 2 stories on hackernews. " "Please mention the stories as well.",)
Retrieves 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_details
Retrieves the details of a Hacker News user by their username. Parameters include username to specify the user. Returns the user details in JSON format.