Documentation
¶
Overview ¶
Package agent provides tool definitions for the autonomous agentic verification loop used during code generation. Tools include sandboxed file I/O (read, write, list), Go toolchain operations (build, test, get, mod tidy), and linting — all scoped to a project root directory for safety.
Index ¶
- Variables
- func GoBuildTool(afs afero.Fs, basePath string) chat.Tool
- func GoGetTool(afs afero.Fs, basePath string) chat.Tool
- func GoModTidyTool(afs afero.Fs, basePath string) chat.Tool
- func GoTestTool(afs afero.Fs, basePath string) chat.Tool
- func LinterTool(afs afero.Fs, basePath string) chat.Tool
- func ListDirTool(afs afero.Fs, basePath string) chat.Tool
- func QueryUserTool(prompter UserPrompter) chat.Tool
- func ReadFileTool(afs afero.Fs, basePath string) chat.Tool
- func ReadFilesTool(afs afero.Fs, basePath string) chat.Tool
- func TreeTool(afs afero.Fs, basePath string) chat.Tool
- func WriteFileTool(afs afero.Fs, basePath string) chat.Tool
- type UserPrompter
Constants ¶
This section is empty.
Variables ¶
var ( ErrBuildFailed = errors.New("build failed") ErrTestFailed = errors.New("tests failed") ErrGoGetFailed = errors.New("go get failed") ErrLinterFailed = errors.New("lint issues found") ErrGoModTidyFailed = errors.New("go mod tidy failed") ErrPathInvalid = errors.New("path is outside of allowed directory") ErrInvalidPackageName = errors.New("invalid package name") )
var ErrQueryQuestionRequired = errors.New("query_user requires a question")
ErrQueryQuestionRequired is returned when the model calls query_user without a question.
Functions ¶
func GoBuildTool ¶
GoBuildTool returns a tool for running 'go build ./...'.
func GoModTidyTool ¶
GoModTidyTool returns a tool for running 'go mod tidy'.
func GoTestTool ¶
GoTestTool returns a tool for running 'go test ./...'.
func LinterTool ¶
LinterTool returns a tool for running 'golangci-lint run --fix'.
func ListDirTool ¶
ListDirTool returns a tool for listing directory contents.
func QueryUserTool ¶ added in v0.16.0
func QueryUserTool(prompter UserPrompter) chat.Tool
QueryUserTool returns a tool that lets the model ask the human a clarifying question rather than guess. It is only registered for interactive runs; the prompter performs the actual interaction.
func ReadFileTool ¶
ReadFileTool returns a tool for reading file content.
func ReadFilesTool ¶ added in v0.16.0
ReadFilesTool returns a tool for reading several files in a single call, so the agent doesn't spend a round-trip per file. Each file's content is returned under a header; a path that can't be read is reported inline rather than failing the whole batch.
Types ¶
type UserPrompter ¶ added in v0.16.0
UserPrompter asks the user a question, offering the model's suggested answers, and returns the reply (a chosen suggestion or free text). It backs the query_user tool; the caller supplies an interactive implementation and omits the tool entirely in non-interactive runs.