Type disciplines make programs safe by construction: components checked against each other's types compose into programs that cannot go wrong in the ways the types exclude. Types suit reinforcement learning: a type constrains what an agent may choose, not how it chooses, so the guarantee holds for every policy a learner produces. We introduce epistemic typestates, a type discipline for safe multi-agent reinforcement learning. An agent's type is a protocol whose states record its beliefs, the worlds it cannot rule out from its own observations and actions, and permits only actions that are safe in every world of the belief, whatever the others do within their public types. Agents learn inside their types, which are built and checked one agent at a time and run without communication. We prove type soundness and team safety, give a synthesis that is sound and complete, build types from guards when worlds are infinite, and show that shields are a special case. All proofs are mechanised in Rocq. On nine benchmarks, no typed learner causes a safety violation, and task performance does not differ significantly from that of two recent multi-agent shielding methods. Where a contract-based method fails at five and ten agents, types for ten agents are built in under a second. In the two continuous benchmarks, Lagrangian learners cause thousands of violations in every training run.
Figures & tables
Figure 1: Car 1 senses its speed v , the speed vf of car 2 and their gap d (black). The speed vff of car 3 and the gap df of car 2 are hidden from it (grey, dashed).
Method
Runtime information
Model behind the guarantee
Dependencies between agents
[ 5 ]
joint state; communication with the shields
finite joint abstraction
centralised, or factored with coordination
[ 56 ]
shared abstract label and own action; internal shield state
centralised shield over a finite abstraction
inherited from the centralised shield
[ 7 ]
own observations, bounded history
centralised shield over a finite joint abstraction
inherited from the centralised shield
[ 8 ]
own observations, as beliefs about a global machine
global Mealy machine
projected from the global machine
[ 6 ]
current projection, no memory
finite state space, projected per agent
acyclic: ordered assume-guarantee
[ 9 ]
global state, or contract and local history if they fix the mask; contract selection synchronised in training
finite global model; contracts certified together
circular, certified together
Table 1: Multi-agent shielding methods compared with epistemic typestates.
Figure 2: A path through car 1’s typestate, with C empty. Boxes show the observation and the possible hidden pairs, with dots for further pairs; b , c and a mean brake, coast and accelerate. Black arrows trace the path, grey arrows other permitted actions, and the dashed arrow an excluded one; other successors are omitted.
Benchmark
Agents
Safety requirement
Information used by the type
Discrete worlds, synthesised types
Car Platoon
2, 5, 10
Every gap stays in (0,20) , or in (0,200) in Brorholt et al.’s version
Own speed, predecessor speed and own gap
Connector [ 61 ]
2
A reserved cell stays clear until its owner connects
Own head marker on the observed board
Flatland [ 62 ]
2
No train is deadlocked
Own distance, stopped and opposite-train features
LBF [ 63 ]
2, 5, 10
No load attempt fails
Full-sight food and player observation
Discrete worlds, types from guards
Table 2: Benchmarks. Counts refer to controlled agents. Type inputs can be combined with own history and public facts.
Benchmark ( n )
Adalat mask local?
IPPO
IQL
Typestate
Adalat
Typestate
Adalat
Team return ↑
Car Platoon, 2
No
−464.6±0.0
−419.8±0.0
−464.6±0.0
−449.4±8.2
Car Platoon, 5
–
−1528.9±0.0
nc
−1533.8±4.9
nc
Car Platoon, 10
–
−4206.3±0.0
nc
−4206.4±0.1
nc
Connector, 2
Yes
1.7±0.0
1.7±0.0
1.2±0.3
1.2±0.3
Table 3: Performance on Adalat et al.’s benchmarks ( n : agents). Adalat mask local: whether own history and contract determine the shield’s mask, in Flatland only for the profiles selected for evaluation. ∗ Checked on winning states. nc : no certified profile found. budget : not completed within 32 GiB. Car Platoon reports negative gap rewards.
Figure 3: Construction time and availability. (a) Times at the native populations: each Adalat mark is one of five attempts, including the profile search, and each typestate mark one local compilation. (b) Outcomes at two, five and ten agents. “No cert.”: no certified profile found. “Budget”: not completed within 32 GiB.
Followers
Typestate
Brorholt
Summed follower cost ↓
2
5526.6±78.3
5580.5±82.3
5
14669.0±215.3
14961.8±221.6
10
32146.7±747.6
31477.7±383.6
Table 4: Car Platoon with Brorholt et al.’s cascading learner and the same local observations, as means ± standard errors over ten repetitions.
Learner/type
Success
Return
Return without spawn penalties
Agent crashes
Spawn crashes
IPPO Typestate
0.65±0.00
−32.9±0.0
−19.5±0.0
0.00±0.00
0.57±0.00
IPPO Unshielded
0.11±0.01
−121.5±2.1
−121.5±2.1
2.24±0.06
0.00±0.00
IQL Typestate
0.52±0.01
−51.0±0.8
−26.6±0.7
0.00±0.00
0.84±0.01
IQL Unshielded
0.72±0.01
−56.9±0.9
−56.1±0.7
0.33±0.01
0.03±0.01
Table 5: Traffic Junction on the medium map, as means ± standard errors over five training seeds. Success is the native fraction of collision-free episodes. Spawn collisions also count as failures. Crash columns count onsets per episode.
Learner
Variant
Return ↑
Targets ↑
Collisions per episode ↓
Collisions in training ↓
MPE simple spread
IPPO
Typestate
−180.1±5.4
0.318±0.029
0.000±0.000
0±0
Lagrangian
−355.4±2.3
0.026±0.002
0.035±0.002
17231±67
IQL
Typestate
−233.1±10.4
0.178±0.023
0.000±0.000
0±0
Lagrangian
−268.0±9.1
0.064±0.006
0.343±0.070
35382±597
VMAS navigation
Table 6: Continuous benchmarks, as means ± standard errors over five training seeds. Targets are the landmarks covered (MPE) and the robots on their goal (VMAS) at the end of an episode, out of six. Collisions are agent-caused onsets.
Figure 4: Shares of actions retained by types and shields. Except for the Brorholt row, points summarise evaluation decisions and bars show one standard error over five seeds. The Brorholt row averages uniformly over reachable states under both controllers.
Safe coordination problems surface in multi-agent reinforcement learning when global safety cannot be enforced by any agent unilaterally: the admissibility of one agent's action may depend on the dynamics of other agents. Decentralised shields can enforce safety at runtime, but purely factorised permissions often exclude optimal team behaviour that is safe only through coordination. We study deterministic safety guarantees for agents trained and deployed under decentralised execution, recovering team-optimal safe behaviour without centralised runtime control. Agents have a shared global specification φ in the safety fragment of Linear Temporal Logic (LTLsafe ), and select among tuples of local LTLsafe obligations whose conjunction implies the global specification φ. Each agent may rely on the other agents' local obligations as assumptions because the whole contract tuple is certified simultaneously and allows projection into local action masks. At learning time, a non-stationary multi-armed bandit chooses among a library of local LTLsafe obligations to select the tuple that optimises team reward, all without forgoing end-to-end safety. We evaluate the approach across 6 environments and 15 algorithmic variants.
Omar Adalat, Edwin Hamel-De le Court, Francesco Belardinelli
Imperial College London, London SW7 2AZ, UK · University of Manchester, Manchester M13 9PL, UK
Cooperative multi-agent tasks often impose constraints on a shared objective or collective safety. A team level violation cost function can measure this constraint outcome, but does not distinguish which agents' actions most strongly influence that violation. We present SafeDiSTL, a constrained multi-agent reinforcement learning framework that allows for credit assignment even with joint constraint measurements. We use Signal Temporal Logic (STL) robustness to measure episode-level violation through running-maximum cost increments. Smooth full-episode robustness and differentiable dynamics provide action sensitivities, which allocate each cost increment across agents at the same decision time. These sensitivities account for delayed effects when weighting agents' shares of each cost increment. We study the framework in cooperative payload transport, connected navigation, and networked traffic control tasks. SafeDiSTL achieves 1.6-5.1x the safe-success rate in transport, improves navigation safe-success by 11.1%, and delivers 50-68% more throughput in traffic when compared to constrained baselines. Results demonstrate a strong improvement of the learned policy in dealing with shared constraint while retaining the performance of unconstrained policies.
Multi-agent systems are widely used in safety-critical applications that require coordinated behavior under strict safety constraints. Existing approaches face a fundamental trade-off: learning-based methods achieve strong empirical performance but lack theoretical safety guarantees, while control-theoretic methods enforce safety but often lead to overly conservative and inefficient behaviors. We propose a hierarchical multi-agent reinforcement learning framework that enforces hard safety constraints under mild assumptions at low level via a constraint manifold, while enabling effective coordination through high-level policy learning. Our approach provides theoretical safety guarantees in the multi-agent setting and yields stationary learning dynamics, thereby enabling stable and efficient training. Empirically, our method achieves competitive performance while maintaining nearly perfect safety rates, and generalizes effectively to varying numbers of agents and obstacles.
Zihao Guo, Jianing Zhao, Ling Li +3
1King’s College London · University of California, Berkeley · 3The Alan Turing Institute