OpenClaw Advanced Guide: Multi-Agent Swarms That Actually Work

Turn one agent into a full AI team on your VPS

Last updated: April 2026 | Reading time: 11 minutes

OpenClaw already feels powerful after the Quick Tutorial - but the real game-changer is turning your single agent into a multi-agent swarm. Instead of one generalist doing everything, you get specialized agents that collaborate: a researcher, a coder, a flight booker, etc. They share memory, hand off tasks, and work together 24/7.

Table of Contents

1. What Are Multi-Agent Swarms?

OpenClaw lets you define multiple specialized agents that live inside the same workspace. They share MEMORY.md and SOUL.md, but each has its own personality, skills, and responsibilities. You can talk to the whole team or to one specific agent.

This is where OpenClaw goes from "helpful chatbot" to "actual digital team".

2. The Magic File: AGENTS.md

Everything is controlled from ~/.openclaw/workspace/AGENTS.md. Open it in any text editor (or the Web UI) and define your agents in simple Markdown.

💡 How to edit AGENTS.md

Run openclaw agents list to see current agents. Edit the file, save, then run openclaw gateway restart (or just wait 10 seconds - it auto-reloads).

3. Building Your First Swarm (Research + Coding + Personal Assistant)

Here's a complete ready-to-paste example for AGENTS.md (using Venice.ai models):

# OpenClaw Multi-Agent Swarm

## Research Agent
- Name: research
- Role: Deep researcher and fact-checker
- Model: venice/claude-4.6-sonnet
- Skills: browser, web_search, summarize
- Instructions: You are a meticulous researcher. Always cite sources. Never hallucinate.

## Coding Agent
- Name: coder
- Role: Senior software engineer
- Model: venice/claude-4.6-opus
- Skills: github, shell, file_editor
- Instructions: You write clean, well-commented code. You can push to GitHub and review PRs.

## Personal Assistant
- Name: pa
- Role: Executive personal assistant
- Model: venice/claude-4.6-sonnet
- Skills: gog, calendar, todoist
- Instructions: You handle my daily life. Be proactive, friendly, and concise.

After saving, talk to them like this in Telegram/Web UI:

4. Real-World Working Examples

Flight Booker Agent

## Flight Booker
- Name: flights
- Role: Travel agent that books flights
- Model: venice/claude-4.6-sonnet
- Skills: browser, gog, calendar
- Instructions: Search flights on Google Flights or Kayak, summarize best options, and book when I say "book it". Always confirm dates and passengers first.

Usage: "@flights Find me the cheapest flight from SFO to Tokyo next month"

Code Review Agent

## Code Reviewer
- Name: reviewer
- Role: Brutally honest senior code reviewer
- Model: venice/claude-4.6-opus
- Skills: github, shell
- Instructions: Review any PR or code file I give you. Point out security issues, performance problems, and style violations. Suggest fixes.

Usage: "@reviewer review my latest PR on GitHub"

Calendar Manager Agent

## Calendar Manager
- Name: calendar
- Role: Calendar & meeting guardian
- Model: venice/claude-4.6-sonnet
- Skills: gog, email, todoist
- Instructions: Keep my calendar clean. Block focus time, remind me 30 min before meetings, and auto-decline conflicting invites.

Usage: "@calendar block 2 hours every morning for deep work"

5. 🤖 GOG as Your Personal Assistant (No Subagent Needed!)

Important: You don't need a separate PA agent. The GOG (Google on Go) skill is your personal assistant directly.

The GOG skill provides native access to everything Google Workspace. Instead of setting up a custom Gmail agent and a separate PA agent, you can just use GOG directly for your personal assistant functions:

🤖 GOG Handles Everything Your PA Would Do

Just ask naturally:

Why GOG Is Better Than Separate Agents

VPS Setup Guide (Headless Mode)

The GOG CLI works great on VPS headless environments using the --remote two-step auth flow:

Step 1: Install GOG CLI

git clone https://github.com/steipete/gogcli.git
cd gogcli
make
sudo cp bin/gog /usr/local/bin/gog

