Skip to main content

kubectl for AI Agents: What Klaw.sh Reveals About the Layer Between CrewAI and Kubernetes

8 min readDora NodaDora Noda
Share
On this page

Somewhere around agent number 14, spread across 6 different accounts, the founder of each::labs stopped being able to answer a simple question: which agent posted that? Not which agent should have posted it, or which agent's code was responsible — which one, out of a dozen-plus autonomous processes running marketing and lead-gen tasks across separate X accounts, actually fired last. OpenClaw handled a single agent fine. It had nothing to say about a fleet.

The tool that came out of that problem, klaw.sh, isn't a smarter agent framework. It's get, describe, logs, and apply — Kubernetes' operational verbs, rebuilt from scratch for agents instead of pods. That choice is more interesting than it looks, because it implies a layer nobody had named: not "how do agents reason" (CrewAI's job) and not "where does the process run" (Kubernetes' job), but "how do you operate dozens of them without losing track." This piece works through what that layer actually contains, and lands a specific verdict on the question that matters for a platform like Bex, which already runs Cluster API under every tenant workload: should agent-fleet operations be a feature the control plane absorbs, or a separate product a deploy platform has no business building?


What klaw.sh actually is

The headline number is the binary: klaw ships as a single ~20MB Go executable, curl | sh install, no Python runtime and no Docker daemon required. That's not an incidental packaging choice — the Show HN thread has the founder explaining the project started in Node.js, where each running agent carried an 800MB+ footprint (a full Node runtime plus dependency tree per process), and the Go rewrite brought that under 10MB per agent. At 14+ agents, that difference is the gap between "runs on a laptop" and "needs its own fleet of VMs just to host the runtimes."

Underneath the binary, klaw's architecture borrows Kubernetes' nouns directly:

  • Namespaces — one per team (sales, support, research), each with its own scoped secrets, tool permissions, and agents. Sales can't read support's Hubspot key because it's never in sales' namespace.
  • A scheduler — built-in cron (klaw cron create), so recurring agent runs don't need an external Airflow or systemd timer.
  • Channels — Slack, CLI, HTTP, and a TUI all reach the same control plane; you can @klaw an agent from Slack or klaw dispatch it from a terminal.
  • A model router — 300+ LLMs (Claude, GPT-4, Gemini, Llama, and others) behind one interface, so swapping the model behind an agent doesn't mean rewriting the agent.

And the CLI reads like kubectl with the nouns swapped:

kubectlklaw
kubectl get podsklaw get agents
kubectl describe podklaw describe agent <name>
kubectl logs -fklaw logs <agent> -f
kubectl apply -fklaw apply -f agent.toml
kubectl config use-contextklaw config use-context <namespace>
(no equivalent)klaw cron create

Deployment scales from klaw chat (single-node, interactive) up to a distributed mode where worker nodes klaw node join controller.internal:9090 and the controller dispatches tasks across them — again, the Kubernetes controller/node-pool shape, minus the container runtime underneath.


The layer it occupies

Here's the distinction that matters, and it's the founder's own framing from the Show HN thread, not a stretch on top of it: "Those are frameworks for building agents. klaw is infrastructure for operating them."

Three layers, in order of altitude:

  1. Agent frameworks — CrewAI, LangGraph, AutoGen. These answer "how does an agent think, and how do several of them collaborate on one task." A LangGraph state machine or a CrewAI crew is a reasoning topology: which agent hands off to which, what the retry logic looks like, how a tool call's result gets routed back into the next step.
  2. Agent-fleet operations — klaw.sh. This answers a completely different question: "I have thirty agents, built by three different teams possibly on three different frameworks, running continuously — who can see whose secrets, what did agent #17 do at 3am, and how do I restart the one that's stuck." It's framework-agnostic by design; klaw doesn't care whether the agent inside its process was built with CrewAI, LangGraph, or a raw script, any more than Kubernetes cares whether your container runs a Django app or a Go binary.
  3. Infra orchestration — Kubernetes, Cluster API. This answers "where does the process physically execute, how does it get scheduled onto a machine, how does that machine get provisioned in the first place." Klaw explicitly sits above this, not on top of it — it doesn't require a Kubernetes cluster at all; it borrows Kubernetes' mental model (namespaces, declarative apply, kubectl-style verbs) while running its own lightweight control plane on bare processes or Podman containers.

That middle layer is the actual find here. It's easy to assume "agent orchestration" is a solved problem because CrewAI and Kubernetes both already exist and both use the word "orchestration." Klaw's existence is evidence that the space between them — fleet-wide identity, secrets scoping, cron, and log aggregation for agents specifically — wasn't covered by either, and enough people hit the same 14-agents-6-accounts wall that a standalone tool for it found an audience.


The verdict: what this means for a platform that already runs Cluster API

Bex already runs Cluster API underneath every tenant's deployed service — CAPI manages the actual machines, and every git-pushed app already gets a namespace, scoped secrets, and a log stream through the existing control plane. So the question isn't abstract: an AI agent that deploys and rolls back a tenant's app is, mechanically, just another workload with a namespace and logs. Does that mean bex should absorb klaw's whole layer?

Two pieces of evidence point in different directions, and they resolve to a specific split rather than a shrug.

The first piece is klaw's own isolation model, and it's weaker than the Kubernetes framing suggests. By default, klaw's non-containerized agents run as ordinary processes under your user account — no filesystem sandboxing; an agent can read any file you can. Real process isolation only shows up if you opt into klaw run with Podman. Bex's tenant isolation is not optional in the same way — every workload already runs inside the isolation boundary Cluster API provides, because that's the substrate every deployed service uses, agent or not. That's a real argument for absorption: if an AI deploy-agent is going to run somewhere, "somewhere bex's control plane already isolates by default" beats "somewhere that needs an extra containerization step to not read your whole home directory."

The second piece is klaw's actual value-add, and it's mostly orthogonal to deployment infrastructure. The cron scheduler, the Slack/CLI/HTTP channel routing, and the 300+-model LLM router are agent-specific concerns that have nothing to do with where a container runs — they're about how a human or another system talks to an agent, and how that agent gets rescheduled. A git-push PaaS has no comparative advantage building a Slack bot or a model router; those are klaw's actual product, and duplicating them inside a deploy platform's control plane would be scope creep with no infra synergy to justify it. Worth noting too: klaw itself is source-available, not open source — free for internal use, but licensed separately for multi-tenant SaaS or white-label resale. That's a real constraint on depending on klaw directly inside a hosted product, and it's one more reason the two concerns are better kept separate rather than folded together by adopting klaw's code wholesale.

So the split is specific, not "it depends": expose the AI agent's deployment identity as a first-class workload type — its own namespace, its own scoped secrets, its own log stream, reusing the Cluster API primitives that already exist for every other tenant workload. That's a small, coherent addition consistent with what bex already models. Don't build klaw's fleet-ops surface — the scheduler, the Slack channel, the model router — inside the control plane. That's a distinct product a tool like klaw already does well, and it should be consumed the way any external tool integrates with a deploy target: an agent (built with CrewAI, LangGraph, klaw, or nothing at all) calls bex's API to push and roll back a service, the same door every human operator uses.


The takeaway

Klaw.sh's real contribution isn't a better agent — it's evidence that "agent-fleet operations" is a distinct layer, thin enough to fit in a 20MB binary, sitting between the reasoning frameworks and the infra orchestrators everyone already has names for. For a platform that already runs Cluster API, the right move isn't to build that whole layer or to ignore it — it's to make sure an AI agent gets treated as a first-class workload with real isolation by default, and to leave the fleet-ops product (scheduling, channels, model routing) to the tools built for exactly that job.

Bex.co is the open-source, AI-native Render alternative — push a git repo, get a running HTTPS service on machines you own, with AI agents as first-class operators instead of a human-shaped API they borrow credentials to reach. Star the repo on GitHub and see what it looks like when an agent's deployment identity is a workload type, not an afterthought.

Related articles

Give your agents a chain backend

Autonomous agents hit RPC endpoints very differently than people do. See what bex router handles on their behalf.

Read the agents guide