Updated agent with idempotency flag protection against intital connect failures.