展示HN:ToolGuard – 用于AI代理工具调用的Pytest

1作者: Heer_J23 天前原帖
我厌倦了我的AI代理因为大型语言模型(LLM)错误地生成JSON键或传递字符串而不是整数而崩溃。因此,我构建了ToolGuard——它通过边界情况(如空值、缺失字段、类型不匹配、10MB负载)对你的Python工具函数进行模糊测试,并给出一个可靠性评分,满分为100%。<p>运行测试不需要LLM。它读取你的类型提示,生成Pydantic模式,并以确定性的方式破坏功能。<p>使用以下命令安装:pip install py-toolguard<p>GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;Harshit-J004&#x2F;toolguard" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Harshit-J004&#x2F;toolguard</a><p>如果你正在构建复杂的工具链,我将非常荣幸你能查看这个仓库。非常欢迎对架构提出严厉的反馈!
查看原文
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%.<p>No LLM needed to run tests. It reads your type hints, generates a Pydantic schema, and deterministically breaks things.<p>pip install py-toolguard<p>GitHub: <a href="https:&#x2F;&#x2F;github.com&#x2F;Harshit-J004&#x2F;toolguard" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Harshit-J004&#x2F;toolguard</a><p>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!