Provable Coordination for LLM Agents via Message Sequence Charts
LLM-based multi-agent systems are prone to coordination errors such as deadlocks and type-mismatched messages, which testing rarely uncovers. Existing agent frameworks provide no formal coordination guarantees.
The authors define a domain-specific language based on message sequence charts. It separates message-passing structure from opaque LLM, tool, and human actions, and gives the language a formal syntax and MSC semantics. A syntax-directed projection turns global workflows into local agent programs, using explicit control broadcasts from the owner of each decision. All definitions and correctness results are machine-checked in Lean 4, and the framework is implemented in Python as ZipperGen, including a runtime planning extension where an LLM generates the workflows.
The projection is always defined, needs no realizability check, and is deadlock-free by construction. This is illustrated on a medical diagnosis consensus protocol. In the runtime-planning experiment, GPT-4.1 and GPT-4.1 mini had all 10 generated workflows accepted and executed, while small local models and GPT-4o mini produced none that were accepted.
| Model | Accepted first | Accepted within 8 | Executed | Correct |
|---|---|---|---|---|
| qwen2.5:14b (local) | 0 | 0 | 0 | 0 |
| GPT-4o mini | 0 | 0 | 0 | 0 |
| GPT-4.1 mini | 0 | 10 | 10 | 9 |
| GPT-4o | 7 | 8 | 8 | 7 |
| GPT-4.1 | 10 | 10 | 10 | 6 |
