Skip to content
Review

MACGen: Toward Functionally Correct and Secure Code Generation via Multi-Agent Collaboration

Aug 2026 · 0 citations · 46 references
Computer Science

TL;DR

MACGen is a multi-agent framework that integrates planning, security analysis, code synthesis and refinement to jointly optimize security and functionality and improves F&S@1 over direct prompting on CWEval and BaxBench.

Abstract

Despite their strong ability to generate code, large language models often fail to produce secure code, as their outputs frequently contain security vulnerabilities. Secure code generation is inherently challenging because it requires solving a multi-objective problem: functional correctness and security. Existing approaches address this challenge by injecting external security knowledge or by using agentic feedback and iterative refinement. However, guideline retrieval often leaves the generator to translate generic advice into task-specific secure implementations, while shared-dialogue multi-agent feedback can blur role boundaries and suffer from context bloat. We present MACGen, a multi-agent framework that integrates planning, security analysis, code synthesis and refinement to jointly optimize security and functionality. A planner constructs a step-by-step plan to satisfy functional requirements. A security advisor identifies likely CWEs and synthesizes task-specific guidelines, a coder then generates code grounded in these artifacts, and a reviewer issues perspective-separated feedback. Rather than sharing full dialogue histories, each agent receives only structured artifacts from upstream stages, enforcing role specialization and reducing uncontrolled context growth. On CWEval and BaxBench, MACGen improves F&S@1 over direct prompting by 19.61 and 10.57 percentage points (pp) on average, respectively.

View source

Similar papers

Conference Jul 2026

Metamorphic Testing of Multi-Agent LLM Systems: A Trace-Based Behavioral Oracle Framework

Multi-agent systems built on large language models (LLMs) are increasingly deployed for complex tasks requiring autonomous planning, tool use, and inter-agent coordination. However, the non-deterministic nature of LLM outputs and the emergent behavior arising from agent interactions render traditional test oracles ineffective, creating a critical gap in quality assurance for agentic AI. This work introduces MORPHAGENT, a framework designed to address the oracle problem in multi-agent LLM systems through trace-based behavioral analysis. Our contributions are threefold: (1) goal-preservation relations that verify consistent goal achievement under input perturbations, (2) coordination-consistency relations that validate inter-agent delegation and communication patterns under agent substitution and reordering, and (3) tool-use integrity relations that ensure semantic equivalence of tool invocation sequences under prompt paraphrasing. MorphAgent instruments agent execution to capture structured traces comprising planning steps, tool calls, message exchanges, and final outputs, then systematically applies metamorphic transformations and checks behavioral invariants without requiring ground-truth oracles. We evaluate the framework on four multi-agent benchmarks spanning code generation, research synthesis, customer service, and data analysis tasks, encompassing 2,840 source-followup execution pairs across three LLM backends. Results show that MORPHAGENT detects 82.0% of seeded behavioral faults, including 90.3% of coordination failures and 81.7% of goal-deviation faults, while maintaining a false positive rate of 6.1%. The framework uncovers 14 previously unreported behavioral anomalies in established multi-agent frameworks, demonstrating its practical utility for assuring agentic AI reliability. These results suggest that trace-based metamorphic testing can serve as a practical foundation for reliable validation of emerging agentic AI systems.

Gopalakrishnan Marimuthu · 0 citations
Preprint Jul 2026

SCOPE: Leveraging Subgoal Critiques for Code Generation

SCOPE is presented, a prover-initialized subgoal critic for code generation that adapts a Lean-oriented prover model to produce three parseable feedback fields for downstream code generation: subgoals, gap analysis, and a robustness checklist.

Yueke Zhang, Yifan Zhang, Zihan Fang et al. · 0 citations
Open access 2026

CCGMAS: A Multi-Agent Framework for Cross-Platform Go Code Generation via Requirement-Centered Semantic Modeling and Feedback-Driven Verification

CCGMAS enables more explicit semantic alignment across platforms by introducing requirement documents as an intermediate semantic layer and incorporating platform residue modeling, and a feedback-driven refinement loop is designed to iteratively correct errors at different stages, improving both functional correctness and platform compatibility.

Xiao Zhang, Bo Yang · 0 citations
Open access Aug 2026

TriArchitect: A Shared-State Multi-Agent Framework for Safe Java Code Migration

This work introduces TriArchitect, a novel shared-state multi-agent framework designed to bridge the gap between probabilistic reasoning and deterministic structural integrity, and introduces a rigorous Validator-Veto Protocol, which enforces a "compilation-as-consensus" rule to reject hallucinated proposals before they corrupt the codebase.

Neeraj Kumar Singh Beshane · 0 citations
Review Open access Aug 2026

AgentCodeReview: Implementation and Comprehensive Benchmark Evaluation of a Multi-Agent Framework for Explainable Code Review and Automated Bug Repair

The AgentCodeReview system is presented, a multi-agent system that is able to conduct explainable code review and automated bug repair by leveraging software engineering agents with different code review tasks and its utility and extensibility to the field of explainable AI in software quality assurance are demonstrated.

B. N, T. L. Manasa · 0 citations
Jul 2026

TraceDev: A Traceability-Driven Multi-agent Framework for Requirement-to-Code Development

This work proposes TraceDev, a multi-agent framework for automated software development grounded in use cases that contain multiple functional points and complex semantics, and demonstrates the effectiveness of TraceDev in repository-level code generation from requirements.

Mingyu Chen, Ya-Kun Zhang, Zihao Xie et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.