Agents
Use terraform to manage Kubiya Agents
terraform {
required_providers {
kubiya = {
source = "kubiya-terraform/kubiya"
}
}
}
provider "kubiya" {
//Your Kubiya API Key will be taken from the
//environment variable KUBIYA_API_KEY
//To set the key, please use export KUBIYA_API_KEY="YOUR_API_KEY"
}
resource "kubiya_agent" "agent" {
//Mandatory Fields
name = "Kubernetes Admin" //String
runner = "runner-dev-cluster" //String
description = "This agent can perform various Kubernetes tasks using kubectl"
instructions = "You are an AI agent specialized in managing Kubernetes clusters using kubectl. Your tasks include monitoring pod statuses, scaling deployments, updating container images, and reporting issues to JIRA."
//Optional fields, String
model = "azure/gpt-4" // If not provided, Defaults to "azure/gpt-4"
//If not provided, Defaults to "ghcr.io/kubiyabot/kubiya-agent:stable"
image = "ghcr.io/kubiyabot/kubiya-agent:stable"
//Optional Fields (omitting will retain the current values):
//Arrays
secrets = []
integrations = ["github","jira","aws"]
users = ["john.doe@organization.ai"]
groups = ["Admin"]
links = []
//Objects
starters = [
{
name = "Check pod status"
command = "kubectl get pods"
},
{
name = "Scale deployment"
command = "kubectl scale deployment my-deployment --replicas=3"
}
]
tasks = [
{
name = "Check Container Image Backoff"
prompt = "Check all namespaces for pods in ImagePullBackOff state using 'kubectl get pods --all-namespaces'. If found, report them to JIRA."
description = "Use kubectl to find pods in ImagePullBackOff state and report them to JIRA."
},
{
name = "Update Container Image"
prompt = "Ask the user for the deployment name and the new image. If a specific namespace is provided, filter deployments by that namespace using 'kubectl get deployments -n <namespace>'. Then, update the deployment's container image using 'kubectl set image deployment/<deployment-name> <container-name>=<new-image>'."
description = "Use kubectl to update the container image for the specified deployment."
},
{
name = "Scale Deployment"
prompt = "Ask the user for the deployment name and the desired number of replicas. If a specific namespace is provided, filter deployments by that namespace using 'kubectl get deployments -n <namespace>'. Then, scale the deployment using 'kubectl scale deployment/<deployment-name> --replicas=<number-of-replicas>'."
description = "Use kubectl to scale the specified deployment."
},
{
name = "Get Deployment Details"
prompt = "Ask the user for the deployment name. If a specific namespace is provided, filter deployments by that namespace using 'kubectl get deployments -n <namespace>'. Then, get details of the deployment using 'kubectl describe deployment/<deployment-name>'."
description = "Use kubectl to get details of the specified deployment."
}
]
environment_variables = {
DEBUG = "1"
LOG_LEVEL = "INFO"
}
is_debug_mode = false // boolean, optional
}
output "agent" {
value = kubiya_agent.agent
}
Please note that before an agent is created we validate several inputs by making sure they exist and configured properly before handling your request. The validated inputs are: 1. runner 2. secrets 3. users 4. groups 5. integrations
Agent Parameters:
Mandatory Fields
name = "terraform-agent" // The name of the agent
runner = "terraform" // The runner for the agent
description = "Terraform agent" // The description of the agent
instructions = "use terraform to run the agent" // The instructions for the agent
Optional Fields (omitting will retain the current values)
links = [] //Array
model = "azure/gpt-4" // If not provided, Defaults to "azure/gpt-4"
//available options: "azure/gpt-4", "azure/gpt-4o", "azure/gpt-4-turbo-preview"
//"azure/gpt-4-32k, "azure/gpt-3.5-turbo
image = "ghcr.io/kubiyabot/kubiya-agent:stable"
// Defaults to "ghcr.io/kubiyabot/kubiya-agent:stable"
// optional, the below inputs will be validated:
integrations = ["github","jira","aws"] //Array
users = ["user@domain.io"] // Array
secrets = ["terraform_secret","aws_secret"] // Array
groups = ["Admin","terraformAdmins","terraformUsers"] // Array
starters = [
{
name = ""
command = ""
}
]
//To remove, please use an empty block: starters = [].
tasks = [
{
name = ""
prompt = ""
description = ""
}
]
//To remove, please use an empty block: tasks = [].
environment_variables = {
KEY = "VAL"
KEY2 = "VAL2"
}
//To remove, please use an empty block: environment_variables = {}.
is_debug_mode = true //Enable Agent Debug mode
Last updated