With a good CLI, an agent may be able to do something outside of the scope of it's skill fairly easily, by running help commands or similar. With even a well written API it is not as easy.
I suppose that curl + API docs could replace a CLI but that's really token inefficient