Back to Blog
Data Science

AI as Your Digital Colleague: How to Build a Python Agent that Reviews Code, Suggests Fixes, and Files PRs

7 min read  · 1,387 wordsBy Orandi Felix

Use `litellm` not `langchain` — litellm lets you swap backend (ollama, vllm, openAI) without rewriting prompts. The quantization (`q6_K`) means the agent fits in 6 GB VRAM, **leaving room for a 5 GB Redis cache** for diff history.

The `sed` command above is brittle; **real deployment** should use `libcst` or `parso` to parse Python AST, then surgically edit. I started with `sed` to fail fast, then moved to `parso` after the first round of PRs.

`pygit2` is **not thread-safe**; run this job **without concurrency** in GitHub Actions (`max-parallel: 1`).

We run `ollama` on CPU **only on PR branches** (cheaper than CUDA runners); **default branch** flips to CUDA mode with `--model-quantization=q6_K`.

Share this article: