# News Agent
[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)
**NewsAgent** is an enterprise-grade news aggregation agent designed to fetch, query, and summarize news from multiple sources at scale. Built for modern businesses, NewsAgent enables you to automate the process of news monitoring, delivering summarized, relevant, and timely news from across the web. Whether you need real-time updates or comprehensive analysis, NewsAgent can seamlessly integrate into your workflows, ensuring that you always stay informed.
<!-- ## Key Features
- **Multi-Article Summarization**: Efficiently summarizes multiple articles at once, reducing the noise and delivering concise insights. -->
## Installation
To install **NewsAgent**, use the following command:
```bash
pip3 install -U news-swarm
```
Ensure that you have Python 3.10+ installed.
## Environment Variables
```txt
OPENAI_API_KEY="if you use openai"
WORKSPACE_DIR="agent_workspace"
NEWSAPI_API_KEY="api from the newsapi"
```
## Quick Start
```python
import os
from dotenv import load_dotenv
from swarm_models import OpenAIChat
from swarms import Agent
from news_swarm.main import NewsAgent
load_dotenv()
# Get the OpenAI API key from the environment variable
api_key = os.getenv("OPENAI_API_KEY")
# Create an instance of the OpenAIChat class
model = OpenAIChat(
openai_api_key=api_key, model_name="gpt-4o-mini", temperature=0.1
)
# Initialize the agent
base_agent = Agent(
agent_name="News-Agent-V1",
# system_prompt=FINANCIAL_AGENT_SYS_PROMPT,
llm=model,
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="news_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
return_step_meta=False,
# output_type="json",
)
# Agent
agent = NewsAgent(
agent_name="news-agent-v1",
agent=base_agent,
newsapi_api_key=os.getenv("NEWSAPI_API_KEY"),
system_prompt=None,
return_json=True,
# start_date="2024-08-01",
# end_date="2024-08-10"
)
# Run the agent
print(agent.run("multi-agent collaboration"))
print(agent.run_concurrently(["OpenAI", "Anthropic"]))
```
<!--
### 3. Customize Query Parameters
You can customize query parameters such as date ranges, languages, and source priorities:
```python
summary = agent.fetch_and_summarize(
"Quantum Computing",
date_range="2023-01-01:2023-09-01",
language="en",
sources=["nytimes", "bbc"]
)
print(summary)
``` -->
<!--
## Advanced Usage
**NewsAgent** also supports advanced use cases such as bulk fetching and deep analysis of specific sectors:
### Bulk Fetching
For large-scale news aggregation across multiple industries:
```python
topics = ["Financial Markets", "Healthcare", "Technology"]
summaries = agent.bulk_fetch_and_summarize(topics, sources=["forbes", "reuters", "bloomberg"])
for topic, summary in summaries.items():
print(f"Topic: {topic}\nSummary: {summary}\n")
```
### Integration with Enterprise Systems
Easily integrate **NewsAgent** with your company's internal systems via the provided API endpoints or through webhook support for real-time notifications.
```python
agent.start_monitoring(
"Cybersecurity",
interval=1800, # 30 minutes
on_update_callback=your_enterprise_notification_system.notify
)
``` -->
<!-- ## Security
NewsAgent follows strict security protocols:
- **API Key Encryption**: All API keys are securely stored and transmitted using industry-standard encryption methods.
- **Data Privacy**: NewsAgent does not store any news data or summaries beyond what is necessary for real-time operations. -->
## Enterprise Support
For enterprise customers, we offer:
- **24/7 Priority Support**
- **Custom Feature Development**
- **Integration Assistance** for your existing platforms (CRM, ERP, etc.)
For more information on enterprise solutions, contact us at [kye@swarms.world](mailto:kye@swarms.world).
# Todo
- **Smart Query Crafting**: Automatically creates optimized queries using an llm to fetch the most relevant news from multiple sources.
- **Real-Time Updates**: Fetch news in real-time or set scheduled intervals for continuous monitoring.
- **Customizable Sources**: Add or remove specific news sources, tailored to your business needs.
<!-- - **Enterprise Integration**: Easily integrates into existing enterprise platforms for automated news monitoring and alert systems. -->
- **Bing API**: Implement Bing API for search
- **Google API**: Implement Google API for search
- **Free Seaarch**: Implement a free, fast, reliable search mechanism that runs completely locally and privately.
## Contributing
We welcome contributions! If you'd like to contribute to **NewsAgent**, please open an issue or submit a pull request via our [GitHub repository](https://github.com/The-Swarm-Corporation/NewsAgent).
## License
**NewsAgent** is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
Raw data
{
"_id": null,
"home_page": "https://github.com/The-Swarm-Corporation/NewsAgent",
"name": "news-swarm",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "artificial intelligence, deep learning, optimizers, Prompt Engineering",
"author": "Kye Gomez",
"author_email": "kye@apac.ai",
"download_url": "https://files.pythonhosted.org/packages/e8/23/0f5e0dd51a6d309a01cbe96d6ebb5627a36c83054314880c5eb124880343/news_swarm-0.0.7.tar.gz",
"platform": null,
"description": "\n# News Agent\n\n[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)\n\n\n**NewsAgent** is an enterprise-grade news aggregation agent designed to fetch, query, and summarize news from multiple sources at scale. Built for modern businesses, NewsAgent enables you to automate the process of news monitoring, delivering summarized, relevant, and timely news from across the web. Whether you need real-time updates or comprehensive analysis, NewsAgent can seamlessly integrate into your workflows, ensuring that you always stay informed.\n\n<!-- ## Key Features\n\n\n- **Multi-Article Summarization**: Efficiently summarizes multiple articles at once, reducing the noise and delivering concise insights. -->\n\n## Installation\n\nTo install **NewsAgent**, use the following command:\n\n```bash\npip3 install -U news-swarm\n```\n\nEnsure that you have Python 3.10+ installed.\n\n## Environment Variables\n\n```txt\nOPENAI_API_KEY=\"if you use openai\"\nWORKSPACE_DIR=\"agent_workspace\"\nNEWSAPI_API_KEY=\"api from the newsapi\"\n```\n\n## Quick Start\n```python\nimport os\n\nfrom dotenv import load_dotenv\nfrom swarm_models import OpenAIChat\nfrom swarms import Agent\n\nfrom news_swarm.main import NewsAgent\n\nload_dotenv()\n\n# Get the OpenAI API key from the environment variable\napi_key = os.getenv(\"OPENAI_API_KEY\")\n\n# Create an instance of the OpenAIChat class\nmodel = OpenAIChat(\n openai_api_key=api_key, model_name=\"gpt-4o-mini\", temperature=0.1\n)\n\n# Initialize the agent\nbase_agent = Agent(\n agent_name=\"News-Agent-V1\",\n # system_prompt=FINANCIAL_AGENT_SYS_PROMPT,\n llm=model,\n max_loops=1,\n autosave=True,\n dashboard=False,\n verbose=True,\n dynamic_temperature_enabled=True,\n saved_state_path=\"news_agent.json\",\n user_name=\"swarms_corp\",\n retry_attempts=1,\n context_length=200000,\n return_step_meta=False,\n # output_type=\"json\",\n)\n\n# Agent\nagent = NewsAgent(\n agent_name=\"news-agent-v1\",\n agent=base_agent,\n newsapi_api_key=os.getenv(\"NEWSAPI_API_KEY\"),\n system_prompt=None,\n return_json=True,\n # start_date=\"2024-08-01\",\n # end_date=\"2024-08-10\"\n)\n\n\n# Run the agent\nprint(agent.run(\"multi-agent collaboration\"))\nprint(agent.run_concurrently([\"OpenAI\", \"Anthropic\"]))\n\n\n```\n\n\n<!-- \n### 3. Customize Query Parameters\n\nYou can customize query parameters such as date ranges, languages, and source priorities:\n\n```python\nsummary = agent.fetch_and_summarize(\n \"Quantum Computing\", \n date_range=\"2023-01-01:2023-09-01\", \n language=\"en\", \n sources=[\"nytimes\", \"bbc\"]\n)\n\nprint(summary)\n``` -->\n\n<!-- \n## Advanced Usage\n\n**NewsAgent** also supports advanced use cases such as bulk fetching and deep analysis of specific sectors:\n\n### Bulk Fetching\n\nFor large-scale news aggregation across multiple industries:\n\n```python\ntopics = [\"Financial Markets\", \"Healthcare\", \"Technology\"]\nsummaries = agent.bulk_fetch_and_summarize(topics, sources=[\"forbes\", \"reuters\", \"bloomberg\"])\n\nfor topic, summary in summaries.items():\n print(f\"Topic: {topic}\\nSummary: {summary}\\n\")\n```\n\n### Integration with Enterprise Systems\n\nEasily integrate **NewsAgent** with your company's internal systems via the provided API endpoints or through webhook support for real-time notifications.\n\n```python\nagent.start_monitoring(\n \"Cybersecurity\", \n interval=1800, # 30 minutes\n on_update_callback=your_enterprise_notification_system.notify\n)\n``` -->\n\n<!-- ## Security\n\nNewsAgent follows strict security protocols:\n- **API Key Encryption**: All API keys are securely stored and transmitted using industry-standard encryption methods.\n- **Data Privacy**: NewsAgent does not store any news data or summaries beyond what is necessary for real-time operations. -->\n\n## Enterprise Support\n\nFor enterprise customers, we offer:\n- **24/7 Priority Support**\n- **Custom Feature Development**\n- **Integration Assistance** for your existing platforms (CRM, ERP, etc.)\n\nFor more information on enterprise solutions, contact us at [kye@swarms.world](mailto:kye@swarms.world).\n\n# Todo\n- **Smart Query Crafting**: Automatically creates optimized queries using an llm to fetch the most relevant news from multiple sources.\n- **Real-Time Updates**: Fetch news in real-time or set scheduled intervals for continuous monitoring.\n- **Customizable Sources**: Add or remove specific news sources, tailored to your business needs.\n<!-- - **Enterprise Integration**: Easily integrates into existing enterprise platforms for automated news monitoring and alert systems. -->\n- **Bing API**: Implement Bing API for search\n- **Google API**: Implement Google API for search\n- **Free Seaarch**: Implement a free, fast, reliable search mechanism that runs completely locally and privately. \n\n\n## Contributing\n\nWe welcome contributions! If you'd like to contribute to **NewsAgent**, please open an issue or submit a pull request via our [GitHub repository](https://github.com/The-Swarm-Corporation/NewsAgent).\n\n## License\n\n**NewsAgent** is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "NewsAgent - TGSC",
"version": "0.0.7",
"project_urls": {
"Documentation": "https://github.com/The-Swarm-Corporation/NewsAgent",
"Homepage": "https://github.com/The-Swarm-Corporation/NewsAgent",
"Repository": "https://github.com/The-Swarm-Corporation/NewsAgent"
},
"split_keywords": [
"artificial intelligence",
" deep learning",
" optimizers",
" prompt engineering"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b8b5681a8d715b46a1fc7de44c6d739273cd1f26602904421eef7ceb19fa16ba",
"md5": "7fc0c11db130d4d0cacb8464c6716fd0",
"sha256": "2f0c625c34986b1a2655c6a6a6028afe317892395a8e1cf88fbd63693f666405"
},
"downloads": -1,
"filename": "news_swarm-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7fc0c11db130d4d0cacb8464c6716fd0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 10250,
"upload_time": "2024-10-30T23:19:10",
"upload_time_iso_8601": "2024-10-30T23:19:10.952827Z",
"url": "https://files.pythonhosted.org/packages/b8/b5/681a8d715b46a1fc7de44c6d739273cd1f26602904421eef7ceb19fa16ba/news_swarm-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e8230f5e0dd51a6d309a01cbe96d6ebb5627a36c83054314880c5eb124880343",
"md5": "78be8b11d57a77ef2f70b0d122374370",
"sha256": "30fe3908ca954a0eebd7795afbed0f4ab4e83f914f9b2e5bcdb1615e51b62297"
},
"downloads": -1,
"filename": "news_swarm-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "78be8b11d57a77ef2f70b0d122374370",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 11388,
"upload_time": "2024-10-30T23:19:11",
"upload_time_iso_8601": "2024-10-30T23:19:11.883271Z",
"url": "https://files.pythonhosted.org/packages/e8/23/0f5e0dd51a6d309a01cbe96d6ebb5627a36c83054314880c5eb124880343/news_swarm-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-30 23:19:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "The-Swarm-Corporation",
"github_project": "NewsAgent",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "news-swarm"
}