klaw

kubectl for AI Agents — manage, schedule, and scale your AI workforce with a single binary that deploys in seconds.

632stars
40forks
Apache License 2.0
Go

klaw brings Kubernetes-style operational patterns to AI agent management. Just as kubectl gave developers a unified interface to interact with Kubernetes workloads, klaw gives teams a familiar command-line interface for deploying, monitoring, scheduling, and scaling AI agents across their organization — all from a single self-contained Go binary.

At its core, klaw introduces namespaces for agent isolation, allowing sales agents, support agents, and research agents to run with scoped permissions and separate secret stores, preventing cross-contamination between teams. Agents are defined with their own model choice, skill sets, and tool access, then managed with the same get, describe, logs, create, and delete commands engineers already know from Kubernetes.

Beyond the CLI, klaw integrates directly with Slack as a control plane — teams can trigger agent runs, check status, view logs, and ask agents questions directly from Slack channels without ever touching a terminal. The built-in cron scheduler handles recurring agent tasks, eliminating the need for external job schedulers or Lambda functions.

For larger deployments, klaw supports distributed mode with a controller/node architecture. A central controller node receives and dispatches tasks while worker nodes handle execution, enabling horizontal scaling of AI agent workloads across multiple machines using gRPC for communication.

What You Get

  • kubectl-style CLI with get, describe, logs, create, and delete commands for managing AI agents
  • Namespace isolation that scopes agent permissions, secrets, and tool access per team or department
  • Built-in cron scheduler (klaw cron create) for recurring agent tasks without external dependencies
  • Slack control plane letting teams trigger agents, check status, and query agents directly from chat
  • Distributed controller/node architecture for scaling agent execution across multiple machines
  • Multi-provider support for Anthropic, OpenAI, OpenRouter, each::labs, and any OpenAI-compatible API
  • Installable skill system providing agents with web-search, browser, git, docker, database, and Slack capabilities
  • Interactive TUI terminal chat with streaming responses and tool-call visualization

Common Use Cases

  • Running scheduled sales lead scoring agents that pull from CRM systems and update scores hourly via cron
  • Deploying competitor intelligence agents that monitor pricing pages daily and post diffs to Slack channels
  • Managing support ticket automation agents that respond to Zendesk tickets and escalate based on content
  • Orchestrating multi-team AI workforces where different departments share infrastructure but maintain isolated secret stores
  • Building analytics automation that queries databases weekly, generates reports, and distributes them via Slack
  • Setting up developer productivity agents with git, bash, and code execution skills for repository automation

Under The Hood

Architecture klaw follows a layered architecture that mirrors Kubernetes conceptually: a control plane (the orchestrator package) sits above a runtime layer (agent, session, memory), which in turn calls a provider abstraction (provider.Provider interface) and dispatches to a tool registry. Namespaces and clusters are pure data abstractions stored as JSON on disk, scoping agent bindings and channel configurations. The distributed mode adds a gRPC-based controller/node layer where a central controller accepts tasks and dispatches them to worker nodes — the same agent runtime runs on workers, keeping the execution model uniform whether running single-node or distributed. This separation of routing, execution, and I/O means channels (Slack, CLI, TUI) are interchangeable inputs, and providers are swappable without changing agent logic.

Tech Stack klaw is written entirely in Go 1.24 and compiles to a single static binary. The CLI layer uses Cobra for command routing. The interactive terminal UI leverages the Charmbracelet stack (Bubbletea, Bubbles, Lipgloss) for styled streaming output. LLM integration uses the official Anthropic SDK alongside an OpenAI-compatible client that covers OpenRouter, Ollama, LM Studio, vLLM, and Together AI. Distributed communication uses gRPC over protobuf. Slack integration is via slack-go. Configuration is TOML-based stored at ~/.klaw/config.toml. There is no database dependency — agent definitions, namespaces, and installed skills are persisted as JSON files in the klaw config directory.

Code Quality klaw maintains a solid test suite covering the agent loop, orchestrator routing logic, tool registry, provider resilience, context management, and session persistence. Tests use Go’s native testing package with table-driven patterns and stub implementations rather than heavy mocking frameworks. Error handling throughout the codebase uses typed errors (AgentError with structured codes like ErrMaxIterations, ErrProvider, ErrToolExec) that implement errors.Is and errors.Unwrap for proper Go error chain compatibility. The codebase does not have CI workflows configured, and the linter relies on golangci-lint invoked manually via Makefile. Code comments are present at the package and type level, with inline comments marking TODO items and design decisions.

What Makes It Unique klaw’s most distinctive design decision is treating AI agents as first-class Kubernetes-style workloads: namespaces with scoped secrets, a routing orchestrator that supports @agent, @all, keyword rules, and AI-based routing in a single configurable mode, and a Slack channel that doubles as a full control plane rather than just a notification sink. The parallel tool execution in the agent loop — where multiple tool calls from a single LLM response run concurrently via goroutines — reduces latency for agents that need to fan out across multiple data sources. The installable skill system lets agents compose capabilities declaratively, and the provider resilience layer adds retry-with-exponential-backoff and fallback-to-alternative-provider behavior transparently, making agent runs more robust against transient API failures.

Self-Hosting

klaw is released under a modified Apache License 2.0 with an additional restriction: you cannot use the klaw source code to operate a multi-tenant managed service where AI agent orchestration is the primary value proposition, without explicit written authorization from each::labs. Internal organizational use, building your own agents and applications, consulting services, and creating plugins or integrations are all explicitly permitted without additional authorization. This means most self-hosting scenarios — running klaw for your own team or company — fall comfortably within the free license, while building a competing SaaS product on top of klaw’s source would require a commercial agreement.

Running klaw yourself is operationally straightforward for small to medium deployments. In single-node mode, the entire platform — Slack bot, scheduler, and agent runtime — runs as a single klaw start process with no external database, message queue, or orchestration layer required; agent state and configuration are stored as JSON files in ~/.klaw. For distributed mode, you manage a controller process and one or more worker nodes that communicate over gRPC, which introduces network configuration and service availability concerns that you own entirely. There is no built-in high availability for the controller, no managed backups of agent history or session data, and upgrades are manual (klaw upgrade via the install script). Teams running hundreds of agents in production will need to invest in infrastructure management, process supervision, and log aggregation that a managed platform would otherwise provide.

Compared to a hosted AI agent platform, self-hosting klaw trades operational simplicity for full control and no per-seat or per-execution pricing. You gain complete data sovereignty — agent conversations, tool outputs, and API keys never leave your infrastructure. What you give up is managed uptime, automatic scaling, a web dashboard, built-in audit logging, role-based access control beyond namespace scoping, and professional support SLAs. The each::labs enterprise license tier adds multi-tenant SaaS deployment rights, white-label licensing, priority support, and custom feature development for organizations that need those guarantees.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search