Skip to main content

News Agent

Join our Discord Subscribe on YouTube Connect on LinkedIn Follow on X.com

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.

Installation

To install NewsAgent, use the following command:

pip3 install -U news-swarm

Ensure that you have Python 3.10+ installed.

Environment Variables

OPENAI_API_KEY="if you use openai"
WORKSPACE_DIR="agent_workspace"
NEWSAPI_API_KEY="api from the newsapi"

Quick Start

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"]))

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.

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

License

NewsAgent is licensed under the MIT License. See the LICENSE file for more details.

Metadata

Release files for news-swarm 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for news-swarm 0.0.7
File Size Uploaded Provenance Actions
news_swarm-0.0.7.tar.gz 11.4 kB Without provenance Details for news_swarm-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for news-swarm 0.0.7
File Interpreter ABI Platform Actions
news_swarm-0.0.7-py3-none-any.whl Python 3 none any Details for news_swarm-0.0.7-py3-none-any.whl

Total release size: 21.6 kB

Release files / news_swarm-0.0.7.tar.gz

Download URL news_swarm-0.0.7.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
30fe3908ca954a0eebd7795afbed0f4ab4e83f914f9b2e5bcdb1615e51b62297
BLAKE2b-256 checksum
How to use checksums
e8230f5e0dd51a6d309a01cbe96d6ebb5627a36c83054314880c5eb124880343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Darwin/23.3.0

Release files / news_swarm-0.0.7-py3-none-any.whl

Download URL news_swarm-0.0.7-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f0c625c34986b1a2655c6a6a6028afe317892395a8e1cf88fbd63693f666405
BLAKE2b-256 checksum
How to use checksums
b8b5681a8d715b46a1fc7de44c6d739273cd1f26602904421eef7ceb19fa16ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Darwin/23.3.0

Security for news-swarm 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page