Agentic AI
Microsoft Researchers Propose Test-Driven Framework to Make AI-Generated Code Reliable for Production
TAG uses automated testing and expert-calibrated AI judges to validate outputs from large language models, shifting focus from generation quality to rigorous validation.
Researchers have released a framework designed to bridge the gap between rapid AI-powered code generation and production-ready reliability. Rather than betting on language models to produce perfect outputs from the start, the approach flips the script: let the AI generate freely, then validate systematically.
The Core Problem#
Large language models can quickly draft structured artifacts like database queries, security mappings, and entity schemas. Yet translating these fast outputs into systems stable enough for real-world deployment remains difficult. Existing methods often focus on improving generation quality itself—a costly and unreliable path. TAG (Test-Driven Agentic Artifact Generation) reframes the challenge as one of validation rigor rather than generation perfection.
How TAG Works#
The framework rests on three foundational pillars:
- Test-driven feedback loops: When generated outputs fail tests, the LLM receives detailed error messages explaining why. Armed with this diagnostic information, the model can learn from its mistakes and refine its next attempt.
- Hybrid testing strategy: Deterministic tests catch verifiable problems (syntax errors, schema mismatches, broken references), while LLM-based tests handle fuzzy, nuanced judgments (whether outputs align with intent, meet domain standards, or follow correct logic).
- Expert-calibrated judges: Human experts calibrate the AI-based validators to match professional decision standards, scaling manual quality gates into repeatable, scalable evaluation systems.
Real-World Deployment#
The researchers demonstrated TAG across three security-focused tasks—KQL query generation, MITRE ATT&CK mapping, and entity mapping—all running in production within Microsoft Sentinel. Early results suggest the framework can deliver high-quality, reliable artifacts without losing the speed advantage of generative AI.
Broader Potential#
While grounded in security use cases, the authors argue TAG's principles apply across many artifact-generation domains where reliability matters. By separating the roles of generation and validation, the approach offers a practical path toward deployable AI systems without sacrificing efficiency.

