代码

cookbook/tools/newspaper4k_tools.py
from agno.agent import Agent
from agno.tools.newspaper4k import Newspaper4kTools

agent = Agent(
    tools=[Newspaper4kTools()],
    show_tool_calls=True,
    markdown=True,
)
agent.print_response("Analyze and summarize this news article: https://example.com/news")

用法

1

创建虚拟环境

打开 Terminal 并创建一个 python 虚拟环境。

python3 -m venv .venv
source .venv/bin/activate
2

设置你的 API 密钥

export OPENAI_API_KEY=xxx
3

安装依赖

pip install -U newspaper4k openai agno
4

运行 Agent

python cookbook/tools/newspaper4k_tools.py