mozgi Prompt catalog →
← All news Research

The MAGS framework is presented for automatic verification of AI agent code

September 18, 2026

Researchers presented MAGS — a multi-agent framework designed to generate programs with mathematically proven safety guarantees. The system addresses the problem of unpredictable behavior of AI agents when creating complex code, using the Dafny language as an intermediate representation for verification.

The MAGS workflow includes formalizing requirements and APIs, translating generated code into Dafny, automatically fixing errors based on feedback from the verifier, and subsequent compilation into an executable file. This approach allows for mechanical checking of compliance with specified safety properties, eliminating the need for manual proof writing.

The system's effectiveness was tested on 220 tasks, including 100 CUDA cores, 100 terminal scripts, and 20 scenarios for controlling robotic manipulators. In all cases, the framework demonstrated 100% success in creating programs that meet the specified safety specifications.

The tool enables minimizing risks when using AI in critical infrastructures, where code errors can lead to failures. The authors note that current limitations are related to the completeness of formalizing the semantics of target tasks, however, MAGS already provides a high level of reliability for automated systems.

mozgi.io — AI tools and prompts
Copied