Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Kubernetes-native AI agent framework for building, deploying, and managing AI agents on Kubernetes. This skill should be used when deploying AI agents as Kubernetes resources, analyzing cluster health with AI, and automating complex K8s operations. Use this skill for Phase IV advanced AIOps and agent-based cluster management.
.claude/skills/majiayu000-kagent/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -17% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 92% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -25% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 26% | 0% |
Kagent is a Kubernetes-native framework for building, deploying, and managing AI agents. It uses Custom Resource Definitions (CRDs) to define agents as Kubernetes resources, enabling declarative AI agent management with full K8s integration.
┌─────────────────────────────────────────────────────┐
│ Kubernetes Cluster │
│ ┌─────────────────┐ ┌─────────────────────────┐ │
│ │ Kagent │ │ Custom Resources │ │
│ │ Controller │───▶│ - Agent │ │
│ │ │ │ - Tool │ │
│ │ │ │ - Model │ │
│ └─────────────────┘ └─────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ AI Agent Pods │ │
│ │ - Execute kubectl commands │ │
│ │ - Analyze resources │ │
│ │ - Report findings │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────┘bash# Install CRDs and controller kubectl apply -f https://raw.githubusercontent.com/kagent-dev/kagent/main/dist/install.yaml
bash# Clone repository git clone https://github.com/kagent-dev/kagent.git cd kagent/go # Install CRDs make install # Deploy controller make deploy
bash# Generate consolidated install.yaml make build-installer
Kagent agents can execute standard kubectl commands:
bash# Resource listing kubectl get pods -n namespace kubectl get deployments -n namespace kubectl get services -n namespace # Detailed listing kubectl get pods -n namespace -o wide kubectl get nodes -o wide
bash# Describe resources kubectl describe pod podname -n namespace kubectl describe deployment deployname -n namespace kubectl describe service servicename -n namespace # Get full YAML kubectl get configmap configname -n namespace -o yaml kubectl get secret secretname -n namespace -o yaml
bash# Component health kubectl get componentstatuses kubectl get nodes -o wide # Resource status kubectl get deployments -n namespace -o wide kubectl get pods -n namespace -o wide
bash# Node management kubectl drain <node> kubectl cordon/uncordon <node> # Port forwarding kubectl port-forward svc/my-service 8080:80 # Authorization checks kubectl auth can-i create pods # Debugging kubectl debug pod/my-pod --image=busybox
Kagent agents have access to:
| Tool | Purpose | |------|---------| | crictl | Container runtime interface | | kubelet logs | Node-level logs | | journalctl | System logs | | tcpdump | Network diagnostics | | netstat | Connection status |
Use kagent to analyze overall cluster health before deployment:
bashkagent "analyze the cluster health and report any issues" kagent "check if there are sufficient resources for 5 new pods"
bashkagent "identify pods without resource limits" kagent "find over-provisioned deployments" kagent "recommend resource adjustments based on actual usage"
bashkagent "find pods running as root" kagent "identify services exposed without ingress" kagent "check for secrets mounted as environment variables"
bashkagent "why are pods in namespace X failing?" kagent "analyze network connectivity between services" kagent "find the root cause of OOMKilled pods"
yamlapiVersion: kagent.dev/v1alpha1 kind: Agent metadata: name: cluster-analyzer namespace: kagent-system spec: model: provider: openai name: gpt-4 tools: - kubectl - helm systemPrompt: | You are a Kubernetes cluster analyzer. Focus on identifying resource issues and optimization opportunities.
yamlapiVersion: kagent.dev/v1alpha1 kind: Tool metadata: name: kubectl-tool spec: type: kubectl permissions: - get - list - describe namespaces: - default - production
Kagent complements kubectl-ai:
| Tool | Best For | |------|----------| | kubectl-ai | Ad-hoc commands, quick operations | | kagent | Persistent agents, complex analysis, automation |
bash# Use kubectl-ai for immediate operations kubectl-ai "scale api to 3 replicas" # Use kagent for analysis and recommendations kagent "analyze if scaling to 3 replicas is sustainable given current cluster resources"
Refer to references/agent-patterns.md for common agent configurations.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 22,942 | 17,499 | -24% | 1 | 1 | 0% | 4,579 | 3,692 | -19% | 0 | 0 | — |
case-02 | fail→pass | 18,993 | 4,010 | -79% | 1 | 1 | 0% | 2,653 | 2,194 | -17% | 0 | 0 | — |
case-03 | fail→fail | 25,290 | 12,975 | -49% | 1 | 1 | 0% | 2,001 | 1,625 | -19% | 0 | 0 | — |
case-04 | fail→pass | 11,209 | 3,463 | -69% | 1 | 1 | 0% | 1,032 | 1,980 | +92% | 0 | 0 | — |
case-05 | pass→pass | 6,843 | 8,159 | +19% | 1 | 1 | 0% | 1,341 | 2,043 | +52% | 0 | 0 | — |
case-06 | fail→pass | 18,011 | 11,143 | -38% | 1 | 1 | 0% | 2,613 | 3,007 | +15% | 0 | 0 | — |
case-07 | fail→pass | 12,041 | 1,728 | -86% | 1 | 1 | 0% | 2,247 | 1,685 | -25% | 0 | 0 | — |
case-08 | pass→pass | 13,118 | 2,641 | -80% | 1 | 1 | 0% | 1,409 | 1,899 | +35% | 0 | 0 | — |
case-09 | pass→pass | 8,174 | 2,716 | -67% | 1 | 1 | 0% | 1,478 | 1,735 | +17% | 0 | 0 | — |
case-10 | fail→pass | 14,865 | 2,946 | -80% | 1 | 1 | 0% | 1,571 | 1,977 | +26% | 0 | 0 | — |
case-11 | pass→pass | 5,621 | 1,899 | -66% | 1 | 1 | 0% | 916 | 1,688 | +84% | 0 | 0 | — |
case-12 | pass→pass | 8,130 | 2,399 | -70% | 1 | 1 | 0% | 1,118 | 1,745 | +56% | 0 | 0 | — |
case-13 | pass→pass | 13,922 | 5,684 | -59% | 1 | 1 | 0% | 2,001 | 2,353 | +18% | 0 | 0 | — |
case-14 | pass→pass | 8,941 | 2,774 | -69% | 1 | 1 | 0% | 1,755 | 1,885 | +7% | 0 | 0 | — |
case-15 | pass→pass | 4,376 | 3,960 | -10% | 1 | 1 | 0% | 695 | 1,912 | +175% | 0 | 0 | — |
case-16 | fail→pass | 14,135 | 9,302 | -34% | 1 | 1 | 0% | 1,894 | 3,070 | +62% | 0 | 0 | — |
case-17 | pass→pass | 6,193 | 3,905 | -37% | 1 | 1 | 0% | 1,134 | 2,070 | +83% | 0 | 0 | — |
case-18 | pass→pass | 5,786 | 3,156 | -45% | 1 | 1 | 0% | 791 | 1,952 | +147% | 0 | 0 | — |
case-19 | pass→pass | 3,347 | 3,610 | +8% | 1 | 1 | 0% | 601 | 1,729 | +188% | 0 | 0 | — |
case-20 | pass→pass | 3,339 | 2,993 | -10% | 1 | 1 | 0% | 773 | 2,016 | +161% | 0 | 0 | — |
case-21 | pass→pass | 3,877 | 3,663 | -6% | 1 | 1 | 0% | 771 | 2,066 | +168% | 0 | 0 | — |
case-22 | pass→pass | 3,099 | 6,352 | +105% | 1 | 1 | 0% | 561 | 2,371 | +323% | 0 | 0 | — |
case-23 | pass→pass | 8,007 | 1,771 | -78% | 1 | 1 | 0% | 422 | 1,656 | +292% | 0 | 0 | — |
case-24 | pass→pass | 3,696 | 2,410 | -35% | 1 | 1 | 0% | 490 | 1,842 | +276% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 23 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +25 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.