Vision Sandbox
Gemini's native code execution for precise image analysis. The model writes and runs Python in a Google-hosted sandbox to verify visual data.
Auth
GOOGLE_API_KEY environment variable required.
Usage
uv run vision-sandbox --image "path/to/image.png" --prompt "Identify all buttons and provide [x, y] coordinates."
# Custom model
uv run vision-sandbox --image "path/to/image.png" --prompt "Count the items." --model gemini-3.5-flash
Flags
| Flag | Default | Notes |
|---|---|---|
--image / -i |
— | Path to input image (required) |
--prompt / -p |
— | Instruction for the model (required) |
--model / -m |
gemini-3.5-flash |
Model ID |
Prompt patterns
- Spatial grounding: "Locate the 'Submit' button. Use code execution to verify its center point and return [x, y] coordinates in [0, 1000] scale."
- Visual math: "Count items in the list. Use Python to sum their values if prices are visible."
- UI audit: "Check if header text overlaps with icons. Calculate bounding box intersections."
- Counting: "Count fingers on this hand. Identify bounding box for each and return total."
Gotchas
- Output images (if generated by sandbox) are saved as
sandbox_output_N_N.pngin the working directory. - Latency: 15-30s depending on prompt complexity. Use
yieldMs: 45000minimum in parallel blocks.