Case study

codehound

An AST static analyzer for the async-safety and correctness bugs that reach production in Python AI frameworks

codehound preview
104
checks
7
orgs merged its findings
0
runtime dependencies

Why I built it

While fixing bugs in large AI frameworks I kept seeing the same few mistakes: a blocking call inside an async function that freezes the event loop, an asyncio task whose only reference is dropped so it can be garbage-collected mid-run, a file handle that is never closed, a mutable default argument shared across calls. Rather than keep hunting them by hand, I wrote each one down as an AST rule.

What it found

Pointed at agno, it reported a requests.get() call that blocked the Discord bot's event loop on every attachment, and an export task that could be garbage-collected mid-run and silently drop telemetry. Findings like these became merged fixes in unsloth, mem0, agno, Black, Weaviate, Xorbits and pydantic-ai, each with a regression test.

How it works

  • Parses each file once and builds a child-to-parent map, so a check can ask "what is my enclosing function?" or "am I inside a with block?".
  • One small, independently tested class per rule.
  • Text, JSON, CSV and SARIF output (for GitHub code scanning), with CI-friendly exit codes, a config file, --fix for the safe rewrites, a GitHub Action and a pre-commit hook.
  • A browser playground that runs the real analyzer client-side through Pyodide, so code never leaves the page.

Being honest about overlap

Some patterns overlap with Ruff and flake8-bugbear, and the README says so check by check. Where codehound adapts a bugbear idea it states which one, and several checks are deliberately narrower than the original after measuring where the broader version produces false positives on real frameworks.

More case studies

Hiring for AI engineers?

I'm Abhinav Tarigoppula, open to AI engineer roles: internships now, full-time from 2027.