AgentGuard reads your Python without running it, points to the exact line, and estimates what a run costs.
Real output of AgentGuard 0.3.1 on examples/research_agent.py, a demo agent in the repo with five planted problems.
___ __ ______ __
/ | ____ ____ ____ / /_/ ____/_ ______ __________/ /
/ /| |/ __ `/ _ \/ __ \/ __/ / __/ / / / __ `/ ___/ __ /
/ ___ / /_/ / __/ / / / /_/ /_/ / /_/ / /_/ / / / /_/ /
/_/ |_\__, /\___/_/ /_/\__/\____/\__,_/\__,_/_/ \__,_/
/____/
One pip command. No API key and no sign-up: AgentGuard never calls a model or runs your code.
pip install agentguard-lintPoint your terminal at any Python project directory containing agent code.
cd your_projectEach finding comes with a file, a line, a severity and a fix, plus a cost range per run.
agentguard .No API key, no sign-up, no runtime dependencies. Python 3.9 or newer.
$ pip install agentguard-lint
agentguard isn't found (pip's scripts folder is not on PATH), run:$ python -m agentguard .
Run it from your project folder. It scans every Python file in it and its subfolders, skipping virtual environments and hidden folders.
$ agentguard .
$ python -m agentguard .
| Method | Works Without PATH | Recommended |
|---|---|---|
| agentguard . | ❌ Needs PATH | ⭐ Best |
| python -m agentguard . | ✅ Yes | Fallback |
Every finding names the file, the line and the rule. Rule reference →
AG001. An LLM call in a loop that stops only when the model says so. Step counters, if step >= MAX: break, countdowns and retry helpers count as caps.
AG002. A conversation history that grows every turn and is re-sent in full. Trimming with messages[-k:] or summarising is recognised.
AG003 and AG005. Calls multiplied by nested loops, and functions that call a model and themselves with no depth parameter.
Each call priced at the model named in the code, at 1, 10 and 100 loop iterations. Also flags missing max_tokens (AG006), one call per item (AG004) and uncached Anthropic prompts (AG007).
An LLM API keeps no memory, so an agent re-sends the whole conversation on every turn. Turn 40 pays for the 39 turns before it. Pricing an agent as "number of calls × cost of one call" misses this completely.
In a measured 40-turn run on a local model, that naive estimate was 99% too low. AgentGuard, calibrated on the first two turns, was 11% low.
Run on 22 open-source agent projects, it found the pattern in OpenAI's own swarm library, whose turn limit defaults to infinity. How it was measured →