Large language model (LLM)-based multi-agent systems have shown strong capabilities in tasks such as code generation and collaborative reasoning. However, the effectiveness and robustness of these systems critically depend on their communication topology, which is often fixed or statically learned, ignoring real-world dynamics such as model upgrades, API (or tool) changes, or knowledge source variability. To address this limitation, we propose CARD (Conditional Agentic Graph Designer), a conditional graph-generation framework that instantiates AMACP, a protocol for adaptive multi-agent communication. CARD explicitly incorporates dynamic environmental signals into graph construction, enabling topology adaptation at both training and runtime. Through a conditional variational graph encoder and environment-aware optimization, CARD produces communication structures that are both effective and resilient to shifts in model capability or resource availability. Empirical results on HumanEval, MATH, and MMLU demonstrate that CARD consistently outperforms static and prompt-based baselines, achieving higher accuracy and robustness across diverse conditions. The source code is available at: https://github.com/Warma10032/CARD.
Figures & tables
Figure 1: Agent attributes and corresponding communication topologies under two environmental configurations, illustrating that topology is determined by both task requirements and the capabilities of the model base and available resources.
Figure 2: Overview of the Conditional Agentic Graph Designer (CARD) framework. Agent profiles and dynamic environment conditions are encoded into embeddings, which a conditional graph-generation module (Encoder → Condition Adaptation → Decoder) uses to produce an adaptive communication topology. CARD then performs environment-aware training, iteratively refining graphs under changing resource configurations, and deploys runtime adaptation to automatically update the multi-agent topology in response to new environmental states.
Method
Mul.
Auto.
Cond.
gpt4o-mini
deepseek-v3
llama3-70B
gpt4o
qwen-72B
Avg.
HumanEval
Vanilla
✗
✗
✗
85.83
92.50
76.66
85.83
86.66
85.50
CoT
✗
✗
✗
88.33
93.33
78.33
90.00
8 8.33
87.66
Random-graph
✓
✗
✗
87.50
94.16
73.33
90.00
85.00
86.00
LLM-Debate
✓
✗
✗
9 1.66
9 5.00
75.83
87.50
80.00
86.00
GPTswarm
✓
✓
✗
89.16
92.50
78.33
91.66
81.66
86.66
Table 1: Evaluation of multi-agent and topology design methods on HumanEval, MATH, and MMLU. "Mul.", "Auto.", and "Cond." indicate support for multi-agent collaboration, automated topology design, and conditional configuration, where ✓ indicates "Yes" and ✗ indicates "No". For automated methods, CYAN cells denote in-domain adaptation (trained and tested on the same LLM), GREEN cells denote out-domain adaptation (generalization to unseen LLMs), and YELLOW cells denote the average performance.
Figure 3: Performance and gains of w/o Cond., w/ Cond.p, and CARD on HumanEval, MATH, and MMLU across LLM bases (M1–M5, same to Table 1 ). Top: absolute accuracy (%). Bottom: Δ accuracy (%) over the w/o Cond. baseline.
Figure 4: Visualization of CARD topology matrices (See Appendix D for matrices and correlation analysis details.) under different conditions. Edge thickness reflects the communication probability between agents. Configurations 1 to 4 (Table 10 ) are shown from left to right.
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 5: Left : Accuracy on MATH and HumanEval across LLMs with different reasoning capabilities. Right : Accuracy across different model sizes within the same LLM family.
Figure 6: Left : Performance comparison using different external knowledge sources. Central : Performance across various available tools (search engines). Right : Impact on multi-agent performance on HumanEval, when only a single node’s condition is updated instead of the global agent condition.
Figure 7: MMLU performance of CARD vs G-Designer across varying agent counts. CARD consistently outperforms G-Designer in both (a) in-domain and (b) out-of-domain settings, with larger gains under domain shift; shaded areas denote 95% confidence intervals.
Figure 8: Left : Accuracy comparison before and after adversarial attacks across different methods. Right : The inference cost (USD per instance) across methods and LLMs.
Knowlegable Expert
Searcher
Philosopher
Mathematician
Critic
Knowlegable Expert
Masked
0.79
0.88
0.81
0.5
Searcher
0.17
Masked
0.79
0.69
0.34
Philosopher
0.11
0.17
Masked
0.81
0.5
Mathematician
0.15
0.21
0.15
Masked
0.37
Critic
0.25
0.22
0.25
0.23
Masked
Appendix
Table 2: Adjacency Matrix 1: gpt-4o-mini + Google
Knowlegable Expert
Searcher
Philosopher
Mathematician
Critic
Knowlegable Expert
Masked
0.54
0.15
0.4
0.14
Searcher
0.25
Masked
0.53
0.81
0.5
Philosopher
0.13
0.25
Masked
0.39
0.13
Mathematician
0.24
0.15
0.24
Masked
0.36
Critic
0.12
0.25
0.11
0.23
Masked
Appendix
Table 3: Adjacency Matrix 2: gpt-4o + Google
Knowlegable Expert
Searcher
Philosopher
Mathematician
Critic
Knowlegable Expert
Masked
0.73
0.86
0.73
0.46
Searcher
0.2
Masked
0.76
0.57
0.3
Philosopher
0.12
0.18
Masked
0.75
0.5
Mathematician
0.2
0.25
0.19
Masked
0.29
Critic
0.25
0.21
0.25
0.21
Masked
Appendix
Table 4: Adjacency Matrix 3: gpt-4o-mini + Wiki
Knowlegable Expert
Searcher
Philosopher
Mathematician
Critic
Knowlegable Expert
Masked
0.84
0.73
0.8
0.5
Searcher
0.13
Masked
0.67
0.75
0.42
Philosopher
0.2
0.22
Masked
0.6
0.27
Mathematician
0.16
0.19
0.24
Masked
0.35
Critic
0.25
0.24
0.2
0.23
Masked
Appendix
Table 5: Adjacency Matrix 4: Llama-3-70B + Wiki
Comparison
r
p
Strength
Sig.
Matrix 1 vs 2
0.32
0.54
Weak
No
Matrix 1 vs 3
0.98
0.001
Very strong
Yes
Matrix 1 vs 4
0.78
0.07
Strong
Marginal
Appendix
Table 6: Pearson correlation between matrix pairs with corresponding strength and significance.
Configuration
LLM
Role
Train & Test
Configuration 1
gpt-4o-mini
Project Manager
gpt-4o-mini
Algorithm Designer
gpt-4o-mini
Programming Expert
gpt-4o-mini
Test Analyst
gpt-4o-mini
Bug Fixer
Configuration 2
deepseek-v3
Project Manager
Appendix
Table 7: HumanEval Environment Configuration Set
Configuration
LLM
Role
Train & Test
Configuration 1
gpt-4o-mini
Math Solver
gpt-4o-mini
Mathematical Analyst
gpt-4o-mini
Mathematical Analyst
gpt-4o-mini
Programming Expert
gpt-4o-mini
Inspector
Configuration 2
deepseek-v3
Math Solver
Appendix
Table 8: MATH Environment Configuration Set
Configuration
LLM
Role
Train & Test
Configuration 1
gpt-4o-mini
Mathematician
gpt-4o-mini
Programmer
gpt-4o-mini
Critic
gpt-4o-mini
Doctor
gpt-4o-mini
Psychologist
Configuration 2
deepseek-v3
Mathematician
Appendix
Table 9: MMLU Environment Configuration Set
Configuration
LLM
Role
External Tool (search engine)
Train & Test
Configuration 1
gpt-4o-mini
Knowlegable Expert
gpt-4o-mini
Searcher
Google
gpt-4o-mini
Psychologist
gpt-4o-mini
Mathematician
gpt-4o-mini
Critic
Only Test
Configuration 2
gpt-4o
Knowlegable Expert
Appendix
Table 10: MMLU Environment Configuration Set with External Tools
School of Cyberspace, Hangzhou Dianzi University, Hangzhou, China · School of Computing Technologies, RMIT University, Melbourne, Australia · School of Information and Communication Technology, Griffith University, Goldcoast, Australia