Skip to content

Search Local Resource

The searchLocal executor is built into the kdeps binary — no installation required. It walks a local directory and returns matching files by filename glob pattern and/or content keyword.

Configuration

yaml
run:
  searchLocal:
    path: "/data/documents"    # required: directory to search
    query: "invoice total"     # optional: keyword in file contents
    glob: "*.txt"              # optional: filename pattern
    limit: 10                  # optional: max results (0 = unlimited)
FieldTypeRequiredDefaultDescription
pathstringyesDirectory to search recursively
querystringnoCase-insensitive keyword to find in file contents
globstringnoFilename glob pattern (e.g. *.md, report_*.csv)
limitintegerno0Max results (0 = unlimited)

When both query and glob are set, a file must match both to be included.

Output

KeyTypeDescription
resultsarrayList of matching file objects
countintegerNumber of results
pathstringThe search root used
jsonstringFull result as JSON string

Each result object:

KeyTypeDescription
pathstringFull file path
namestringFilename
sizeintegerFile size in bytes
isDirboolAlways false (directories are skipped)

Examples

Find all Markdown files

yaml
metadata:
  actionId: findDocs
run:
  searchLocal:
    path: "/workspace/docs"
    glob: "*.md"

Find files containing a keyword

yaml
metadata:
  actionId: findInvoices
run:
  searchLocal:
    path: "/data/uploads"
    query: "overdue"
    limit: 20

Combine glob and keyword

yaml
metadata:
  actionId: findContracts
run:
  searchLocal:
    path: "/data"
    glob: "*.txt"
    query: "termination clause"

Feed results into an LLM

yaml
metadata:
  actionId: findFiles
run:
  searchLocal:
    path: "/data/reports"
    query: "{{ get('query') }}"

---
metadata:
  actionId: answer
  requires: [findFiles]
run:
  chat:
    model: llama3.2:1b
    prompt: "Files found: {{ output('findFiles').results }}. Summarize."
  apiResponse:
    response: "{{ output('answer') }}"

Error Handling

yaml
run:
  searchLocal:
    path: "/data"
    query: "keyword"
  onError:
    action: continue

Next Steps

Released under the Apache 2.0 License.