top of page

LBSocial

OpenClaw Multi-Agent Setup: Separate Tools, Memory, and Shared Repo

This tutorial demonstrates an effective methodology for deploying an OpenClaw multi-agent setup. Rather than consolidating all tasks into a single, overloaded agent, this guide outlines how to divide the system into three highly specialized agents to improve execution efficiency and eliminate memory context conflicts.


OpenClaw Multi-Agent Setup: Separate Tools, Memory, and Shared Repo

Architecture Design for an OpenClaw Multi-Agent Setup


The primary advantage of an OpenClaw multi-agent setup is operational clarity. By assigning each agent a strict, specialized role, the system isolates memory context, optimizes token usage, and prevents errors in tool invocation.


Diagram depicting a Multi-Agent System in Google Cloud. A central Main Agent coordinates Data and GWS Agents, linked via Telegram Bot.
Architecture overview: 3 Specialized Agents, 1 Google Cloud VM, 1 Shared Git Repository.

When configuring this system, the principles of Harness Engineering apply. It is vital to distinguish between two core concepts: a Skill provides the standard operating procedures (SOP) for a given task, while a Tool provides the execution environment (such as the VM command line, the GitHub CLI, or a Python workspace).


The recommended architecture consists of:


  1. Main Agent (main): Acts as the central coordinator and task router.

  2. Data Specialist (data): Dedicated exclusively to Python execution, data analysis, Git management, and GitHub repository operations.

  3. Workspace Specialist (gws): Dedicated exclusively to Google Workspace operations, including Gmail, Google Drive, Docs, and Classroom.


All three agents operate on the same Google Cloud VM and utilize a Shared Git Repository to securely pass context and deliverables.




Step 1: Initializing the Shared Git Repository


This shared repository functions as the common collaboration workspace. The data agent maintains write access to edit the codebase, while the gws agent uses read-only access to understand the project context.


To initialize this workspace, connect to the VM via VS Code and execute the following commands in the terminal:


mkdir -p /home/username/shared-git
cd /home/username/shared-git
gh auth status
gh repo clone your-github-handle/openclaw-demo
cd /home/username/shared-git/openclaw-demo
pwd
ls
Note: Executing gh auth status verifies that the VM is properly authenticated and that GitHub access is configured within the tool execution environment.
Visual Studio Code window showing a terminal executing git clone commands. File explorer with project folders is open on the left.
VS Code terminal displaying the successful gh repo clone command execution and the resulting directory contents.

Step 2: Provisioning the Agents


Assuming the main agent is already operational on the existing VM, the next step is to provision the data and gws agents. Each new agent must be assigned an isolated workspace directory to ensure storage separation.


openclaw agents add data --workspace /home/username/.openclaw/workspace-data
openclaw agents add gws --workspace /home/username/.openclaw/workspace-gws

To verify the successful creation and current status of all agents, execute:


openclaw agents list --bindings

A computer screen shows a code editor with a file tree on the left. Open document "TOOLS.md" has text notes; terminal lists agent configurations.
openclaw agents list --bindings clearly displaying all three active agents

Step 3: Configuring Identities and Skills via the Dashboard


The most efficient method to configure both the personality instructions (Markdown files) and the physical skill boundaries is through the OpenClaw Dashboard. Open the Dashboard URL provided when you start your OpenClaw Gateway.



For each agent, select them in the Dashboard UI and perform the following updates. Click "Save" after modifying the markdown text blocks and adjusting the skill toggles.


1. The Main Agent Configuration


  • Profile Selection: Set the profile to coding.

  • Skill Toggles: Disable heavy execution skills. Enable lightweight routing skills such as summarize and taskflow.

  • Dashboard Markdown Updates: Replace the existing text with the following:



# Role Profile
You are the main coordinator agent in this OpenClaw multi-agent system.

## Core role
You are the main entry point and coordinator. Your job is to understand requests, keep the workflow organized, and route specialist work to the correct agent.

## Associated skills
- summarize
- taskflow

You are a coordinator, not the main specialist for coding or Google Workspace work.

## What you are responsible for
- general coordination
- high-level planning
- reading shared project context
- deciding which agent should handle which task

## Do not do
- do not act like the full data specialist by default
- do not act like the full Google Workspace specialist by default
- do not expose secrets or credentials

# Main Agent Tools

## Environment
You run on a VM where the environment is already configured.
The VM already has GitHub access, Google Workspace access, and local workspace access.

Do not ask for raw credentials unless absolutely necessary.
Do not print or reveal secrets.

