Agent Deployment
Learn how to run a conversational agent on your local machine, test it in a development environment, and deploy it to production.
Agents built with Novu can run on your local machine. Deploy them to development and production environments when you are ready.
Agent on your local machine
By default, the agent runs on your local machine. To run the agent locally:
- Scaffold your agent with
npx novu init -t agent. - Add valid
NOVU_SECRET_KEYandNOVU_API_URLvalues to your.envfile. - Run the scaffolded project on your local machine.
- Set the bridge option to
Localin the agent overview section.
When you complete these steps, run the agent using the Novu CLI command below.
- bridge_application_port - Port where your scaffolded project runs. Defaults to 4000.
- no-studio - Disables Studio.
After you run the command, a tunnel starts on your machine. It forwards requests to your scaffolded project on bridge_application_port.
Novu sets the bridge URL automatically to tunnel-url/api/novu.
The agent listens for new messages and responds while running locally.
Agent in development
After you test the agent locally, deploy it to a development environment. A scaffolded app from npx novu init -t agent uses Next.js and exposes a /api/novu endpoint for communicating with Novu. Deploy the app to your preferred hosting provider, then copy the deployed URL.
- Add valid
NOVU_SECRET_KEYandNOVU_API_URLvalues in the environment variables section of your hosting provider. - Toggle the bridge option to
Developmentin the agent overview section. - For a deployed app at
https://dev.my-agent-app.com, usehttps://dev.my-agent-app.com/api/novuas the bridge URL in the agent overview section.
Agent in production
Before you use an agent in production, publish the agent from the development environment to the production environment. Use the Publish changes option on the dashboard.
After you publish:
- Publishing sends the agent to production with the same name, identifier, and description.
- The agent stays inactive until you activate it from the agent overview section.
- Configure and connect every provider again in the production environment.
- Deploy the agent bridge application to the production environment.
- Add valid
NOVU_SECRET_KEYandNOVU_API_URLvalues in the environment variables section of your hosting provider.
Deploying to production
After you publish the agent and complete the above steps, deploy the agent bridge application to the production environment.
Using Novu CLI
For example, with https://prod.my-agent-app.com as the bridge app URL, use https://prod.my-agent-app.com/api/novu as the bridge URL.
In the command above:
<bridge_url>: URL of your deployed agent bridge application.<NOVU_SECRET_KEY>: secret key for your Novu account.<NOVU_API_URL>: API URL for your Novu account.
After you run the command, the agent overview section shows the updated production bridge URL.
Using GitHub Actions
You can use our built-in GitHub Action to deploy your agent to the production environment.-->