终端新闻聚合系统

一个基于Amazon Q和MCP的终端新闻聚合系统,通过多代理并行工作抓取和总结来自多个新闻源的文章。

  • by eugeneyan
  • Python
  • 本地部署
  • 333 星标
  • 更新于
在 GitHub 查看 eugeneyan/news-agents

使用说明

新闻代理

使用Amazon Q、模型上下文协议(MCP)和tmux进行一些实验,以创建一个完全在您的终端中运行的新闻聚合系统。它使用并行工作的多个代理从各种新闻来源获取和总结文章。

同时阅读文章 这里,然后单击下面的图片在YouTube上观看3分钟的演示。

这是怎么回事?

这个项目是我玩的:

  • Amazon Q CLI作为代理工具
  • MCP将RSS提要解析为工具
  • tmux用于终端拆分和监控

该系统从Hacker news、TechCrunch和WSJ等多个来源获取新闻,然后将所有内容总结成可读性强的摘要,所有这些都在您的终端窗口中。

入门指南

设置亚马逊Q

  1. 跟随 官方指南 安装Amazon Q CLI
  2. 设置您的AWS凭据
  3. 确保它工作正常:
q --version

克隆仓库并运行它

git clone https://github.com/eugeneyan/news-agents.git

cd news-agents
uv sync  # Sync dependencies
uv tree  # Check httpx and mcp[cli] are installed

q chat --trust-all-tools  # Start Q

/context add --global context/agents.md  # Add system context for multi-agents

Q, read context/main-agent.md and spin up sub agents to execute it.  # Start main agent

该系统将开始做它的事情:拆分为多个代理,并使用tmux窗格并行处理新闻提要,以保持所有内容可见。

运作原理

主要代理人

  • 从以下位置抓取提要URL feeds.txt
  • 将它们分成3个相等的块
  • 在单独的tmux窗格中生成3个子代理
  • 关注每个人的进步
  • 在末尾收集所有摘要

子代理

  • 每个人都被分配了几个提要
  • 对于每种饲料,他们:
    • 下拉内容
    • 解析文章
    • 撰写总结
    • 将它们保存到 summaries/[feed-name].md
  • 完成后,他们向主代理报告

整个过程看起来是这样的

Main Agent (in the main tmux pane)
├── Read feeds.txt
├── Split feeds into 3 chunks
├── Create 3 Sub-Agents (in separate tmux panes)
│   ├── Sub-Agent #1
│   │   ├── Process feeds in chunk 1
│   │   └── Report back when done
│   ├── Sub-Agent #2
│   │   ├── Process feeds in chunk 2
│   │   └── Report back when done
│   └── Sub-Agent #3
│       ├── Process feeds in chunk 3
│       └── Report back when done
└── Combine everything into main-summary.md

所得

  • 个人摘要 summaries/ 文件夹
  • 一个重要的总结 main-summary.md
  • 代理在您的终端中协同工作的精彩演示

调试MCP

uv run mcp dev src/main.p

项目文件

.
├── context/           # Instructions for the agents
├── src/               # Code for processing each feed type
│   ├── ainews.py      # AI News stuff
│   ├── hackernews.py  # Hacker News stuff
│   ├── techcrunch.py  # TechCrunch stuff
│   ├── wired.py       # Wired stuff
│   └── wsj.py         # Wall Street Journal stuff
└── summaries/         # Where all the summaries end up