from praisonaiagents import Agent
from praisonaiagents import extract_article
agent = Agent(
name="News Reader",
instructions="Extract and summarise news articles from URLs.",
tools=[extract_article],
)
agent.start("Summarise the main points from this article URL")
The user pastes a news link; the agent extracts article text and returns a brief summary.
Diagram
graph LR
U[Input] --> A[Agent]
A --> T[Tool]
T --> O[Output]
classDef agent fill:#8B0000,color:#fff
classDef tool fill:#189AB4,color:#fff
class A agent
class U,O tool
class T tool
Diagram
sequenceDiagram
participant User
participant Agent
participant Feature as Newspaper Agent
User->>Agent: Request
Agent->>Feature: Process request
Feature-->>Agent: Result
Agent-->>User: Response
Newspaper Tools
Use Newspaper Tools to extract and analyze news articles with AI agents.
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import get_article, get_news_sources, get_articles_from_source, get_trending_topics
Create Agent
Create a news agent:
python
news_agent = Agent(
name="NewsAgent",
role="News Analyst",
goal="Collect and analyze news articles from various sources.",
backstory="Expert in news gathering and content analysis.",
tools=[get_article, get_news_sources, get_articles_from_source, get_trending_topics],
reflection=False
)
Define Task
Define the news task:
python
news_task = Task(
description="Analyze news articles about 'AI developments' from major tech news sources.",
expected_output="Summary of key AI developments with source articles.",
agent=news_agent,
name="ai_news"
)
from praisonai_tools import get_article
from praisonai_tools import get_news_sources
from praisonai_tools import get_articles_from_source
from praisonai_tools import get_trending_topics