Skip to content

searchWeb resource

The searchWeb executor queries the web and returns structured results. The default provider is DuckDuckGo - no connection or API key required. Paid providers (Brave, Bing, Tavily) require a named connection in workflow.yaml settings. See Search resources for how it relates to searchLocal.

It works in both modes: as a DAG step in workflow mode, and inside any workflow the LLM calls as a tool in agent mode.

Global named connections (paid providers)

API keys belong in ~/.kdeps/config.yaml, not inline in resource files or workflow.yaml:

yaml
# ~/.kdeps/config.yaml
search_connections:
  brave:
    apiKey: "${BRAVE_API_KEY}"
  bing:
    apiKey: "${BING_API_KEY}"
  tavily:
    apiKey: "${TAVILY_API_KEY}"

Configuration

yaml
# resources/example.yaml
searchWeb:
  query: "{{ get('query') }}"     # required
  provider: ddg                    # optional: ddg (default) | brave | bing | tavily
  connectionName: brave            # required for brave/bing/tavily; references settings.searchConnections
  maxResults: 5                    # optional, default 5
  timeout: 15                      # optional, seconds, default 15
FieldTypeRequiredDefaultDescription
querystringyes-Search query
providerstringnoddgSearch provider: ddg, brave, bing, tavily
connectionNamestringno*-Named connection from settings.searchConnections
maxResultsintegerno5Maximum number of results
timeoutintegerno15HTTP request timeout in seconds

*Required when provider is brave, bing, or tavily.

Providers

ProviderValueConnection required
DuckDuckGoddgNo
Brave SearchbraveYes
BingbingYes
TavilytavilyYes

Output

yaml
output('search').results    # list of result objects
output('search').count      # number of results returned
output('search').query      # the query string
output('search').provider   # provider used
output('search').json       # JSON string of the full result

Result object fields:

FieldTypeDescription
titlestringPage title
urlstringPage URL
snippetstringDescription or summary snippet

Examples

DuckDuckGo (no connection needed):

yaml
# resources/search.yaml
actionId: search
searchWeb:
  query: "{{ get('query') }}"
  maxResults: 5

Brave Search:

yaml
# ~/.kdeps/config.yaml
search_connections:
  brave:
    apiKey: "${BRAVE_API_KEY}"
yaml
# resources/search.yaml
actionId: search
searchWeb:
  query: "{{ get('query') }}"
  provider: brave
  connectionName: brave
  maxResults: 10

Feed results into an LLM:

yaml
# resources/search.yaml
actionId: search
searchWeb:
  query: "{{ get('query') }}"

---
actionId: answer
requires: [search]
chat:
  model: llama3.2:1b
  prompt: |
    Answer based on these results:
    {% for r in output('search').results %}
    - {{ r.title }}: {{ r.snippet }}
    {% endfor %}
    Question: {{ get('query') }}

Error handling

ErrorCause
query is requiredEmpty query string
connectionName required for brave providerNo connection set for Brave
connectionName required for bing providerNo connection set for Bing
connectionName required for tavily providerNo connection set for Tavily
unknown provider "x"Invalid provider value

Environment variable overrides

VariableDescription
KDEPS_DDG_URLOverride DuckDuckGo base URL
KDEPS_BRAVE_URLOverride Brave API base URL
KDEPS_BING_URLOverride Bing API base URL
KDEPS_TAVILY_URLOverride Tavily API base URL

See also

Released under the Apache 2.0 License.