Improve build script
Update agent tests to new Script API