Skip to main content

Overview

klaw supports distributed deployment where a central controller manages multiple worker nodes. This architecture enables:
  • Horizontal scaling - Add more nodes as workload increases
  • Fault tolerance - Nodes can fail without losing the system
  • Resource isolation - Different agents on different machines
  • Geographic distribution - Deploy nodes closer to users

Architecture

Setting Up the Controller

Start the Controller

On your central server:
With authentication token:
Full options:

Controller Output

Check Controller Status

Setting Up Worker Nodes

Join a Controller

On each worker machine:
With a name:

Node Registration

When a node joins, it:
  1. Authenticates with the controller
  2. Registers its available agents
  3. Starts heartbeat (every 30 seconds)
  4. Waits for task dispatch

Check Node Status

Managing the Cluster

List Nodes

Output:

Describe a Node

Output:

Dispatching Tasks

Send a Task to the Cluster

The controller:
  1. Finds a node with the coder agent
  2. Dispatches the task to that node
  3. Streams results back

View Tasks

Output:

Task Output

Creating Agents on Nodes

Define Agents Locally

On each node, create agents:

Register Agents with Controller

When a node joins, it automatically registers its agents:
Or manually register:

Namespaces in Distributed Mode

Create Cluster and Namespaces

Bind Agents to Namespaces

Dispatch to Namespace

High Availability

Multiple Controllers (Future)

For production deployments, run multiple controllers with shared state:

Node Auto-Recovery

Nodes automatically reconnect if the controller restarts:

Container Deployment

Run Nodes in Containers

Kubernetes Deployment

Monitoring

Cluster Metrics

Output:

View Logs

Security Considerations

Always set --token for production deployments:
  • Use TLS for controller-node communication
  • Restrict network access with firewalls
  • Use private networks when possible
  • Store API keys in environment variables
  • Use secrets management (Vault, K8s secrets)
  • Rotate keys regularly

Troubleshooting

  1. Verify controller is running: klaw controller status
  2. Check network connectivity: nc -zv controller-host 9090
  3. Verify token matches
  4. Check firewall rules
  1. Check if node has the required agent
  2. Verify node is in Ready state
  3. Check controller logs for errors
  1. Check network stability
  2. Increase heartbeat timeout
  3. Check node resource usage

Next Steps

Namespaces & Clusters

Learn about multi-tenancy

CLI Reference

Complete controller commands