initial agent code
not working version but with all function signatures