Skip to main content

Audit the architecture and health of any AI agent system or LLM-integrated project

Project description

agchk

Audit the architecture and health of any AI agent system or LLM-integrated project.

The base model rarely fails. The wrapper architecture corrupts good answers into bad behavior.

pip install agchk
agchk /path/to/your/agent/project

What It Does

agchk scans any Python/TypeScript/JavaScript codebase for 7 categories of agent architecture failures:

# Scanner Severity What It Catches
1 Hardcoded Secrets critical API keys, tokens, credentials in source code
2 Tool Enforcement Gap high "Must use tool X" in prompt but no code validation
3 Hidden LLM Calls high Secret second-pass LLM calls in fallback/repair loops
4 Unrestricted Code Execution critical exec(), eval(), subprocess(shell=True) without sandbox
5 Memory Pattern Issues medium Unbounded context growth, missing TTL, no retention policy
6 Output Pipeline Mutation medium Response transformation corrupting correct answers
7 Missing Observability medium No tracing, logging, or cost tracking

Quick Start

# Install
pip install agchk

# Audit any agent project
agchk /path/to/your/langchain/project

# Generate human-readable report
agchk --report audit_results.json

Python API

from agchk import run_audit, generate_report

# Run full audit
results = run_audit("/path/to/your/agent/project")

# Generate markdown report
markdown = generate_report(results)

# Save to file
generate_report(results, output_file="audit_report.md")

# Validate results against JSON schema
from agchk.schema import validate_report
errors = validate_report(results)

Programmatic Scanner Access

from agchk.scanners import scan_secrets, scan_code_execution
from pathlib import Path

findings = scan_secrets(Path("/path/to/project"))
for f in findings:
    print(f"[{f['severity'].upper()}] {f['title']} at {f['evidence_refs']}")

Example Output

๐Ÿ” Agent Architecture Audit
   Target: /Users/me/projects/my-agent
   Started: 2026-04-24 14:32:01

  Scanning: Hardcoded Secrets...
  Scanning: Tool Enforcement Gap...
  Scanning: Hidden LLM Calls...
  Scanning: Unrestricted Code Execution...
  Scanning: Memory Pattern Issues...
  Scanning: Output Pipeline Mutation...
  Scanning: Missing Observability...

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โœ… Audit complete. Found 5 issues in 0.3s:
   CRITICAL: 1
   HIGH:     2
   MEDIUM:   2
   LOW:      0
   Overall:  critical_risk

๐Ÿ“‹ Results: audit_results.json
๐Ÿ“„ Report: audit_report.md

The 12-Layer Stack

Every agent system has these layers. agchk audits all of them:

# Layer What Goes Wrong
1 System prompt Conflicting instructions, instruction bloat
2 Session history Stale context from previous turns
3 Long-term memory Pollution across sessions
4 Distillation Compressed artifacts re-entering as pseudo-facts
5 Active recall Redundant re-summary layers wasting context
6 Tool selection Wrong tool routing, model skips required tools
7 Tool execution Hallucinated execution โ€” claims to call but doesn't
8 Tool interpretation Misread or ignored tool output
9 Answer shaping Format corruption in final response
10 Platform rendering UI/API/CLI mutates valid answers
11 Hidden repair loops Silent fallback/retry agents running second LLM pass
12 Persistence Expired state or cached artifacts reused as live evidence

Fix Strategy

Default fix order (code-first, not prompt-first):

  1. Code-gate tool requirements โ€” enforce in code, not just prompt text
  2. Remove or narrow hidden repair agents โ€” make fallback explicit with contracts
  3. Reduce context duplication โ€” same info through prompt + history + memory + distillation
  4. Tighten memory admission โ€” user corrections > agent assertions
  5. Tighten distillation triggers โ€” don't compress what shouldn't be compressed
  6. Reduce rendering mutation โ€” pass-through, don't transform
  7. Convert to typed JSON envelopes โ€” structured internal flow, not freeform prose

Anti-Patterns to Avoid

  • โŒ Saying "the model is weak" without falsifying the wrapper first
  • โŒ Saying "memory is bad" without showing the contamination path
  • โŒ Letting a clean current state erase a dirty historical incident
  • โŒ Treating markdown prose as a trustworthy internal protocol
  • โŒ Accepting "must use tool" in prompt text when code never enforces it

Project Structure

agchk/                          โ† ๅ”ฏไธ€ๆบ็ ๅบ“ (single source of truth)
โ”œโ”€โ”€ agchk/
โ”‚   โ”œโ”€โ”€ scanners/               โ† 7 ไธชๅๆจกๅผๆ‰ซๆๅ™จ
โ”‚   โ”œโ”€โ”€ audit.py                โ† ไธป็ผ–ๆŽ’ๅ™จ
โ”‚   โ”œโ”€โ”€ report.py               โ† ๆŠฅๅ‘Š็”Ÿๆˆ
โ”‚   โ”œโ”€โ”€ schema.py               โ† JSON Schema ้ชŒ่ฏ
โ”‚   โ”œโ”€โ”€ cli.py                  โ† ๅ‘ฝไปค่กŒๅ…ฅๅฃ
โ”‚   โ””โ”€โ”€ schema.json             โ† ๆญฃๅผๆŠฅๅ‘Š Schema
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ gen-skill.py            โ† ไธ€้”ฎ็”Ÿๆˆ oh-my-agent-check
โ””โ”€โ”€ output/
    โ””โ”€โ”€ oh-my-agent-check/      โ† ่‡ชๅŠจ็”Ÿๆˆ็š„ Skill ๅŒ…
         โ”œโ”€โ”€ SKILL.md
         โ”œโ”€โ”€ references/
         โ””โ”€โ”€ README.md

Related

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agchk-0.1.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agchk-0.1.2-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file agchk-0.1.2.tar.gz.

File metadata

  • Download URL: agchk-0.1.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for agchk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 23b43089bc38b879c5b7856252d29fdad9b751a233df5533e678554ae9060015
MD5 883b6f5751b2b68096b626ab6f3f58a0
BLAKE2b-256 63e469dbffdd1e94da975876a37e5c789d7fd5f72ccae48d7f41a3d6392d09ca

See more details on using hashes here.

File details

Details for the file agchk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: agchk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for agchk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80518ed511bc63ce94b1a2d0ddec178d40152e142978444266569cabd9efdbe8
MD5 ba98b7191c5d51e70b0bd7cc87491604
BLAKE2b-256 c2f3ab2618ef3f674be90e84cd02e7835ddc18f62360c29a0f1550a04226448e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page