The head of an Amazon.com Inc. artificial intelligence lab who led efforts to create autonomous agents is leaving the company.