Alphakdeps.io is experimental and evolving — the registry and packages may change or reset.
kdeps componentkdeps asset

kdeps-components-searchWeb

v1.0.1

kdeps kdeps-component: searchWeb

Install

A kdeps asset: kdeps installs it on first run and updates it without a new release.

kdeps update components/searchWeb

Also installs what it requires, when missing or older: schemas/v1 >=1.0.3.

Pin a version with kdeps update components/searchWeb@<version>.

Contents

component.yaml

apiVersion: kdeps.io/v1
kind: Component
metadata:
  name: searchWeb
  description: Search the web - DuckDuckGo by default, Brave, Bing or Tavily with an API key - and return title/url/snippet results
  version: "1.0.1"
  targetActionId: searchWebResults
interface:
  inputs:
    - name: query
      type: string
      required: true
      description: Search query
    - name: provider
      type: string
      default: ddg
      description: ddg (no key), brave, bing or tavily
    - name: connectionName
      type: string
      default: ""
      connection: search
      description: Name under search_connections in ~/.kdeps/config.yaml holding the provider's apiKey (brave, bing, tavily)
    - name: maxResults
      type: integer
      default: 5
      description: Results to return at most
    - name: timeout
      type: string
      default: 15s
      description: Request timeout as a duration
  output:
    results: "{{ get('searchWeb.results') }}"
    count: "{{ len(get('searchWeb.results')) }}"
    query: "{{ get('searchWeb.query') }}"
    provider: "{{ lower(trim(get('searchWeb.provider'))) }}"
resources:
  - actionId: searchWebDDG
    name: DuckDuckGo
    validations:
      skip:
        - "lower(trim(get('searchWeb.provider'))) != 'ddg'"
    httpClient:
      method: GET
      url: "{{ env('KDEPS_DDG_URL', 'https://html.duckduckgo.com') }}/html/?q={{ urlencode(get('searchWeb.query')) }}"
      headers:
        User-Agent: "Mozilla/5.0 (compatible; kdeps/2.0)"
        Accept: text/html
      timeout: "{{ get('searchWeb.timeout') }}"
      failOnError: true
  - actionId: searchWebBrave
    name: Brave
    validations:
      skip:
        - "lower(trim(get('searchWeb.provider'))) != 'brave'"
      check:
        - "get('config.search_connections.' + get('searchWeb.connectionName') + '.apiKey', '') != ''"
      error:
        code: 400
        message: "searchWeb: connectionName required for brave - set search_connections.<name>.apiKey in ~/.kdeps/config.yaml"
    httpClient:
      method: GET
      url: "{{ env('KDEPS_BRAVE_URL', 'https://api.search.brave.com') }}/res/v1/web/search?q={{ urlencode(get('searchWeb.query')) }}&count={{ get('searchWeb.maxResults') }}"
      headers:
        Accept: application/json
        X-Subscription-Token: "{{ get('config.search_connections.' + get('searchWeb.connectionName') + '.apiKey') }}"
      timeout: "{{ get('searchWeb.timeout') }}"
      failOnError: true
  - actionId: searchWebBing
    name: Bing
    validations:
      skip:
        - "lower(trim(get('searchWeb.provider'))) != 'bing'"
      check:
        - "get('config.search_connections.' + get('searchWeb.connectionName') + '.apiKey', '') != ''"
      error:
        code: 400
        message: "searchWeb: connectionName required for bing - set search_connections.<name>.apiKey in ~/.kdeps/config.yaml"
    httpClient:
      method: GET
      url: "{{ env('KDEPS_BING_URL', 'https://api.bing.microsoft.com') }}/v7.0/search?q={{ urlencode(get('searchWeb.query')) }}&count={{ get('searchWeb.maxResults') }}"
      headers:
        Ocp-Apim-Subscription-Key: "{{ get('config.search_connections.' + get('searchWeb.connectionName') + '.apiKey') }}"
      timeout: "{{ get('searchWeb.timeout') }}"
      failOnError: true
  - actionId: searchWebTavily
    name: Tavily
    validations:
      skip:
        - "lower(trim(get('searchWeb.provider'))) != 'tavily'"
      check:
        - "get('config.search_connections.' + get('searchWeb.connectionName') + '.apiKey', '') != ''"
      error:
        code: 400
        message: "searchWeb: connectionName required for tavily - set search_connections.<name>.apiKey in ~/.kdeps/config.yaml"
    httpClient:
      method: POST
      url: "{{ env('KDEPS_TAVILY_URL', 'https://api.tavily.com') }}/search"
      headers:
        Content-Type: application/json
      data:
        api_key: "{{ get('config.search_connections.' + get('searchWeb.connectionName') + '.apiKey') }}"
        query: "{{ get('searchWeb.query') }}"
        max_results: "{{ int(get('searchWeb.maxResults')) }}"
      timeout: "{{ get('searchWeb.timeout') }}"
      failOnError: true
  # Normalizes whichever provider ran to [{title, url, snippet}], at most maxResults.
  - actionId: searchWebResults
    name: Results
    validations:
      check:
        - "lower(trim(get('searchWeb.provider'))) in ['ddg', 'brave', 'bing', 'tavily']"
      error:
        code: 400
        message: "searchWeb: unknown provider (use ddg, brave, bing or tavily)"
    before:
      - "set('searchWeb.results', lower(trim(get('searchWeb.provider'))) == 'brave' ? map((output('searchWebBrave').data.web.results ?? [])[:int(get('searchWeb.maxResults'))], ({title: #.title ?? '', url: #.url ?? '', snippet: #.description ?? ''})) : lower(trim(get('searchWeb.provider'))) == 'bing' ? map((output('searchWebBing').data.webPages.value ?? [])[:int(get('searchWeb.maxResults'))], ({title: #.name ?? '', url: #.url ?? '', snippet: #.snippet ?? ''})) : lower(trim(get('searchWeb.provider'))) == 'tavily' ? map((output('searchWebTavily').data.results ?? [])[:int(get('searchWeb.maxResults'))], ({title: #.title ?? '', url: #.url ?? '', snippet: #.content ?? ''})) : map(filter(htmlFind(output('searchWebDDG').body, 'a.result__a'), (#.text ?? '') != '' || (#.href ?? '') != '')[:int(get('searchWeb.maxResults'))], ({title: #.text ?? '', url: (#['data-href'] ?? '') != '' ? #['data-href'] : (#.href ?? ''), snippet: ''})))"
requires:
  schemas/v1: ">=1.0.3"

Versions

VersionPublishedStatus
1.0.110/13/2026active
1.0.010/13/2026active

Details

Author
kdeps
License
Apache-2.0
Latest Version
1.0.1
Published
10/13/2026

Tags

kdepskdeps-component