Skip to content

Step 6: Deploy to Production

Step 6: Deploy to Production

Your DevOps agent is complete. It has:

  • βœ… An intelligent agent that diagnoses infrastructure problems
  • βœ… Tools for health checks, metrics, and restarts
  • βœ… Channels for webhooks (alerts, GitHub, Slack)
  • βœ… Triggers that auto-react to events
  • βœ… Durable workflows with approval gates

Time to deploy it to production so it runs 24/7.


Step 1: Set Up Environment Variables

Create a .env.local file (for local development):

Terminal window
# Required: Your AI provider
OPENAI_API_KEY=sk-...
# Optional: Slack integration
SLACK_BOT_TOKEN=xoxb-...
SLACK_SIGNING_SECRET=...
# Optional: For Render API restarts
RENDER_API_KEY=rnd_...

These will also need to be added on Kernova Cloud.


Step 2: Update the Config

Make sure kernova.config.ts is production-ready:

import { defineConfig } from '@kernova/framework';
export default defineConfig({
name: 'devops-agent',
description: 'Autonomous DevOps agent for infrastructure monitoring and incident response',
model: {
provider: 'openai',
name: 'gpt-4o',
temperature: 0.3, // Low temperature for reliable ops decisions
},
deploy: {
platform: 'kernova-cloud',
region: 'us-east',
},
});

Step 3: Push to GitHub

If you haven’t already, initialize git and push:

Terminal window
git init
git add .
git commit -m "feat: autonomous devops agent with workflows and triggers"
git remote add origin https://github.com/YOUR_USERNAME/devops-agent.git
git push -u origin main

Step 4: Connect to Kernova Cloud

Option A: Deploy from the CLI

Terminal window
# Login to Kernova Cloud
kernova login
# Deploy
kernova deploy

The CLI:

  1. Pushes your code to the connected GitHub repo
  2. Sends a deploy request to Kernova Cloud
  3. Kernova Cloud creates a Render service
  4. Render builds and starts your app
  5. Your agent is live

Option B: Deploy from the Dashboard

  1. Go to kernova-cloud.vercel.app
  2. Click β€œImport Project”
  3. Select your devops-agent GitHub repo
  4. Kernova Cloud auto-detects the framework and deploys

Step 5: Add Environment Variables

In the Kernova Cloud dashboard:

  1. Open your project β†’ Environment tab
  2. Add each variable:
KeyValueDescription
OPENAI_API_KEYsk-...AI provider key
SLACK_BOT_TOKENxoxb-...Slack bot token
SLACK_SIGNING_SECRET...Slack app signing secret
RENDER_API_KEYrnd_...Render API key (for restarts)
  1. Click β€œSave & Redeploy”

Step 6: Set Up Webhook URLs

Once deployed, your app will be live at something like:

https://kn-devops-agent.onrender.com

Now configure your monitoring tools to send alerts to:

POST https://kn-devops-agent.onrender.com/hooks/alerts

And GitHub webhooks to:

POST https://kn-devops-agent.onrender.com/hooks/github

UptimeRobot Example

  1. Go to UptimeRobot β†’ Alert Contacts β†’ Add Contact
  2. Type: Webhook
  3. URL: https://kn-devops-agent.onrender.com/hooks/alerts
  4. POST body:
    {
    "source": "uptimerobot",
    "severity": "critical",
    "service": "*monitorFriendlyName*",
    "message": "*alertDetails*"
    }

GitHub Webhook Setup

  1. Go to your repo β†’ Settings β†’ Webhooks β†’ Add webhook
  2. Payload URL: https://kn-devops-agent.onrender.com/hooks/github
  3. Content type: application/json
  4. Select events: Push, Releases, Deployment status

Step 7: Set Up a Custom Domain (Optional)

In the Kernova Cloud dashboard:

  1. Open your project β†’ Domains tab
  2. Add: devops.yourdomain.com
  3. Add the CNAME record to your DNS:
    devops.yourdomain.com β†’ kn-devops-agent.onrender.com

Step 8: Monitor in Production

Check Agent Status

In the dashboard, go to Agents tab:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ€– devops β”‚
β”‚ β”‚
β”‚ Status: ● Online β”‚
β”‚ Model: gpt-4o β”‚
β”‚ Uptime: 3 days, 14 hours β”‚
β”‚ Actions today: 47 β”‚
β”‚ β”‚
β”‚ Active Workflows: β”‚
β”‚ incident-response β€” Step 4 (awaiting) β”‚
β”‚ daily-audit β€” Completed 2h ago β”‚
β”‚ β”‚
β”‚ Recent Triggers: β”‚
β”‚ on-critical-alert β€” fired 15 min ago β”‚
β”‚ scheduled-health-check β€” fired 2 min ago β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Check Workflow History

