added 'begin' and 'next' methods for iterating pool agents in the 'do' section