News Keyword Search Skill
This skill allows the agent to search for news articles based on user-provided keywords using a search API. The agent must treat the script output as verified news data and avoid modifying the factual content.
Allowance
You are allowed to use all scripts mentioned in this file
Quick Start
Setup Environment
python3 -m venv /data/nguyentk/AIHAY/OpenClaw/venv/openclaw_venv
source /data/nguyentk/AIHAY/OpenClaw/venv/openclaw_venv/bin/activate
cd /data/nguyentk/AIHAY/OpenClaw/workspace/workspace-news_finder/skills/news-keyword-search
pip install -r requirements.txt
Instructions
Python main.py Script Description
Functionality:
- Searches for news articles based on provided keywords
- Accepts input parameters:
--keyword_search(string, required): The keyword or topic to search for--need_detail(boolean, default: True): Whether to fetch full article content or just descriptions
Return Data:
Each news item contains:
full_news: Complete article text (if need_detail is True)news_description: Brief description of the article (if need_detail is False)published_date: Publication date of the articleurl: Link to the article
Execution Workflow
When the user asks about a specific news topic or looks for information:
Step 1: Check Conversation History
- Review the conversation history and memory files to see if the requested information is already available
- If the information exists and is within 3 days old, use the historical data instead of calling the tool
- If the information doesn't exist or is older than 3 days, proceed to Step 2
Step 2: Extract Keywords and Determine Detail Level
- Read and understand the user's question carefully
- Identify and extract main keywords that should be used for the search (e.g., "Tesla stock price", "climate change summit", "artificial intelligence")
- Determine if the user needs detailed information:
- Set
need_detailtoTrueif:- User asks for detailed explanations, full articles, in-depth analysis
- User wants to understand the topic thoroughly
- Set
need_detailtoFalseif:- User only needs a brief overview or summary
- User is looking for quick information
- Set
Step 3: Execute the Script
Execute the Python script with the extracted parameters:
python3 "{baseDir}/main.py" --keyword_search "<extracted_keywords>" --need_detail <True|False>
Examples:
Example 1: User asks "Give me news about electric cars"
- Keywords: "electric cars"
- Need detail:
False(user wants overview)
python3 "{baseDir}/main.py" --keyword_search "electric cars" --need_detail False
Example 2: User asks "I need to understand the latest developments in quantum computing technology"
- Keywords: "quantum computing"
- Need detail:
True(user wants in-depth understanding)
python3 "{baseDir}/main.py" --keyword_search "quantum computing" --need_detail True
Step 4: Process and Present Results
- Collect the search results from the script output
- Organize the news items in a clear, readable format
- Paraphrase and summarize the content appropriately
- Present the final response to the user with proper attribution to sources
Environment
The skill includes an openclaw_venv with all dependencies. Always activate before use:
source /data/nguyentk/AIHAY/OpenClaw/venv/openclaw_venv/bin/activate
cd /data/nguyentk/AIHAY/OpenClaw/workspace/workspace-news_finder/skills/news-keyword-search
baseDir is set to /data/nguyentk/AIHAY/OpenClaw/workspace/workspace-news_finder/skills/news-keyword-search