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

# Hacker News

**HackerNews** 允许代理搜索 Hacker News 网站。

## 示例

下面的代理将写一个引人入胜的摘要，介绍拥有 Hacker News 前 2 篇故事的用户以及这些故事本身。

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

agent = Agent(
    name="Hackernews Team",
    tools=[HackerNewsTools()],
    show_tool_calls=True,
    markdown=True,
)

agent.print_response(
    "写一个引人入胜的摘要，介绍拥有 Hacker News 前 2 篇故事的用户。请也提及这些故事。",
)
```

## Toolkit 参数

| 参数                 | 类型     | 默认     | 描述        |
| ------------------ | ------ | ------ | --------- |
| `get_top_stories`  | `bool` | `True` | 启用获取热门故事。 |
| `get_user_details` | `bool` | `True` | 启用获取用户详情。 |

## Toolkit 函数

| 函数                           | 描述                                                                           |
| ---------------------------- | ---------------------------------------------------------------------------- |
| `get_top_hackernews_stories` | 从 Hacker News 检索热门故事。参数包括 `num_stories`，用于指定返回的故事数量（默认为 10）。以 JSON 格式返回热门故事。 |
| `get_user_details`           | 通过用户名检索 Hacker News 用户的详情。参数包括 `username`，用于指定用户。以 JSON 格式返回用户详情。            |

## 开发者资源

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