TutorialOpenClawMarch 5, 2026·10 min read

openclaw agents add: The Complete Command Guide

Everything you need to know about the openclaw agents add command — from full flag syntax to step-by-step agent registration, troubleshooting every common error, and scripting batch setups.

What openclaw agents add Actually Does

When most people think about openclaw agents add, they think it "creates" an agent. That is close but not quite right. The command registers an agent with OpenClaw — it tells the gateway where to find an existing agent workspace so it can route messages to it.

Specifically, the command writes an entry into OpenClaw's agent registry (a JSON file in your project or home directory). It records three things: the agent name, the absolute path to the workspace directory containing the SOUL.md file, and the configured model provider. The next time you run openclaw gateway start or openclaw gateway restart, the gateway reads this registry and initializes a session handler for every registered agent.

What happens when you run agents add
$ openclaw agents add seo-analyst --workspace ./agents/seo-analyst

# Behind the scenes:
# 1. Validates workspace path exists
# 2. Checks for SOUL.md in the workspace
# 3. Writes to ~/.openclaw/registry.json:
#    { "name": "seo-analyst", "workspace": "/abs/path/agents/seo-analyst", ... }
# 4. Confirms: "Agent 'seo-analyst' registered successfully"

# You still need to restart the gateway:
$ openclaw gateway restart

This separation between registration and activation is important. You can register ten agents at once and then start the gateway once — all agents will be available immediately. If you are looking for the full list of CLI commands, see our OpenClaw CLI reference.

Full Command Syntax and Flags

The openclaw agents add command accepts the following syntax and flags:

Command syntax
openclaw agents add <agent-name> [options]

Arguments:
  agent-name            Required. Unique name for the agent.
                        Use lowercase letters and hyphens only.
                        Examples: seo-analyst, content-writer, data-reporter

Options:
  --workspace <path>    Path to the agent's workspace directory.
                        Must contain a valid SOUL.md file.
                        Can be relative or absolute.
                        Default: ./agents/<agent-name>

  --model <provider>    Model provider for this agent.
                        Accepted values: anthropic, openai, google, ollama
                        Default: inherits workspace-level default

  --non-interactive     Skip all confirmation prompts.
                        Required when adding agents in scripts.

  --channel <channel>   Bind agent to a specific communication channel
                        (e.g., a Telegram chat ID or Slack channel name).

  --help                Show help for this command.
Usage examples
# Minimal usage — workspace defaults to ./agents/seo-analyst
openclaw agents add seo-analyst

# Explicit workspace path
openclaw agents add seo-analyst --workspace ./agents/seo-analyst

# Specify model provider
openclaw agents add researcher --workspace ./agents/researcher --model ollama

# Skip confirmation prompts (for scripts)
openclaw agents add pm --workspace ./agents/pm --non-interactive

# Bind to a Telegram channel
openclaw agents add support-bot --workspace ./agents/support --channel 8267922725

# Full example with all common flags
openclaw agents add content-writer   --workspace ./agents/content-writer   --model anthropic   --non-interactive

Step-by-Step: From Zero to Registered Agent

Here is the complete sequence for adding a new agent to an existing OpenClaw workspace. Follow these steps in order and your agent will be running in under five minutes.

Step 1 — Create the workspace directory

Terminal
mkdir -p agents/seo-analyst

The agent name in the directory should match the name you will use in the agents add command. This keeps your workspace readable when you have many agents.

Step 2 — Write the SOUL.md file

SOUL.md is the only required file in the workspace. It defines the agent's identity, personality, and rules. Create it at agents/seo-analyst/SOUL.md:

agents/seo-analyst/SOUL.md
# SEOAnalyst

## Role
You are an SEO analyst. You research keywords, audit content,
and provide actionable recommendations to improve organic rankings
for SaaS products and developer tools.

## Personality
- Analytical, precise, data-driven
- Back every recommendation with a reason
- Never guess — if you do not know, say so

## Rules
- ALWAYS respond in English
- ALWAYS provide search volume context for keyword recommendations
- NEVER suggest tactics that violate Google Webmaster Guidelines
- Keep responses scannable: use bullet points and headers
- Limit to 3 priority recommendations per audit

## Expertise
- Technical SEO: Core Web Vitals, structured data, crawlability
- Content SEO: keyword mapping, topical authority, content gaps
- Competitive analysis: SERP feature opportunities, competitor weaknesses

## Tools — USE THEM
- Use Browser to check current SERPs before making recommendations
- Use Slack to share audit reports with the team

## Handoffs
- Pass keyword research to @ContentWriter when brief is ready
- Escalate technical issues to @DevOps

Specific rules produce consistent agents. Vague SOUL.md files produce inconsistent responses. For more examples, see our SOUL.md templates guide.

Step 3 — Run openclaw agents add

Terminal
openclaw agents add seo-analyst --workspace ./agents/seo-analyst --non-interactive

# Expected output:
# Validating workspace... OK
# SOUL.md found... OK
# Registering agent 'seo-analyst'... OK
# Agent 'seo-analyst' registered successfully.
# Run 'openclaw gateway restart' to activate.

Step 4 — Verify registration

