> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Hacker News

**HackerNewsTools** enable an Agent to get top stories and user details from Hacker News.

## Prerequisites

The following example requires the `openai` library.

```shell theme={null}
uv pip install -U openai
```

## Example

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

```python cookbook/91_tools/hackernews_tools.py theme={null}
from agno.agent import Agent
from agno.tools.hackernews import HackerNewsTools

agent = Agent(
    name="Hackernews Team",
    tools=[HackerNewsTools()],
    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.",
)
```

## Toolkit Params

| Parameter                 | Type   | Default | Description                          |
| ------------------------- | ------ | ------- | ------------------------------------ |
| `enable_get_top_stories`  | `bool` | `True`  | Enables fetching top stories.        |
| `enable_get_user_details` | `bool` | `True`  | Enables fetching user details.       |
| `all`                     | `bool` | `False` | Enables all functionality.           |
| `timeout`                 | `int`  | `30`    | Per-request HTTP timeout in seconds. |

## Toolkit Functions

| 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.                       |

## Developer Resources

* [Tools](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/hackernews.py)
