Unit testing 检查 AI agent 使用的每个 tool 在独立运行时是否符合预期。你编写小 test,向 tool 输入清晰 input,并将其 output 与已知正确答案比较。若 tool 是解析日期的 function,就测试多种 date string 看是否给出正确结果。好的 test 覆盖 normal case、edge case 与 error case,每次改代码都运行。test 失败则先修 tool 再继续。此习惯防止 bug 扩散到更大 agent workflow,并加快后续 debug。