Here is a cli for the copilot agent mode: https://www.npmjs.com/package/pilot-agent-cli The source code may help you invoke @github/copilot-language-server