AUTOACT: Automatic Agent Learning from Scratch via Self-Planning