Kubernetes infrastructure operations powered by Codex CLI, native operational CLIs, and Skills.
Agentic Infra does not implement another agent framework or wrap every command in a remote MCP tool. Codex is the agent runtime: it interprets intent, reads skills, plans work, invokes commands, and summarizes evidence.
- Codex is the only agent: the backend runs
codex exec --jsonwith event streaming and session resume. - CLIs are the execution surface: use
kubectl,helm,argocd,git,ssh,curl, and skill scripts. - Skills are the capability layer: SKILL.md stores workflows and judgment,
scripts/stores deterministic operations, andreferences/is loaded on demand. - Change control is enforced at the runtime boundary:
planpermits non-mutating work;applyrequires explicitapproved=true, scoped to the exact request. - MCP is legacy-only: the old implementation lives under
legacy/and is absent from default dependencies, images, and startup.
Portal / API Client
│ SSE / JSON
▼
FastAPI Runtime ── SkillRegistry
│ │
│ └─ skills/*/SKILL.md
▼
codex exec --json
│
├─ kubectl / helm / argocd
├─ git / ssh / curl
└─ skills/*/scripts/*
infra-deploy-guide: ArgoCD, VictoriaMetrics, VictoriaLogs, and kube-prometheus-stackk3s-ops: K3s installation, expansion, upgrades, backup, restore, and maintenancek8s-diagnostic: Pod, node, scheduling, resource-pressure, and probe diagnosticsmonitoring-ops: PromQL, alerts, health checks, and capacity planninglogging-ops: kubectl logs, LogsQL, VictoriaLogs, and collectorsmiddleware-ops: Helm operations for Redis, MySQL, Kafka, and PostgreSQL
Each turn selects at most MAX_MATCHED_SKILLS skills. Codex reads each matching SKILL.md completely, then loads references or runs scripts only when needed.
Prerequisites: Python 3.12+, Codex CLI, and the task-specific CLIs such as kubectl, Helm, Argo CD CLI, or ssh.
cp .env.example .env
uv sync --extra dev
codex login
uv run agentic-infraEndpoints:
- Portal:
http://localhost:3000 - API docs:
http://localhost:8000/docs - Health:
http://localhost:8000/health
Start the portal:
cd portal
npm install
npm run devNon-mutating planning or diagnosis:
curl -N http://localhost:8000/api/runs \
-H 'Content-Type: application/json' \
-d '{"message":"Check the current cluster for unhealthy Pods","stream":true}'SSE responses include a thread.started event with session_id. Send that value on a later request to resume the Codex session.
Mutations require explicit approval:
curl -N http://localhost:8000/api/runs \
-H 'Content-Type: application/json' \
-d '{
"message":"Apply the reviewed vm-stack upgrade in the monitoring namespace",
"mode":"apply",
"approved":true,
"stream":true
}'Apply requests without approved=true return HTTP 409. Plan uses a workspace-write sandbox by default because kubectl-style CLIs require network access; runtime instructions prohibit mutations. Set CODEX_PLAN_SANDBOX=read-only for strict offline filesystem planning. The runtime preserves the user's Codex authentication and provider configuration; this project registers no MCP servers and explicitly directs Codex to native CLIs.
The Portal cluster initialization wizard follows the same two-stage flow. It first generates the target context, diff evidence, execution steps, and rollback path in plan mode. Only after the user reviews the output and checks the explicit approval control does it resume that plan's session_id in apply mode. Any configuration change invalidates the old plan and approval.
skills/my-skill/
├── SKILL.md
├── scripts/ # optional deterministic, repeated, or fragile operations
└── references/ # optional thresholds, configuration, and detailed guidance
SKILL.md frontmatter contains only:
---
name: my-skill
description: Describe the capability and the user requests that should trigger it.
---Call POST /api/skills/reload after adding a skill; no service restart is needed.
cd deploy
docker compose up --buildThe runtime image installs and verifies Codex, kubectl, Helm, and Argo CD CLI. Compose mounts the workspace, ~/.codex, ~/.kube, and read-only ~/.ssh. Production deployments should use a dedicated service account, least-privilege RBAC, dedicated Codex credentials, and a controlled workspace instead of personal directories.
uv run ruff check .
uv run pytest
cd portal && npm run typecheck && npm run buildThe Agno runtime has been removed. Previous MCP servers and configuration moved to legacy/ for migration reference only and are not supported by the default test or deployment path.