filesystem

command
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

This sample demonstrates the Filesystem middleware, which grants the model scoped file access through list_files, read_file, write_file, and search_and_replace tools. Everything is confined to RootDir by os.Root, which rejects any path resolving outside it, including via "..", absolute paths, or symlinks. A mock project in workspace/ gives the tools something to work on.

  • exploreFlow answers a question by listing and reading files.
  • editFlow applies a SEARCH/REPLACE edit, writing to workspace/ on disk.

Run it:

go run .

Or with the Dev UI, to watch the tool calls in a trace of every run at http://localhost:4000/traces:

curl -sL cli.genkit.dev | bash    # install the Genkit CLI, once
genkit start -- go run .

Or over HTTP:

curl -N -X POST 'http://localhost:8080/exploreFlow?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"question": "Summarise what this project does and what is still pending."}}'

curl -N -X POST 'http://localhost:8080/editFlow?stream=true' \
  -H "Content-Type: application/json" \
  -d '{"data": {"instruction": "Mark the in-memory response cache TODO as done."}}'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL