Switch to async state transitions, added agent scaffolding