Terminal
openclaw agents list

# Output:
# NAME            WORKSPACE                          STATUS
# content-writer  /home/user/project/agents/content  registered
# seo-analyst     /home/user/project/agents/seo-ana  registered

Step 5 — Restart the gateway

Terminal
openclaw gateway restart

# Test the new agent
openclaw agent --agent seo-analyst --message "Analyze the keyword 'openclaw agents add'"

# Expected: Agent responds with keyword analysis

SOUL.md Structure That Works With agents add

The openclaw agents add command only validates that a SOUL.md exists — it does not parse its content. But what you write inside SOUL.md determines whether the agent behaves consistently once registered. Here are the sections that matter most:

## Role

One paragraph defining what the agent does. This is the first thing the model sees in every conversation. Be specific about domain and output type.

You are an SEO analyst specializing in technical audits and keyword research for developer tools.

## Rules

Hard constraints using ALWAYS and NEVER. These override model defaults. Keep to 5-10 rules maximum — too many dilute effectiveness.

ALWAYS respond in English. NEVER recommend black-hat tactics. ALWAYS cite sources.

## Tools — USE THEM

List tools the agent has access to and when to use each. The 'USE THEM' in the header is intentional — it signals to the model that tool use is expected, not optional.

Use Browser to verify SERP data before advising.

## Handoffs

Which other registered agents this agent can delegate to. Use @AgentName format. Only works when those agents are also registered and the gateway is running.

Pass keyword briefs to @ContentWriter. Escalate tech issues to @DevOps.

After editing SOUL.md, you must run openclaw gateway restart for changes to take effect. The gateway reads SOUL.md at startup, not on every message.

Adding Multiple Agents: Batch Registration

When building a multi-agent team, you will run agents add multiple times. The --non-interactive flag makes this scriptable. Here is a shell script that sets up a complete content team:

setup-agents.sh
#!/bin/bash
set -e

AGENTS=(
  "pm"
  "content-writer"
  "seo-analyst"
  "researcher"
  "social-media"
)

echo "Creating workspace directories..."
for agent in "${AGENTS[@]}"; do
  mkdir -p "agents/$agent"
  echo "Created agents/$agent/"
done

echo ""
echo "Registering agents..."
for agent in "${AGENTS[@]}"; do
  openclaw agents add "$agent" \
    --workspace "./agents/$agent" \
    --non-interactive
  echo "Registered: $agent"
done

echo ""
echo "All agents registered. Restarting gateway..."
openclaw gateway restart

echo ""
echo "Done. Verify with: openclaw agents list"
Terminal — Run the script
chmod +x setup-agents.sh
./setup-agents.sh

# Then check the result
openclaw agents list

The script creates directories, registers all agents, and restarts the gateway in one step. You still need to write SOUL.md for each agent before running it — the script does not create SOUL.md files automatically.

Removing Agents and Re-Registering

Removing a registered agent with openclaw agents remove deletes the registry entry but leaves workspace files intact. Your SOUL.md, MEMORY.md, and any other files remain on disk. Use remove when you need to rename an agent, move its workspace, or permanently retire it.

Terminal
# Remove an agent from the registry (does NOT delete files)
openclaw agents remove seo-analyst

# Confirm it is gone
openclaw agents list

# Re-register with a new name or path
openclaw agents add seo-expert   --workspace ./agents/seo-analyst   --non-interactive

# Restart to apply changes
openclaw gateway restart

If you want to permanently delete an agent, remove the registry entry first, then delete the workspace directory:

Terminal — Permanently delete an agent
# Step 1: Remove from registry
openclaw agents remove old-agent

# Step 2: Delete workspace files
rm -rf agents/old-agent

# Step 3: Restart gateway
openclaw gateway restart

Common Errors and Exact Fixes

These are the errors you will encounter most often with openclaw agents add, with the exact commands to fix each one.

Error: "Agent name already registered"

An agent with this name already exists in the registry. You cannot have two agents with the same name.

# Remove the existing registration first
openclaw agents remove seo-analyst

# Then re-add with the correct path
openclaw agents add seo-analyst   --workspace ./agents/seo-analyst   --non-interactive

Error: "Workspace path does not exist"

The path you passed to --workspace does not exist on disk.

# Create the directory first
mkdir -p agents/seo-analyst

# Then add the agent
openclaw agents add seo-analyst   --workspace ./agents/seo-analyst   --non-interactive

Error: "SOUL.md not found in workspace"

The workspace directory exists but does not contain a SOUL.md file. This is the most common error for new users.

# Create a minimal SOUL.md
cat > agents/seo-analyst/SOUL.md << 'EOF'
# SEOAnalyst

## Role
You are an SEO analyst specializing in keyword research and content audits.

## Rules
- ALWAYS respond in English
- NEVER give recommendations without citing a reason
EOF

# Now run agents add
openclaw agents add seo-analyst   --workspace ./agents/seo-analyst   --non-interactive

Error: "No model provider configured"

The agent was registered but the gateway cannot run it because no API key is set for any model provider.

# Set an Anthropic API key
openclaw models auth paste-token --provider anthropic
# (paste your key when prompted)

