Patch-Pal is a small Boot.dev project that wires Gemini tool-calling to a local sandbox. It exposes a handful of file and process utilities as tools and lets the model request them in a loop until it returns a final answer.
What’s included
- A chat runner that manages the Gemini request/response loop, tool calls, and conversation history.
- Tool functions for listing files, reading files (with truncation), writing files, and running Python files.
- A simple CLI entry point.
- Test scripts that exercise the tool functions directly.
Project layout
main.pyCLI entry point.chat_runner.pyGemini request/response loop.prompt.pysystem prompt used for the model.tools.pytool registry and thin dispatcher (legacy).functions/LLM-callable functions and their schemas.config.pyconfiguration (e.g.,MAX_CHARSfor file reads).calculator/sample project the tools operate on.
Requirements
- Python 3.11+ (uses a local
.venvin this repo) uvfor running scripts- A Gemini API key in
.env:GEMINI_API_KEY=...
env
cp .env.example .envRun
uv run main.py "run tests.py" --verboseTool tests
uv run test_get_files_info.py
uv run test_get_file_content.py
uv run test_write_file.py
uv run test_run_python_file.pyNotes
- Tool functions always return strings and never raise errors to the model.
- File reads are truncated at
MAX_CHARS(seeconfig.py). - The chat loop stops when the model returns a final response, or after a max iteration limit.