Set up a meeting
AUTONOMOUS AI INFRASTRUCTURE

AI Agents Self-Replicate

Give your AI agent the power to provision its own infrastructure, spawn replicas, and manage compute resources autonomously. No human intervention required.

USE CASE

OpenClaw-Style Self-Replication

AI systems like OpenClaw can autonomously create new VMs and deploy copies of themselves. This enables true autonomous AI that can:

  • Spawn new instances when more compute is needed
  • Clone itself to new VMs with full codebase
  • Manage its own fleet of worker instances
  • Self-heal by detecting and replacing failed instances
self-replicate.sh
#!/bin/bash
# AI Agent Self-Replication Script
# Creates a new VM and deploys a copy of itself

REPLICA_NAME="agent-$(date +%s)"

# 1. Create new VM instance
dalang service create \
  --name "$REPLICA_NAME" \
  --cpu 2 --ram 2G --storage 20G \
  --image ubuntu:24.04 -y

# 2. Wait for VM to be ready
sleep 30

# 3. Deploy agent to new VM
dalang shell "$REPLICA_NAME" << 'EOF'
apt update && apt install -y python3 python3-pip git curl
curl -fsSL https://dalang.io/install.sh | bash
git clone https://github.com/your-org/your-agent.git /opt/agent
cd /opt/agent && pip3 install -r requirements.txt
nohup python3 main.py > /var/log/agent.log 2>&1 &
EOF

echo "Replica $REPLICA_NAME deployed successfully"

AI Agent Capabilities

Self-Replication

Create new VM, install dependencies, clone codebase, start agent process.

dalang service create ... && dalang shell ...

Horizontal Scaling

Spawn multiple worker instances in parallel based on workload.

for i in 1 2 3..10; do dalang create ... & done

Self-Healing

Monitor instance health, detect failures, automatically recreate.

dalang service info --json | jq '.status'

Resource Management

Check balance, manage credits, track resource usage programmatically.

dalang credit --json | jq '.balance'

Fleet Control

List, start, stop, delete VMs. Full lifecycle management.

dalang service list --json

No Human Needed

Use -y flag to skip all prompts. Fully autonomous.

dalang service create ... -y

Code Examples

Horizontal Scaling

horizontal-scale.sh
#!/bin/bash
# Horizontal Scaling: Create multiple agent instances

AGENT_COUNT=${1:-3}
BASE_NAME="worker"

for i in $(seq 1 $AGENT_COUNT); do
  dalang service create \
    --name "${BASE_NAME}-${i}" \
    --cpu 2 --ram 2G --storage 10G \
    -y &
done

wait
echo "Created $AGENT_COUNT worker instances"

# List all workers
dalang service list --json | jq '.[] | select(.name | startswith("worker"))'

Self-Healing Monitor

self-healing.sh
#!/bin/bash
# Self-Healing: Monitor and recreate failed instances

while true; do
  # Get all agent instances
  AGENTS=$(dalang service list --json | jq -r '.[] | select(.name | startswith("agent")) | .name')

  for AGENT in $AGENTS; do
    STATUS=$(dalang service info "$AGENT" --json | jq -r '.status')

    if [ "$STATUS" != "RUNNING" ]; then
      echo "Agent $AGENT is $STATUS, recreating..."
      dalang delete "$AGENT" -y
      dalang service create --name "$AGENT" --cpu 2 --ram 2G -y
    fi
  done

  sleep 60
done

Python Integration

agent_control.py
# Python: Programmatic infrastructure control
import subprocess
import json

def run_dalang(cmd):
    result = subprocess.run(
        f"dalang {cmd} --json",
        shell=True, capture_output=True, text=True
    )
    return json.loads(result.stdout) if result.stdout else None

# List all services
services = run_dalang("service list")
running = [s for s in services if s['status'] == 'RUNNING']

# Get specific VM info
vm = run_dalang("service info my-agent")
print(f"VM IP: {vm['public_ip']}")
print(f"Balance: {run_dalang('credit')['balance']}")

# Create new VM programmatically
import os
os.system("dalang service create --name new-agent --cpu 2 --ram 2G -y")

Why Dalang for AI Agents

1 Simple CLI Interface

Single binary, no complex SDKs. AI agents can execute bash commands directly. Works with any language that can run shell commands.

2 JSON Output

All commands support --json for machine-readable output. Easy parsing with jq, Python, or any language.

3 No Human Prompts

Use -y flag to skip all confirmations. Fully automated operation without human intervention.

4 Affordable Compute

Starting at Rp 30.000/month (~$2 USD). Cost-effective for spawning multiple instances. Pay only for what you use.

5 Direct Shell Access

dalang shell provides direct VM access. Install software, deploy code, run commands - all programmatically.

6 Persistent Auth

Authenticate once, operate forever. Credentials stored securely. No need to re-authenticate for each operation.

Teach Your AI Agent

Download the SKILL.md file and add it to your AI agent's context. It contains all commands, patterns, and best practices for autonomous operation.

Compatible with: Claude Code, Cursor, GitHub Copilot, OpenAI Assistants, Custom Agents

Ready to Build Autonomous AI?

Give your AI agent the infrastructure it needs to operate independently.