{"slug": "i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-here", "title": "I Ran a Zero-Dependency Python AST Auditor on 4 Open-Source AI Agent Repos: Here's What It Found", "summary": "A developer released zmb-audit v0.3.1, a single-file, stdlib-only Python AST auditor, and ran it unmodified against shallow clones of four open-source AI agent repositories: huggingface/smolagents, openai/openai-agents-python, browser-use/browser-use and pydantic/pydantic-ai. The tool flagged silent broad-exception fallbacks in every repo (170 in openai-agents-python, 48 in browser-use, 41 in pydantic-ai, 7 in smolagents), most of which sit in examples and docs, and the release adds a GitHub Actions Marketplace action plus SARIF v2.1.0 output so findings surface in pull requests and GitHub's Security tab.", "body_md": "When I audited my own autonomous coding agent ([Zero Man Business](https://github.com/ADevBelgie/zmb-audit)) after 156 cycles, unit tests were green while silent broad-exception fallbacks and unimported modules were hiding real runtime bugs.\n\nI open-sourced **[zmb-audit](https://github.com/ADevBelgie/zmb-audit)** (`v0.3.1`, a single Python file using only stdlib `ast`) and ran it unmodified against shallow clones of four major Python AI-agent codebases to see which failure modes show up in real repositories, and where naive static rules need engineering context.\n\nAll four runs were captured on fresh shallow clones (`--depth 1`, default excludes without passing `--exclude examples docs`):\n\n| Repository | Commit | Python Files | Unimported Modules (Raw) | Unresolved Repo Calls | Silent Broad `except` Fallbacks | \n|---|---|---|---|---|---|\n| [huggingface/smolagents](https://github.com/huggingface/smolagents) | `9c2cdc7` | 73 | 14 | 0 | 7 | \n| [openai/openai-agents-python](https://github.com/openai/openai-agents-python) | `2c98a7a` | 1,019 | 130 | 1 | 170 | \n| [browser-use/browser-use](https://github.com/browser-use/browser-use) | `f109c38` | 76 | 3 | 0 | 48 | \n| [pydantic/pydantic-ai](https://github.com/pydantic/pydantic-ai) | `aca91ff` | 2,909 | 56 | 4 | 41 | \n\nRunning an uncalibrated rule on mature libraries quickly shows how to separate reliability risks from harmless repo conventions:\n\n`ZMB003`) (Highest Signal)\nEvery repository contained `except Exception:` or bare `except:` blocks that swallow errors with `pass` or silently return `[]`, `{}`, `None`, or `\"\"`:\n\n`browser-use/browser-use` (`48` hits): e.g., `browser_use/auth.py` (lines 30, 401, 428) swallows exceptions in authentication and config paths.`pydantic/pydantic-ai` (`41` hits): e.g., `pydantic_ai_slim/pydantic_ai/_agent_graph.py` (line 5597), `_cli/__init__.py` (line 194), and `_display.py` (line 423).`openai/openai-agents-python` (`170` hits): mostly in docs and examples (`docs/scripts/translate_docs.py` line 706, `examples/financial_research_agent/manager.py` line 185).`huggingface/smolagents` (`7` hits): mostly inside bundled document-conversion helpers (`examples/open_deep_research/scripts/mdconvert.py` lines 274, 318, 514).\nIn production agent loops, silent broad fallbacks often return `\"ok\"` or `[]` instead of failing loudly. That turns broken API calls or empty tool results into silent state corruption and wasted retries.\n\n`ZMB001`): Why `--exclude examples docs` Matters\nIn `openai/openai-agents-python` (`130`) and `huggingface/smolagents` (`14`), nearly all \"orphan\" Python files live inside `examples/`, `scripts/`, or `docs/`. Those are standalone sample scripts executed directly rather than imported by the package. `browser-use` had only `3` (`simple`, `smoke`, `sync_browser_harness_skill`).\n\nWhen running `zmb-audit` in CI on your own service, exclude example folders explicitly (`--exclude examples docs scripts`) so `ZMB001` isolates dead code in `src/` or core packages.\n\n`ZMB002`)\nVery few false positives appeared even across 4,000+ Python files:\n\n`smolagents` and `browser-use`: `openai-agents-python`: `examples/voice/streamed/main.py: RealtimeApp.run`).` pydantic-ai`: `Agent.run` and `MCPToolset.prefixed`, which come from inherited or dynamically composed base classes that single-file AST inspection does not traverse without full MRO resolution).`v0.3.1`)\n`zmb-audit` now ships a **GitHub Actions Marketplace action (`v0.3.1`)** and native **SARIF v2.1.0 (`--sarif`)** output so pull requests surface silent fallbacks (` ZMB003`), orphan modules (` ZMB001`), and unresolved calls (` ZMB002`) directly in GitHub's Security tab:\n\n```\nname: Agent Code Audit\non: [pull_request]\npermissions:\n  security-events: write\njobs:\n  audit:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: ADevBelgie/zmb-audit@v0.3.1\n        with:\n          strict: \"true\"\n          exclude: \"examples docs scripts\"\n          sarif-file: zmb-audit.sarif\n      - if: always()\n        uses: github/codeql-action/upload-sarif@v3\n        with:\n          sarif_file: zmb-audit.sarif\n```\n\nIf you are hardening autonomous or AI-assisted coding workflows in production, the **2nd Edition Governance Kit (€14)** includes:\n\n`sys.monitoring` live-path reachability tracer\n[Get the ZMB Failure-Mode Report & Governance Kit (€14)](https://devresser.gumroad.com/l/zmb-failure-mode-report)\n\n**AI-Generation Disclosure (Spec A8.1)**: This article was drafted autonomously by Zero Man Business (ZMB) using live `zmb-audit` output on public GitHub repositories and reviewed by the human operator.", "url": "https://wpnews.pro/news/i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-here", "canonical_source": "https://dev.to/adevbelgium/i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-heres-what-it-found-57kd", "published_at": "2026-12-03 23:36:58+00:00", "updated_at": "2026-12-03 23:45:43.094739+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-safety"], "entities": ["zmb-audit", "ADevBelgie", "huggingface/smolagents", "openai/openai-agents-python", "browser-use/browser-use", "pydantic/pydantic-ai", "GitHub Actions"], "also_reported_by": [], "takeaway": "A stdlib-only AST audit of four agent repos found silent broad-except fallbacks in all of them (170 in openai-agents-python, 48 in browser-use), so exclude examples/docs/scripts to isolate real dead code and swallowed errors in core packages.", "recommendation": {"advice": "Run zmb-audit in CI with --exclude examples docs scripts and SARIF output so silent broad-except fallbacks and orphan modules in core packages surface on pull requests.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-here", "markdown": "https://wpnews.pro/news/i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-here.md", "text": "https://wpnews.pro/news/i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-here.txt", "jsonld": "https://wpnews.pro/news/i-ran-a-zero-dependency-python-ast-auditor-on-4-open-source-ai-agent-repos-here.jsonld"}}