TL;DR
Researchers have introduced PDoctor, an automated testing framework that treats LLM agent planning as a constraint satisfiability problem. By synthesizing complex user queries and using "mock tools" to track execution, PDoctor reveals that even state-of-the-art models like GPT-4 frequently fail at long-term planning, particularly when faced with temporal constraints.
What Problem Does This Paper Address?
Large Language Model (LLM) agents are increasingly deployed in high-stakes environments like chemical synthesis and financial services. While LLMs are great at "text-in, text-out" tasks, their ability to act as agents—decomposing a goal into a sequence of tool calls (planning)—is notoriously brittle.
Existing evaluations often fail to isolate the "planning" module from other failures, such as poor tool design or bad natural language understanding. Furthermore, most benchmarks are static. In the real world, an agent must often adjust its plan based on tool feedback or manage global resources like time. The authors address the lack of a systematic, automated way to detect and understand these planning failures.
Methods
The authors propose PDoctor, which operates on the principle that a plan is "erroneous" if it violates constraints derived from the user's request. Its workflow consists of three main pillars:
- Constraint-Based Synthesis: PDoctor uses a specialized Domain-Specific Language (DSL) to generate "skeletons" of user queries. It then uses the Z3 constraint solver to ensure these skeletons are logically satisfiable before filling them with natural language. This allows the system to generate thousands of unique, complex test cases with known "ground truth" constraints.
- The "Mock Tool" Approach: To isolate the planning module, PDoctor creates "mock tools" that don't actually perform complex tasks. Instead, they simply record their execution order and parameters to a log file. This ensures that if a test fails, it’s because the agent planned the wrong sequence, not because a tool crashed.
- Error Dissection: When an agent fails, PDoctor automatically mutates the query (changing specific words, topics, or the entire structure) to pinpoint the root cause. Is the error a fluke of randomness (Probability), a reaction to specific words (Terminal), or a fundamental inability to handle the logical complexity (Constraint)?
The researchers also created an Extended Testing Framework that introduces time and duration constraints, forcing agents to manage a "schedule" and re-plan if a tool takes longer than expected.
Key Insights and Ideas
- The "Planning Wall": LLM agents have a clear "upper bound" for planning. GPT-3.5’s success rate plummets once a task requires more than 3 actions. GPT-4 is much more robust but begins to struggle significantly after 8 actions.
- Order Errors Dominate: The most common failure isn't forgetting a task or failing to call a tool; it’s Order Error—executing steps in a sequence that violates the user's logic.
- Frameworks Matter: Frameworks that use fine-tuned function calling (OpenAI Tools and Assistant) significantly outperform the "prompt-only" ReAct framework, especially as tasks get more complex. ReAct’s long prompt templates often cause the model to "forget" earlier instructions.
- The Fragility of Time: Adding temporal constraints (e.g., "Task A must happen after 10:00") makes the problem exponentially harder. Under these conditions, GPT-3.5 becomes almost entirely unusable for planning, and even GPT-4's success rate drops below 50% for relatively simple 5-step tasks.
Key Results
- Effectiveness: PDoctor successfully detected thousands of planning errors across all tested models and frameworks.
- Model Comparison: GPT-4 reduced the error rate by an average of 48.53% compared to GPT-3.5.
- Efficiency: Despite using a formal constraint solver (Z3), the synthesis process is fast, averaging only 0.07 seconds to generate a test case. The bottleneck remains the LLM's own inference speed.
- Root Causes: Through dissection, the authors found that Terminal (specific word choice) and Probability (randomness) are major factors in failures, suggesting that agent behavior is still highly sensitive to "prompt engineering" nuances.
Limitations and Future Work
- Common Sense Conflicts: The framework assumes that the only constraints are the ones provided in the query. It doesn't yet account for "common sense" dependencies (e.g., you must open a door before walking through it) unless explicitly stated.
- Self-Correction: While the paper notes that agents struggle to re-plan, it doesn't deeply explore how to fix these errors automatically.
- Future Directions: The authors suggest using PDoctor's "error-driven" feedback to fine-tune models specifically for planning, potentially using the Z3 solver's "unsat core" feature to tell the LLM exactly which constraint it violated.
Summary updated