using arduino cli and installing it locally, to then make a shell script so that an agent can build, upload, read & modify from the board (considering that the circuitry is decent).
discussed using logic analyzers to debug circuits & serial communication. you can buy a saleae clone (like so), and it can also start an automation server (which can then be probed by a python script).