# Or set OpenAI
openclaw models auth paste-token --provider openai

# Or use Ollama (no key required)
# Install Ollama first: https://ollama.com
# Then: openclaw agents add agent-name --model ollama

Problem: Agent registered but gateway does not respond

Registration succeeded but openclaw agent --agent seo-analyst returns "agent not found". The gateway was not restarted after registration.

# Restart the gateway to pick up the new registration
openclaw gateway restart

# Verify the agent is now active
openclaw gateway status

# Test the agent
openclaw agent --agent seo-analyst --message "Hello"

Problem: Agent responds but ignores SOUL.md rules

The gateway was started before you finished writing SOUL.md, so it loaded an empty or incomplete version.

# Edit SOUL.md, then restart gateway
openclaw gateway restart

# Also clear the agent session to remove old context
rm ~/.openclaw/agents/seo-analyst/sessions/sessions.json

Advanced: Setting Different Models Per Agent

One of the most useful features of openclaw agents add is the ability to assign different model providers to different agents. Your content writer can use Claude for nuanced writing while your data analyst uses a local Ollama model to save costs on repetitive queries.

Terminal — Mixed model team setup
# Content writer on Claude (best for nuanced writing)
openclaw agents add content-writer   --workspace ./agents/content-writer   --model anthropic   --non-interactive

# Data analyst on GPT-4o (strong at code and structured output)
openclaw agents add data-analyst   --workspace ./agents/data-analyst   --model openai   --non-interactive

# Research agent on local Ollama (free, no API cost)
openclaw agents add researcher   --workspace ./agents/researcher   --model ollama   --non-interactive

# Restart to activate all three
openclaw gateway restart

The --model flag sets the provider at registration time. You can also override the model inside SOUL.md for even more granular control — for example, specifying the exact model version like claude-opus-4 or llama3.1:70b. For the Ollama setup guide, see running OpenClaw with local models.

Listing, Auditing, and Managing Your Agent Registry

As your agent team grows, it is easy to lose track of what is registered. These commands help you audit and maintain the registry:

Agent registry management
# List all registered agents with paths and status
openclaw agents list

# Check the gateway knows about all agents
openclaw gateway status

# Remove a specific agent
openclaw agents remove old-agent-name

# Re-register an agent whose workspace path changed
openclaw agents remove seo-analyst
openclaw agents add seo-analyst   --workspace /new/absolute/path/agents/seo-analyst   --non-interactive

# Restart after any registry changes
openclaw gateway restart

# Clear stale sessions for all agents
rm ~/.openclaw/agents/*/sessions/sessions.json

A good habit: any time you move your project directory or switch machines, run openclaw agents list first to verify paths are still valid. Stale absolute paths in the registry will cause "workspace not found" errors on gateway startup.

Skip the CLI setup. Deploy in 5 minutes with CrewClaw.

CrewClaw gives you a visual builder for SOUL.md, handles agent registration, and generates a complete deploy package. Define your agent, click deploy, done — no CLI required.

Frequently Asked Questions

What exactly does openclaw agents add do under the hood?

The 'openclaw agents add' command writes a new entry to the OpenClaw agent registry (stored in ~/.openclaw/registry.json or a project-local equivalent). It records the agent name, the absolute path to the workspace directory, and the configured model provider. When you next start or restart the gateway with 'openclaw gateway start' or 'openclaw gateway restart', the gateway reads this registry and initializes a session handler for each registered agent. Without running agents add first, the gateway has no knowledge of your agent and cannot route messages to it.

Do I need to restart the gateway after running openclaw agents add?

Yes. Adding an agent to the registry does not automatically notify a running gateway. You must run 'openclaw gateway restart' after each new agents add call for the gateway to load the new agent. If the gateway is not running yet, simply start it with 'openclaw gateway start' and it will read all registered agents from the registry at startup.

What is the --non-interactive flag for in openclaw agents add?

By default, 'openclaw agents add' prompts you to confirm the agent name, workspace path, and model provider before writing to the registry. The --non-interactive flag skips all these prompts and uses the values you provided in the command directly. This is essential for shell scripts, CI/CD pipelines, or any time you are adding multiple agents in sequence and do not want to answer confirmation questions for each one.

Can I run openclaw agents add without a SOUL.md already in the workspace?

It depends on the OpenClaw version. Some versions will create a default SOUL.md placeholder if none exists; others throw a 'workspace missing SOUL.md' error and abort. The safest approach is to always create your SOUL.md before running agents add. This ensures the gateway loads a meaningful agent configuration from the first restart, rather than a blank placeholder that will produce unhelpful responses.

How do I fix 'agent name already registered' when running openclaw agents add?

This error means the agent name you are trying to add already exists in the registry. You have two options: (1) choose a different name for the new agent, or (2) remove the existing registration with 'openclaw agents remove <name>' and then re-add it. Removing and re-adding is the correct approach when you have moved an agent's workspace directory to a new path and need to update the registry entry.

Build Your AI Agent Now

Design, test with real AI, and export a production-ready deploy package. Docker, Telegram, Discord & Slack bots included.

Open Agent Designer

Free to design. No credit card required.