How ChatGPT Optimizes its Agent Loop: Harness, API, and Inference