Hi Flavio,
Sharing my experience, I was moving the same path as yours using AT commands, but found AT commands API's are poor and needs a lot of work to implement a single protocol. I found the Arduino SDK for ESP is much better for its stability ,community support and have a lot of ready to use modules for several protocols (HTTP ,MQTT , modbus TCP ,etc) and also LWIP sockets API's. I was worried that Arduino environment is not suitable for production. butĀ guess what it's much stable than STM32f4 and I currently have a product based on Arduino's SDK, the problem I experienced during development is the Arduino IDE does not have a debugger mode to track bugs. however there are other solutions (IDE's that support ESP Arduino SDK and also a debugger so you can set breakpoints, etc...).
Amr Elsayed.