Modified to spawn agent.