Step 2: Create Google OAuth Client

  1. Create Google Cloud project (https://console.cloud.google.com/)
  2. Enable OAuth Consent Screen (choose "External" for personal use)
  3. Download client_secret.json
  4. Upload to VPS: cp client_secret.json ~/.openclaw/workspace/secrets/

Step 3: Load Credentials

gog auth credentials /path/to/client_secret.json

Step 4: Authenticate (Two-Step Remote Flow)

export GOG_ACCOUNT=your@gmail.com
export GOG_KEYRING_BACKEND=file
export GOG_KEYRING_PASSWORD=your-password

# Step 1: Generate auth URL
gog auth add your@gmail.com --services gmail,calendar --remote --step 1

Copy the displayed URL, open in your browser, authorize, and copy the redirect URL. Then run:

# Step 2: Exchange code for tokens
gog auth add your@gmail.com --services gmail,calendar --remote --step 2 --auth-url ""

Step 5: Test It Works

gog auth list
gog gmail search "newer_than:7d" --max 10
gog calendar events primary --from "$(date -I)"

💡 Pro Tip: VPS Environment Variables

For headless VPS, set these in ~/.bashrc so they persist:

export PATH="$HOME/.local/bin:$PATH"  # if gog is installed locally
export GOG_ACCOUNT=your@gmail.com
export GOG_KEYRING_BACKEND=file
export GOG_KEYRING_PASSWORD=your-password

🔒 Security Note: OAuth Client Secrets

Google OAuth requires a client_secret.json file. This file acts as your OAuth credentials and MUST be stored securely:

To generate new credentials:

  1. Google Cloud Console → Create new OAuth client
  2. Download client_secret.json
  3. Copy to VPS: scp client_secret.json account@your-vps:~/.openclaw/workspace/secrets/gog-credentials.json
  4. Update service: systemctl --user restart openclaw-gateway

⚠️ CRITICAL: OpenClaw Gateway systemd Service

The OpenClaw gateway runs as a systemd user service. Environment variables for the gateway are loaded from ~/.config/systemd/user/openclaw-gateway.service, not from .env files!

If you change GOG_KEYRING_PASSWORD, you MUST update the systemd service file on your VPS:

  1. Check the service: cat ~/.config/systemd/user/openclaw-gateway.service
  2. Edit the file: nano ~/.config/systemd/user/openclaw-gateway.service
  3. Update the Environment=GOG_KEYRING_PASSWORD=your-password line
  4. Reload systemd: systemctl --user daemon-reload
  5. Restart gateway: systemctl --user restart openclaw-gateway

We experienced a case where the gateway kept using the old password from this file, even after updating .env files and openclaw.json!

6. Pro Tips & Advanced Tricks

🎯 Pro Swarm Tip

Start small (3 agents max). Once they work well together, add more. The more specific the role and instructions, the better they perform.

7. Quick Troubleshooting

ProblemFix
Agent not respondingRun openclaw agents list and check spelling of name
Changes not taking effectSave AGENTS.md then openclaw gateway restart
Agents fighting / repeatingMake instructions more specific in AGENTS.md
Memory getting too bigRun /compact or edit MEMORY.md manually
GOG keyring errorsEnsure GOG_KEYRING_BACKEND=file and password are set in same environment
GOG token expiresRun gog auth list --check and re-auth if needed
Cannot find gogEnsure gog binary is in $PATH used by OpenClaw
OAuth fails on VPSUse --remote --step 1 then --step 2 with redirect URL

🎯 Final Pro Tip for VPS Users

Edit AGENTS.md in the Web UI (via SSH tunnel) for the smoothest experience. Your swarm will keep running even if you close the browser.

You now have a real AI team living on your VPS. Start simple, iterate, and watch it take over more and more of your workload.

Ready to build your swarm?

Drop your favorite agent setup or swarm idea in the comments below - I'll feature the best ones in a follow-up post!

← Read the Quick Tutorial First Browse All Blog Posts →

💬 Comments

Email is required for anti-spam but can be fake if you prefer privacy.

Loading comments...
// Initialize engagement if (typeof EngagementSystem !== 'undefined') { EngagementSystem.initLikeButton('#like-container', 'blog', 'openclaw-multi-agent-swarms'); EngagementSystem.initSubscribeForm('#subscribe-container', { title: '📧 Subscribe for Blog Updates', description: 'Get notified when new articles are published.' }); }