Added better agent code for a simple web UI