#middleware for ai reliability