Orders middleware topologically by runsBefore / runsAfter (a.runsBefore(b) and b.runsAfter(a) are the same edge, a outside b), breaking ties by registration order. One ValidationError lists every invalid id, duplicate id, constraint naming an id that is not registered, cycle, and tool name contributed twice by one middleware or by more than one; when there is none, the order is checked against every middleware's AgentMiddleware.placement, and one ValidationError lists each middleware that runs inside one it must run outside.
Orders middleware topologically by runsBefore / runsAfter (a.runsBefore(b) and b.runsAfter(a) are the same edge, a outside b), breaking ties by registration order. One ValidationError lists every invalid id, duplicate id, constraint naming an id that is not registered, cycle, and tool name contributed twice by one middleware or by more than one; when there is none, the order is checked against every middleware's AgentMiddleware.placement, and one ValidationError lists each middleware that runs inside one it must run outside.