Where a middleware must run relative to another (AgentMiddleware.placement): a position its correctness depends on, which the stack checks rather than leaving to the documentation.
As Outside, and across an agent family too, for a requirement about beforeAgent and afterAgent: the root agent's boundary hooks run outside the active agent's own, so this middleware on a handoff target is refused when the root has the other, whatever the order.
As Outside, and across an agent family too, for a requirement about beforeAgent and afterAgent: the root agent's boundary hooks run outside the active agent's own, so this middleware on a handoff target is refused when the root has the other, whatever the order.