Skip to content

feat(search): Add DuckDuckGo fallback for credit-card-free web search#78

Merged
lxowalle merged 9 commits intosipeed:mainfrom
SatyamDevv:main
Feb 13, 2026
Merged

feat(search): Add DuckDuckGo fallback for credit-card-free web search#78
lxowalle merged 9 commits intosipeed:mainfrom
SatyamDevv:main

Conversation

@SatyamDevv
Copy link
Contributor

🚀 Context

Currently, the web_search tool relies exclusively on the Brave Search API. While Brave offers a generous free tier (2,000 queries/month), signing up often requires a credit card for verification. This creates significant friction for new users or those running on ephemeral hardware (like the $10 SBCs PicoClaw targets) who just want to test the agent out of the box.

✨ Changes

This PR introduces a Smart Search Provider system that automatically degrades gracefully if no API key is configured.

  • Refactor: Abstracted search logic in pkg/tools/web.go into a SearchProvider interface.
  • New Provider: Implemented DuckDuckGoSearchProvider which scrapes generic HTML results.
    • Engineering Note: Uses lightweight Regex parsing instead of DOM libraries (like goquery) to maintain the strictly mandated <10MB RAM footprint.
  • Auto-Fallback: If config.tools.web.search.api_key is empty, the system automatically switches to DuckDuckGo.

📝 Example Scenarios

Scenario 1: No Configuration (New User)

Previously, this would return an error or panic.

Config:

// ~/.picoclaw/config.json
{
  "tools": {
    "web": { "search": {} } // No API Key set
  }
}

Terminal Output:

$ picoclaw agent -m "Who won the super bowl 2026?"

[LOG] Search API key missing. Falling back to DuckDuckGo (Free/No-Auth).
[AGENT] Searching web for: "Super Bowl 2026 winner"
[AGENT] The Seattle Seahawks won the 2026 Super Bowl, defeating the New England Patriots with a score of 29-13. This victory marked the Seahawks' second title in franchise history.

Scenario 2: Power User (Brave API)

Users who want higher rate limits and structured JSON results can still use Brave.

Config:

{
  "tools": {
    "web": {
      "search": { "api_key": "BSAxx..." }
    }
  }
}

Behavior:
The system detects the key and initializes the BraveSearchProvider automatically. No code changes required by the user.

✅ Checklist

  • Refactored web.go to use Provider pattern
  • Implemented Regex-based HTML parser for DDG (Memory safe)
  • Updated README.md to explain the free fallback tier
  • Verified build size remains constant (no heavy scraping dependencies added)

@lxowalle lxowalle merged commit 55d5e89 into sipeed:main Feb 13, 2026
2 of 3 checks passed
@lxowalle
Copy link
Collaborator

Thanks for your contribution! We are forming the PicoClaw Developer Group to accelerate the evolution of the project. Any developer with more than one merged PR is invited to join.

Would you like to join the PicoClaw Dev Group? If so, please reply with your email address or send an email to support@sipeed.com with the subject line: [Join PicoClaw Dev Group] + Your GitHub account. We will send the Discord invite link to your inbox.

@SatyamDevv
Copy link
Contributor Author

SatyamDevv commented Feb 13, 2026 via email

emadomedher pushed a commit to emadomedher/picoclaw that referenced this pull request Feb 17, 2026
feat(search): Add DuckDuckGo fallback for credit-card-free web search
StarWindv referenced this pull request in StarWindv/PicoClaw-shou Feb 19, 2026
feat(search): Add DuckDuckGo fallback for credit-card-free web search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants