> For the complete documentation index, see [llms.txt](https://docs.projectbit.ca/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.projectbit.ca/documentation/tools/hacker-news.md).

# Hacker News

**HackerNews** enables an Agent to search Hacker News website.

### [​](https://docs.phidata.com/tools/hackernews#example)Example <a href="#example" id="example"></a>

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

```python
from bitca.agent import Agent
from bitca.tools.hackernews import HackerNews

agent = 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.",
)
```

### [​](https://docs.phidata.com/tools/hackernews#toolkit-params)Toolkit Params <a href="#toolkit-params" id="toolkit-params"></a>

| Parameter          | Type   | Default | Description                    |
| ------------------ | ------ | ------- | ------------------------------ |
| `get_top_stories`  | `bool` | `True`  | Enables fetching top stories.  |
| `get_user_details` | `bool` | `True`  | Enables fetching user details. |

### [​](https://docs.phidata.com/tools/hackernews#toolkit-functions)Toolkit Functions <a href="#toolkit-functions" id="toolkit-functions"></a>

| Function                     | Description                                                                                                                                                                      |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `get_top_hackernews_stories` | 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.                       |
