[minor] move agent socket init at the end of context creation