Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vrashmanyu605-eng/Agentic_Sales-Markerting/llms.txt

Use this file to discover all available pages before exploring further.

The web search tool gives agents access to live web data without requiring any API credentials. web_search() performs a general DuckDuckGo query and returns structured results. search_company() builds on it by targeting a company’s official website, filtering out social media URLs, and automatically scraping the page content — giving downstream agents enriched context in a single call.
This tool uses DDGS (DuckDuckGo Search) — no API key or account is required.

Source code

search_tool.py
from ddgs import DDGS
from tools.website_scraper import scrape_website

def web_search(query, max_results=5):
    """
    Performs a general web search.
    """
    results = []
    try:
        with DDGS() as ddgs:
            search_results = list(ddgs.text(
                query,
                max_results=max_results
            ))
            for result in search_results:
                results.append({
                    "title": result.get("title"),
                    "href": result.get("href"),
                    "body": result.get("body")
                })
    except Exception as e:
        print(f"Search error: {e}")
    return results

def search_company(company_name):
    """
    Specific search to find company website and scrape it.
    """
    query = f"{company_name} official company website"
    results = web_search(query, max_results=5)
    
    website_url = None
    for result in results:
        url = result.get("href", "")
        if all(x not in url for x in ["linkedin.com", "facebook.com", "twitter.com", "instagram.com"]):
            website_url = url
            break
            
    website_content = ""
    if website_url:
        print(f"\nScraping Website: {website_url}")
        website_content = scrape_website(website_url)
        
    return {
        "search_results": results,
        "website_url": website_url,
        "website_content": website_content
    }
Runs a DuckDuckGo text search and returns structured results.

Parameters

query
string
required
The search query string to send to DuckDuckGo.
max_results
int
default:"5"
Maximum number of search results to return. Passed directly to DDGS.text().

Return value

Returns a list of dict objects, one per result. Each dict contains:
title
string
The page title from the search result.
href
string
The full URL of the result page.
body
string
The snippet or description text shown in the search result.
If the search raises an exception, the error is printed and an empty list is returned.

search_company()

Finds a company’s official website, then scrapes its content. Builds the query "{company_name} official company website" and passes it to web_search(). It picks the first result URL that does not contain linkedin.com, facebook.com, twitter.com, or instagram.com, then calls scrape_website() on that URL.

Parameters

company_name
string
required
The name of the company to search for, e.g. "Acme Corp".

Return value

Returns a single dict with three keys:
search_results
list
The full list of raw search result dicts returned by web_search().
website_url
string | None
The first non-social-media URL found in the results, or None if all results were social media links.
website_content
string
The cleaned text extracted from website_url by scrape_website(), up to 10,000 characters. Empty string if no URL was found.

Example return value

{
  "search_results": [
    {
      "title": "Acme Corp — Enterprise Software Solutions",
      "href": "https://www.acmecorp.com",
      "body": "Acme Corp delivers enterprise software to Fortune 500 clients worldwide."
    },
    {
      "title": "Acme Corp | LinkedIn",
      "href": "https://www.linkedin.com/company/acme-corp",
      "body": "Acme Corp. 12,000 followers on LinkedIn."
    }
  ],
  "website_url": "https://www.acmecorp.com",
  "website_content": "Acme Corp delivers enterprise software... [truncated at 10,000 chars]"
}

Build docs developers (and LLMs) love