今日已更新 59 条资讯 | 累计 30103 条内容
关于我们

Before And After

lingxin wang 2026年06月04日 05:49 5 次阅读 来源:Dev.to

You Think Testing AI Means Testing the Process? Wrong A Testing Problem My AI Agent can finally write data — assign beds, update predictions, create alerts, place orders. Code done, I got stuck on a question: How do you test something like this? Regular functions are easy to test. add(1, 1) always returns 2 . Same every time. I can write assert add(1, 1) == 2 . But Agents are different. Ask it "find me an empty bed": First time it might query the bed table first, then the room table Second time it might query room first, then bed Third time it might use completely different SQL Results are all correct, but the process differs. You can't write: assert agent ( " find an empty bed " ) == " some specific sentence " Because it says something different every time. What I Learned from Journalism Thought about it for a while. Found the answer somewhere unexpected: news fact-checking. How do journalists verify a report's accuracy? They don't verify "how the reporter gathered information" — how many calls they made, how many sites they visited, how many people they talked to. Process is too complex. Every reporter does it differently. What they verify is results : Report says "the company laid off 50%" → Check: did they really lay off 50%? Report says "CEO resigned" → Check: did the CEO really resign? Report says "stock dropped 20%" → Check: did it really drop 20%? Doesn't matter how the reporter got the information. As long as the final reported facts are accurate, it passes. AI Agents can be tested the same way. Before → Action → After The core framework is just three steps: Step What to Do Analogy Before Check initial system state What things looked like before the event Action Let Agent execute the operation Reporter goes to investigate After Check final system state Verify if the report is accurate Example with "transfer bed" functionality: # Before: Where is Zhang San now? Are there empty beds in postpartum? before_bed = query ( " SELECT bed_id FROM admission WHERE pati

本文内容来源于互联网,版权归原作者所有
查看原文