You can have an agent infer invariants from type hints and docstrings and turn them into Hypothesis tests that find real bugs in mature libraries. It shows a testing pattern beyond example-based tests that you can adapt.
Key takeaways · AI-distilled
Anthropic's testing AgentA system in which a model repeatedly chooses operations, a harness carries them out, and the results return to the model to inform its next choice.Full definition → derives invariants from code and documentation, then uses Hypothesis to search for counterexamples. It also checks whether a passing test is trivial or a failing test reflects a mistaken assumption.
In Anthropic's Python bug study, 56% of 50 manually sampled reports were valid and 32% were reportable. Among the highest-ranked reports, these rates rose to 86% and 81%, so the reviewed subset matters when judging precision.
In Anthropic's testing study, a reported python-dateutil bug was intended calendar behavior. Plausible test invariants still need maintainer review when the software's semantics are subtle.
Terms in this piece · Glossary
Agent — A system in which a model repeatedly chooses operations, a harness carries them out, and the results return to the model to inform its next choice.