tools: pydantic-ai agent sandbox driving loseit CLI via homelab Ollama#75
Open
phitoduck wants to merge 2 commits into
Open
tools: pydantic-ai agent sandbox driving loseit CLI via homelab Ollama#75phitoduck wants to merge 2 commits into
phitoduck wants to merge 2 commits into
Conversation
Single-file agent (`tools/agent-sandbox/agent.py`) exposing one tool per non-destructive loseit subcommand (search, log_food, diary, describe_food, whoami). Control flow is driven by the homelab-hosted `qwen3:8b` Ollama model via the new `ollama.priv.mlops-club.org` ingress. The Docker image is built on `ghcr.io/astral-sh/uv:python3.12-bookworm-slim`, runs as non-root, mounts only the user's loseit credentials read-only, and persists per-run logs (LLM I/O + tool I/O + full message history) to a host-bind directory. Per-prompt logging makes the iteration loop legible — every model input/output and tool input/output for one run lands in a single file. NOT FOR MERGE — exploratory work on driving the local Ollama model end-to-end.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/agent-sandbox/: single-file pydantic-ai agent (agent.py) that drives theloseitCLI via 5 tools — one per non-destructive subcommand.deleteandloginare deliberately omitted.qwen3:8bOllama model athttps://ollama.priv.mlops-club.org/v1(Tailscale-only).ghcr.io/astral-sh/uv:python3.12-bookworm-slim, runs as non-root, only mount is~/.config/loseit/read-only.runs/run-{UTC}.logcapturing the prompt, system prompt, every tool args+return, the full final message history (every model request/response with parsed tool_call args), and token usage. Mountable to the host.End-to-end run on the goal prompt (255g asparagus/lentils/red-potato mix + 100g guacamole) lands all 4 entries correctly in the diary, verified via readback.
Notes
lose-ititself is unpublished, so the image installs it fromgit+https://github.com/phitoduck/lose-it@${LOSEIT_REF}(defaultmain, override with--build-arg).log_foodrefuses absurd-magnitude tbsp/tsp/fl_oz logs — the small model otherwise falls back tograms ÷ g-per-tbspmath instead of re-searching for a gram-supporting food entry.Test plan
docker build -t loseit-agent tools/agent-sandboxdocker run --rm -v ~/.config/loseit:/home/agent/.config/loseit:ro --entrypoint /home/agent/.venv/bin/loseit loseit-agent whoamiloseit diaryruns/run-*.logto verify all LLM + tool I/O is captured