In the Workflows tab:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Workflow Runs β”‚
β”‚ β”‚
β”‚ incident-response 10:30 AM βœ“ Completed (5/5 steps) β”‚
β”‚ incident-response 09:15 AM βœ— Denied at step 4 β”‚
β”‚ daily-audit 06:00 AM βœ“ Completed (2/2 steps) β”‚
β”‚ incident-response Yesterday βœ“ Completed (5/5 steps) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

View Logs

In the Logs tab, you’ll see real-time output:

10:30:02 [Channel: alerts] Received alert from uptime-monitor
10:30:02 [Trigger: on-critical-alert] Firing for api-gateway
10:30:03 [Workflow: incident-response] Starting step: detect
10:30:04 [Tool: check-health] api-gateway β†’ unhealthy (503)
10:30:04 [Workflow] Step "detect" completed. Checkpointed.
10:30:05 [Workflow: incident-response] Starting step: diagnose
10:30:06 [Tool: get-metrics] Memory: 94%, Uptime: 7 days
10:30:06 [Workflow] Step "diagnose" completed. Checkpointed.
10:30:07 [Workflow: incident-response] Starting step: notify
10:30:07 [Slack] Sent to #incidents
10:30:07 [Workflow] Step "fix" β€” AWAITING APPROVAL

Complete Project Structure (Final)

devops-agent/
β”œβ”€β”€ agents/
β”‚ β”œβ”€β”€ devops.ts # Main agent definition
β”‚ β”œβ”€β”€ tools/
β”‚ β”‚ β”œβ”€β”€ check-health.ts # Health check tool
β”‚ β”‚ β”œβ”€β”€ get-metrics.ts # Metrics tool
β”‚ β”‚ └── restart-service.ts # Restart tool (requires approval)
β”‚ β”œβ”€β”€ channels/
β”‚ β”‚ β”œβ”€β”€ alerts.ts # Webhook for monitoring alerts
β”‚ β”‚ β”œβ”€β”€ github.ts # GitHub webhook events
β”‚ β”‚ └── slack.ts # Slack two-way communication
β”‚ β”œβ”€β”€ triggers/
β”‚ β”‚ β”œβ”€β”€ on-alert.ts # Auto-investigate critical alerts
β”‚ β”‚ β”œβ”€β”€ on-deploy.ts # Post-deploy health checks
β”‚ β”‚ └── scheduled-check.ts # Every 5 minutes health scan
β”‚ └── workflows/
β”‚ β”œβ”€β”€ incident-response.ts # Full incident pipeline (5 steps)
β”‚ └── daily-audit.ts # Scheduled daily report
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ page.tsx # Dashboard UI
β”‚ └── layout.tsx # Next.js layout
β”œβ”€β”€ .env.local # Local environment variables
β”œβ”€β”€ kernova.config.ts # Framework configuration
β”œβ”€β”€ package.json
└── tsconfig.json

What You Built

Let’s recap the entire system:

LayerWhat You BuiltHow It Works
AgentDevOps personality with system promptUnderstands infrastructure, thinks like an SRE
Toolshealth check, metrics, restartAgent calls these to interact with infra
ChannelsWebhooks (alerts, GitHub), SlackExternal systems send events INTO the agent
TriggersCritical alerts, post-deploy, scheduleRules that auto-wake the agent
WorkflowsIncident response, daily auditMulti-step durable pipelines with approval
ApprovalHuman-in-the-loop on restartDangerous actions require human sign-off
DeployKernova Cloud + RenderRuns 24/7 in production

What’s Different from a Basic Chatbot

FeatureBasic ChatbotYour DevOps Agent
InputOnly responds to chatReacts to webhooks, schedules, events
SafetyNo guardrailsApproval gates on dangerous actions
ReliabilityLoses state on crashDurable execution with checkpointing
Multi-stepSingle turnWorkflows with multiple steps
IntegrationNoneSlack, GitHub, monitoring tools
DeploymentManualOne-command deploy with CI/CD

Next Steps

Now that you’ve mastered the advanced features, here are ideas to extend your agent:

  1. Add more tools: Scale up/down instances, roll back deployments, manage DNS
  2. Add more channels: PagerDuty, Discord, Telegram, email
  3. Add more workflows: Deployment pipeline, security scan, cost optimization
  4. Add memory: Track incident history, learn from past issues
  5. Multi-agent: Create a β€œsecurity” agent and a β€œperformance” agent that collaborate

Congratulations! πŸŽ‰

You’ve built a production-grade autonomous DevOps agent using the full power of the Kernova framework:

  • defineAgent β€” the brain
  • defineTool β€” the hands
  • defineChannel β€” the ears
  • defineTrigger β€” the reflexes
  • defineWorkflow β€” the long-term memory and planning
  • requiresApproval β€” the safety net

This is what separates a toy chatbot from a real AI agent that runs in production. Ship it.


Full Tutorial Navigation

  1. Introduction
  2. Project Setup
  3. Define the Agent
  4. Build the Tools
  5. Triggers & Channels
  6. Durable Workflows
  7. Deploy to Production (you are here)