Fix agent generation