move main function to new agent.py