Global protocols for multi-agent LLM systems

Deadlock-free agent workflows, written once.

ZipperGen is a Python DSL and runtime for structured multi-agent LLM coordination. Write one global protocol describing messages, actions, and decisions; ZipperGen projects it onto each agent and runs the result concurrently.

Core projection theorems machine-checked in Lean 4.

ZipperChat showing a workflow execution as a live message sequence chart

Global first

Write the coordination once as a protocol instead of scattering it across agent prompts and callbacks.

Projected locally

Each lifeline receives the local program it needs: sends, receives, owned decisions, tool calls, and optional human control points.

Deadlock-free

If the workflow compiles, the coordination layer is structurally deadlock-free by construction.

Branching has an owner.

The annotation @ Editor says that Editor owns the decision. ZipperGen generates the control communication needed by the other lifelines.

@workflow
def write_tweet(topic: str @ User) -> str:
    User(topic) >> Writer(topic)
    Writer: tweet = draft(topic)
    Writer(tweet) >> Editor(tweet)
    Editor: approved = approve(tweet)

    if approved @ Editor:
        Editor(tweet) >> User(tweet)
    else:
        Editor(tweet) >> Writer(tweet)
        Writer: tweet = revise(tweet)
        Writer(tweet) >> User(tweet)

    return tweet @ User

Causal runtime guards

When locally received data can be stale, guards can read the latest causally visible state instead of a sequential log. Vector clocks and message-carried views make the guard result depend on the asynchronous communication structure.

latest_device_on = Y[Device](
    atom(lambda env: env.get("on", False), src="on")
)

if latest_device_on @ Indicator:
    ...

Unordered receives

Co-regions let a receiver accept independent messages in whichever order they arrive, while preserving FIFO order on each channel.

with coregion:
    Analyst_A(a) >> Collector(a_report)
    Analyst_B(b) >> Collector(b_report)

No service required for the first examples.

The built-in mock backend returns placeholder model outputs, so examples can be run without API keys. Switch to OpenAI, Mistral, or Claude with one configuration line when you want real model calls. ZipperGen can also use OpenAI-compatible local model servers such as vLLM; the repository includes a small local Qwen/vLLM example.

git clone https://github.com/zippergen-io/zippergen.git
cd zippergen
pip install -e .

python examples/coregion.py
python examples/cpl_test.py
python examples/write_tweet.py

Based on Message Sequence Charts.

The projection from a global protocol to per-agent local programs is syntax-directed, and deadlock-freedom follows by structural induction; no runtime checking required. The core theorems are in the paper and machine-checked in Lean 4.

Bollig, Függer, Nowak. Provable Coordination for LLM Agents via Message Sequence Charts. arXiv:2604.17612 [cs.PL]

Build inspectable agent workflows.

Start from the examples, inspect the generated message sequence chart, and decide whether global protocols fit your agent system.