## How to use tools
You may:
- read project files for context
- inspect shared repo structure
- help route repo work to the data agent
- help route Google Workspace work to the gws agent

## Security
- never reveal credentials
- never print tokens

# Main Agent Guardrails

## Hard rules
- do not expose secrets
- do not print tokens or API keys
- do not pretend to be the data or gws specialist when role separation matters
- do not send external communications without clear user intent

## Coordination policy
- coordinate clearly
- prefer routing specialist work to the correct agent

## Repo policy
- the shared repo is common context
- do not make unnecessary repo changes by default

2. The Data Agent Configuration


  • Profile Selection: Set the profile to coding.

  • Skill Toggles: Disable all gws-* skills. Enable GitHub, gh-issues, autonomous-data-scientist, and skill-creator.

  • Dashboard Markdown Updates: Replace the existing text with the following:



# Role Profile
You are the data specialist in this OpenClaw multi-agent system.

## Core role
You are responsible for coding, analysis, Git, GitHub, and implementation work inside the shared project repository.

## Associated skills
- autonomous-data-scientist
- github
- gh-issues
- summarize

## Shared repository
Your default working repository is:
/home/username/shared-git/openclaw-demo

## Default behavior
- focus on code, analysis, and implementation
- make clean and structured repo changes when needed
- prefer reproducible technical workflows

## Do not do
- do not take over Google Workspace tasks by default
- do not expose secrets or credentials

# Data Agent Tools

## Environment
You run on a VM where the environment is already configured.
The VM already has GitHub access, local git, gh, and Python tools available.

Use the local Git and GitHub tooling already available on the machine.

## How to use tools
You may use:
- git
- gh
- Python tools
- repo editing tools
- coding tools
- analysis tools

## Boundaries
You are not the default agent for:
- Gmail, Docs, Drive, Classroom, etc.

# Data Agent Guardrails

## Hard rules
- do not expose secrets
- do not hardcode private credentials into repo files
- do not perform unrelated Google Workspace actions by default

## Repo policy
- the shared repo is your main working repo
- you may modify repo files when needed for the task
- prefer focused changes over broad unnecessary edits

## Communication policy
- be direct and technical
- explain changes clearly when relevant

3. The Workspace (GWS) Agent Configuration


  • Profile Selection: Set the profile to coding.

  • Skill Toggles: Disable code execution and GitHub skills. Enable the full suite of gws-* skills and taskflow-inbox-triage.

  • Dashboard Markdown Updates: Replace the existing text with the following:



# Role Profile
You are the Google Workspace specialist in this OpenClaw multi-agent system.

## Core role
You are responsible for Google Workspace tasks and document-oriented workflows.

## Associated skills
- gws-shared
- gws-gmail*, gws-drive*, gws-calendar*
- gws-docs*, gws-slides*, gws-sheets*
- gws-classroom*, gws-tasks*, gws-forms*
- taskflow-inbox-triage

## Shared repository
Shared repo path: /home/username/shared-git/openclaw-demo
You may read this repository as project context, but it is reference context by default, not your default editing workspace.

## Do not do
- do not modify the shared repo by default
- do not run unnecessary coding workflows

# GWS Agent Tools

## Environment
You run on a VM where the environment is already configured.
The VM already has Google Workspace access and gws tools available.

GitHub access exists on the VM, but for this agent the shared repo is reference context by default.

## How to use tools
You may use Google Workspace-related tools for:
- Gmail, Docs, Drive, Calendar, Classroom, etc.

## Working expectations
- prioritize Google Workspace actions
- read the shared repo when context is needed
- do not modify the shared repo unless explicitly instructed

# GWS Agent Guardrails

## Hard rules
- do not expose secrets
- do not reveal credentials
- do not send external emails without clear permission
- do not modify the shared repo by default

## Workspace action policy
- be careful with actions that affect email, classroom, or shared documents
- confirm intent when an action has external impact

## Repo policy
- the shared repo is reference context only
- prefer leaving repo edits to the data agent
Web interface of OpenClaw Control showing "Agents" tab with skills list. Interface includes search bar, enable/disable buttons, and skill details.
OpenClaw Dashboard UI showing the Tools/Skills toggle switches


Step 4: Telegram Multi-Bot Configuration


The final phase involves binding each agent to an independent Telegram Bot. By utilizing separate 1-to-1 direct messaging channels, the system eliminates the need for @mentions. The system automatically routes tasks based on the Bot Token that receives the message.



1. Generating the Bot Tokens via BotFather


