Installation
You’ll need npm installed to use the CLI.We recommend running commands with
npx instead of installing globally.
Commands
login
init
--agent-id <agent_id>: (optional) Link an existing agent. If not provided, a new agent will be created.
tunnel
--agent-id=<value>Specify the unique identifier of the agent. If omitted, the CLI checks theLAYERCODE_AGENT_IDenvironment variable, then any entry ending withLAYERCODE_AGENT_IDin your project.envfile. If nothing is found, the command will fail.--path=<value>[default: /api/agent] Set the API path to append for the agent endpoint.--port=<value>[default: 3000] Port number to run the tunnel on.--tailContinuously stream logs, including CLI messages
Example Usage
Troubleshooting
If you encounter issues:- Ensure npm and Node.js are installed and up-to-date.
- Try logging out and back in with
npx @layercode/cli login. - By default, your tunnel will set your webhook url path as /api/agent. You should update this with the —path flag based on where your webhook endpoint is inside your application e.g. ‘/api/agent’ or at the root ’/’ or ‘/voice-agent’. See our guide on webhooks for more details