How to Diagnose Failures in LLM Multi-Agent Systems: A Step-by-Step Guide to Automated Attribution
Introduction
If you've ever built a multi-agent system powered by large language models (LLMs), you know the frustration: the system runs, agents chatter, and yet the final output fails—often without a clear culprit. Sifting through reams of interaction logs to pinpoint which agent caused the breakdown and at what moment is like finding a needle in a haystack. This time-consuming manual debugging stalls iteration and optimization.

Recent breakthroughs by researchers from Penn State University and Duke University, in collaboration with institutions including Google DeepMind, University of Washington, Meta, Nanyang Technological University, and Oregon State University, introduce a solution: Automated Failure Attribution. Their work, accepted as a Spotlight presentation at ICML 2025, provides the first benchmark dataset (Who&When) and automated methods to identify the responsible agent and the precise point of failure. This guide walks you through applying these techniques to your own multi-agent systems, turning guesswork into precision.
What You Need
Before beginning, gather the following materials and prerequisites:
- Access to interaction logs from your LLM multi-agent system (e.g., conversations between agents, tool calls, decision sequences).
- Basic understanding of agent roles and task decomposition in your system (e.g., planner, executor, reviewer).
- Python environment (3.8+) with libraries for data processing (pandas, json, etc.).
- Optional but helpful: Familiarity with LLM APIs and agent frameworks (e.g., LangChain, AutoGen).
- Download the open-source resources:
- Who&When dataset: Hugging Face
- Code repository: GitHub
- Research paper: arXiv
Step-by-Step Guide
Step 1: Identify the Failure Scenario
Start by clearly defining the failure you are investigating. Multi-agent systems fail in various ways: incorrect final answer, timeout, contradictory outputs, or an agent getting stuck in a loop. Document the expected behavior versus the actual outcome. For example, if your system is supposed to generate a financial report but returns incomplete data, that is your failure.
Tip: Run your system multiple times to confirm the failure is reproducible. Intermittent failures may require different attribution strategies.
Step 2: Collect and Structure Interaction Logs
Gather all logs from the failed run. Modern multi-agent frameworks record timestamped messages, agent names, content, and sometimes metadata like token usage or confidence scores. Structure this data into a consistent format—for instance, a JSON array where each entry contains:
agent_id(e.g., "Planner", "MathExpert")timestampmessage(the actual text or tool call)role(e.g., "assistant", "user", "function")
If your logs are unstructured, write a small parser to extract these fields. The provided code includes utilities for reading common log formats.
Step 3: Utilize the Who&When Benchmark Dataset
The researchers built Who&When, a dataset of multi-agent failure traces with ground-truth labels indicating the responsible agent and step. Use this to validate your attribution methods before applying them to your own data. Follow these sub-steps:
- Clone the repository and download the dataset from Hugging Face.
- Familiarize yourself with the data schema: each trace has a
failure_scenario, a list ofinteractions, and aground_truthfield containing the failed agent and step index. - Run the baseline attribution methods (e.g., the "LLM-as-Judge" approach described in the paper) on a few sample traces to ensure your environment works.
This step is crucial: it calibrates your expectations and gives you metrics (accuracy, recall) to compare against.
Step 4: Apply Automated Attribution Methods to Your Logs
Now, process your own failure logs using the attribution methods provided. The repository implements several techniques:

- Trajectory-Level Attribution: Analyzes the entire conversation history to pinpoint the most likely failure point.
- Step-Level Attribution: Focuses on the immediate context around each agent's action.
- Contrastive Attribution: Compares the failed run against a successful run (if available) to highlight differences.
Run the attribution script with your log file as input. For example:
python attribute_failure.py --log_file your_log.json --method trajectory
The script outputs a ranked list of (agent, step) pairs with confidence scores. Review the top candidate first.
Step 5: Interpret and Validate the Attribution Results
Automated attribution is not infallible. Manually inspect the logs at the identified step. Ask these questions:
- Does the agent's action directly contradict the task goal?
- Was there a misunderstanding between agents (e.g., incorrect information passed)?
- Did the agent lack necessary context or tools?
If the attribution seems wrong, consider adjusting parameters (e.g., the LLM's temperature or prompt instructions in the judge model). The paper reports baseline accuracy around 70-80% on Who&When, so human validation is essential.
Step 6: Iterate and Optimize Your System
Once you've confirmed the root cause, implement a fix. Common remedies include:
- Refine agent prompts to avoid ambiguity.
- Add sanity checks or constraints for the faulty agent.
- Redesign the communication protocol (e.g., enforce structured message formats).
Re-run the system and verify the failure is resolved. If the same type of failure recurs, revisit the attribution—the problem might be systemic, not agent-specific.
Tips for Success
- Start with a simple failure. Practice attribution on a single-agent mistake before tackling multi-agent chain failures.
- Combine methods. The paper found that ensembling trajectory-level and step-level attribution improves accuracy.
- Leverage open-source tools. The code and dataset are fully open—contribute improvements back to the community.
- Document your attribution process. Keep records of which failures you analyzed and what fixes worked; this builds institutional knowledge.
- Watch for communication errors. Many multi-agent failures stem from miscommunication, not individual agent incompetence. The paper's dataset includes many such examples.
Automated failure attribution transforms debugging from a detective's chore into a systematic, data-driven process. By following these steps, you can dramatically reduce the time spent on root-cause analysis and accelerate the development of robust multi-agent systems. Embrace the tools and methods from this groundbreaking research—your future self (and your agents) will thank you.
Related Articles
- Unlocking the Olfactory Code: How Scientists Discovered the Nose's Hidden Map
- 10 Groundbreaking Facts About NASA's Supersonic Mars Helicopter Blades
- Beyond the Gym: Scientists Uncover Creatine's Critical Role in Brain and Heart Health
- The Gentlemen RaaS and SystemBC: New Proxy Malware Botnet Exposes 1,570 Corporate Victims
- Shock Your Coffee: How Electricity Could Revolutionize Your Morning Brew
- How to Map the Milky Way's Star-Forming Edge Using Stellar Age Data
- The Deadly Landslides Triggered by Cyclone Maila in Papua New Guinea: Key Questions Answered
- How Scientists Discovered the Juan de Fuca Plate Is Tearing Apart Under the Pacific Northwest