News for hackers. Stuff that matters.

Show HN: ToolGuard – Pytest for AI agent tool calls

I got tired of my AI agents crashing because the LLM hallucinated a JSON key or passed a string instead of an int. So I built ToolGuard — it fuzzes your Python tool functions with edge-cases (nulls, missing fields, type mismatches, 10MB payloads) and gives you a reliability score out of 100%.

No LLM needed to run tests. It reads your type hints, generates a Pydantic schema, and deterministically breaks things.

pip install py-toolguard

GitHub: https://github.com/Harshit-J004/toolguard

If you are building complex tool chains, I would be incredibly honored if you checked out the repo. Brutal feedback on the architecture is highly encouraged!

( 2 comments | on HN )
Re:Show HN: ToolGuard – Pytest for AI agent tool calls by calebjang on Tuesday March 17, 2026 @08:13PM (#47420122)
This is interesting because a lot of agent failures happen before any “reasoning” issue shows up.

If the tool boundary itself is unstable — wrong field names, wrong types, missing required values — the rest of the stack doesn’t really matter.

Deterministic fuzzing for tool calls seems especially useful because it gives you a way to test execution reliability without depending on another model in the loop.

Re:Show HN: ToolGuard – Pytest for AI agent tool calls by Heer_J on Tuesday March 17, 2026 @09:25PM (#47420591)
Totally spot on, Caleb! That was exactly the frustrating realization that led me to build this.

I've spend so much time obsessing over which model is smarter or tweaking our system prompts, but if a simple None value causes a backend TypeError that crashes the whole runtime, none of that reasoning truly matters. The agent is basically dead in the water.

By fuzzing the execution environment deterministically first, we can guarantee the "hands" of the agent work perfectly before we even bother testing the "brain". Plus, it runs in milliseconds during CI/CD instead of waiting for expensive API calls.