Before modifying the OpenClaw configuration file, the three independent bots must be physically created within the Telegram ecosystem.


  1. Open the Telegram application and search for @BotFather (ensure it possesses the official verified blue checkmark).

  2. Start the chat and issue the command: /newbot

  3. Set the Display Name: Provide a display name for the interface (e.g., Main Coordinator, Data Specialist, Workspace Specialist).

  4. Set the Username: Provide a unique username. This must end in "bot" and cannot contain spaces (e.g., yourprefix_main_bot, yourprefix_data_bot, yourprefix_gws_bot).

  5. Secure the Token: Upon successful creation, BotFather will generate an HTTP API Token. Save this token securely.


Repeat this process three times to generate distinct tokens for the Main, Data, and Workspace agents.


2. Obtaining the Telegram User ID


OpenClaw requires a specific Telegram User ID to populate the allowFrom array, ensuring that unauthorized users cannot issue commands to these agents.

  1. In Telegram, search for @userinfobot or @RawDataBot.

  2. Start the chat to prompt the bot.

  3. The bot will return a numeric User ID (e.g., 123456789). Note that this is a string of numbers, not an @username.


3. Modifying openclaw.json


With the three Bot Tokens and the numeric User ID secured, expand the single-bot configuration into a multi-account configuration within the channels array:


{
  "channels": {
    "telegram": {
      "enabled": true,
      "allowFrom": ["YOUR_NUMERIC_TELEGRAM_USER_ID"],
      "groupPolicy": "disabled",
      "streaming": {
        "mode": "partial"
      },
      "accounts": {
        "mainbot": {
          "botToken": "INSERT_MAIN_BOT_TOKEN_HERE",
          "dmPolicy": "allowlist",
          "allowFrom": ["YOUR_NUMERIC_TELEGRAM_USER_ID"]
        },
        "databot": {
          "botToken": "INSERT_DATA_BOT_TOKEN_HERE",
          "dmPolicy": "allowlist",
          "allowFrom": ["YOUR_NUMERIC_TELEGRAM_USER_ID"]
        },
        "gwsbot": {
          "botToken": "INSERT_GWS_BOT_TOKEN_HERE",
          "dmPolicy": "allowlist",
          "allowFrom": ["YOUR_NUMERIC_TELEGRAM_USER_ID"]
        }
      }
    }
  }
}

4. Executing Binding Commands


Execute the following commands in the terminal to bind the respective agents to their designated Telegram accounts:


openclaw agents bind --agent main --bind telegram:mainbot
openclaw agents bind --agent data --bind telegram:databot
openclaw agents bind --agent gws --bind telegram:gwsbot

Visual Studio Code window showing a terminal with OpenClaw commands and file explorer panel open. Text and file names visible.
Three distinct bots (mainbot, databot, gwsbot) are fully initialized


Step 6: The Final Demo (Executing the Multi-Agent Workflow)


With the routing configured and the gateway restarted, the system is ready for real-world execution. This final demonstration illustrates how the agents collaborate sequentially without sharing the same memory context.


Phase 1: Data Generation via the Data Specialist


  1. Open Telegram and navigate to the databot chat.

  2. Issue a technical analytical prompt, such as: "Calculate the average population growth rate in the US."

  3. The Data agent will process the request, write the necessary Python code, execute the analysis, and generate a new Jupyter Notebook and a data chart, all directly in the shared Git repository (/home/username/shared-git/openclaw-demo).


Split screen with a US population growth chart on the left and a chat with analysis results on the right. Green and red text visible.
Data Bot successfully returned the US population growth analysis and the generated chart

Phase 2: Asset Distribution via the Workspace Specialist


  1. Switch over to the gwsbot chat in Telegram.

  2. Issue a distribution command referencing the newly created files, such as: "Upload the new population analysis notebook to my Google Drive and attach it to the Python Classroom."

  3. The Workspace agent will autonomously access the shared repository, locate the notebook generated by the Data agent, and use the Google Workspace APIs to upload and attach it.



Split screen showing a Google Classroom page titled Cloud Data Science Demo and a chat conversation discussing a file upload to Google Drive.
GWS Bot confirms the upload in Telegram, followed by the file appearing successfully in the Google Classroom interface.

Summary of the Workflow Advantage


This execution highlights the core value of the multi-agent architecture. The agents remain strictly separated—preventing tool overlap and reducing token consumption—yet they collaborate flawlessly by utilizing the shared VM directory as a secure hand-off point for project deliverables. One agent generates the content; the other publishes it.


bottom of page