DuckDuckGo Search Skill for Hermes Agent: Free Keyless Web, News, and Image Search
Free keyless web, news, and image search via ddgs.
Written by Neura Market from the official Hermes Agent documentation for Duckduckgo Search. Commands, paths, and version numbers are reproduced from the source unchanged.
Read the official documentationDuckDuckGo Search via ddgs Reference
This document describes how to perform free web searches using DuckDuckGo through the ddgs package. It requires no API key and provides text, news, image, and video search capabilities via both a command-line interface (CLI) and a Python API.
When to Use
Use ddgs in the following situations:
- When
web_searchis unavailable or unsuitable, such as whenFIRECRAWL_API_KEYis not set. - When DuckDuckGo results are specifically desired.
- As a standalone search path when other search tools are not available.
Capabilities
- Text search for general research, companies, and documentation.
- News search for current events, breaking news, and latest updates.
- Image search for visual references, product images, and diagrams.
- Video search for tutorials, demos, and explainers.
- Region filtering.
- Time-based filtering (day, week, month, year).
- JSON output for parsing.
- Safe search toggle.
- Max results limit.
- CLI and Python API interfaces.
Prerequisites
- For CLI: The
ddgspackage must be installed (pip install ddgs). - For Python API: The
ddgspackage must be installed in the same runtime that will execute the code. - Check CLI availability with
command -v ddgsbefore using. - Verify Python import with
from ddgs import DDGSbefore using inexecute_code.
Detection Flow
Follow these steps to determine how to use ddgs:
- Check CLI availability by running:
# Check CLI availability
command -v ddgs >/dev/null && echo "DDGS_CLI=installed" || echo "DDGS_CLI=missing"
- If the
ddgsCLI is installed, prefer using theterminalwithddgs. - If the
ddgsCLI is missing, do not assumeexecute_codecan importddgs. - If the user wants DuckDuckGo specifically, install
ddgsfirst in the relevant environment. - Otherwise, fall back to built-in web/browser tools.
Installation
Install ddgs only when DuckDuckGo search is specifically needed and the runtime does not already provide it.
# Python package + CLI entrypoint
pip install ddgs
# Verify CLI
ddgs --help
If the workflow depends on Python imports, verify that the same runtime can import ddgs before using from ddgs import DDGS.
CLI Search (Preferred)
Use the ddgs command via the terminal when it exists. The general syntax is ddgs <subcommand> -q "query" -m N. The subcommands are text, news, images, and videos.
Basic Commands
# Text search
ddgs text -q "python async programming" -m 5
# News search
ddgs news -q "artificial intelligence" -m 5
# Image search
ddgs images -q "landscape photography" -m 10
# Video search
ddgs videos -q "python tutorial" -m 5
Filters and Output
# With region filter
ddgs text -q "best restaurants" -m 5 -r us-en
# Recent results only (d=day, w=week, m=month, y=year)
ddgs text -q "latest AI news" -m 5 -t w
# JSON output for parsing
ddgs text -q "fastapi tutorial" -m 5 -o json
CLI Parameters
-q: Search query string (required). Example:-q "search terms".-m: Maximum number of results to return. Example:-m 5.-r: Region filter. Example:-r us-en.-t: Time limit:dfor day,wfor week,mfor month,yfor year. Example:-t w.-s: Safe search setting. Example:-s off.-o: Output format. Example:-o json.
Do not confuse CLI flags -q (query) and -m (max results).
Python API (Only After Verification)
Verify that ddgs is installed in the Python runtime before using. Use the with DDGS() as ddgs: context manager. The max_results parameter must always be passed as a keyword argument – positional usage raises an error.
Text Search
from ddgs import DDGS
with DDGS() as ddgs:
for r in ddgs.text("python async programming", max_results=5):
print(r["title"])
print(r["href"])
print(r.get("body", "")[:200])
print()
News Search
from ddgs import DDGS
with DDGS() as ddgs:
for r in ddgs.news("AI regulation 2026", max_results=5):
print(r["date"], "-", r["title"])
print(r.get("source", ""), "|", r["url"])
print(r.get("body", "")[:200])
print()
Image Search
from ddgs import DDGS
with DDGS() as ddgs:
for r in ddgs.images("semiconductor chip", max_results=5):
print(r["title"])
print(r["image"])
print(r.get("thumbnail", ""))
print(r.get("source", ""))
print()
Video Search
from ddgs import DDGS
with DDGS() as ddgs:
for r in ddgs.videos("FastAPI tutorial", max_results=5):
print(r["title"])
print(r.get("content", ""))
print(r.get("duration", ""))
print(r.get("provider", ""))
print(r.get("published", ""))
print()
Python API Fields
Common fields include title, href, body, date, url, image, source, thumbnail, height, width, content, description, duration, provider, published, statistics, and uploader. Use .get() for optional fields to avoid KeyError.
Method Names
text()for text search.news()for news search.images()for image search.videos()for video search.
Workflow: Search then Extract
- Use
ddgsto search and get titles, URLs, and snippets. - Select the most relevant URL from results.
- Extract full page content using
web_extract, browser tools, orcurl.
CLI Workflow Example
ddgs text -q "fastapi deployment guide" -m 3 -o json
Then extract the best URL with web_extract.
Python Workflow Example
from ddgs import DDGS
with DDGS() as ddgs:
results = list(ddgs.text("fastapi deployment guide", max_results=3))
for r in results:
print(r["title"], "->", r["href"])
Then extract the best URL with web_extract.
Constraints and Caveats
max_resultsmust always be passed as a keyword argument in the Python API – positional usage likeddgs.text("query", 5)raises an error. Always useddgs.text("query", max_results=5).- The
terminalandexecute_codeare separate runtimes; a successful shell install does not guaranteeexecute_codecan importddgs. - Never assume third-party Python packages are preinstalled inside
execute_code. - DuckDuckGo may throttle after many rapid requests – add a short delay between searches if needed.
ddgsreturns snippets, not full page content – useweb_extract, browser tools, orcurlfor full articles.- Results quality is generally good but less configurable than Firecrawl's search.
- DuckDuckGo may block requests from some cloud IPs – if searches return empty, try different keywords or wait a few seconds.
- Return fields may vary between results or
ddgsversions – use.get()for optional fields to avoidKeyError. - The package name is
ddgs(previouslyduckduckgo-search) – install withpip install ddgs. - Do not confuse CLI flags
-q(query) and-m(max results).
Failure Modes
ddgs: command not found– CLI not installed in the shell environment.ModuleNotFoundError: No module named 'ddgs'– Python runtime does not have the package installed.- Search returns nothing – temporary rate limiting or poor query.
- CLI works but
execute_codeimport fails –terminalandexecute_codeare different runtimes. - Empty results – may be rate-limited; wait a few seconds and retry.
Version Note
The current stable version is ddgs==9.11.2.