Make agent reentrant. Tests.