Channels
Agent Teams
Declarative multi-agent team coordination plugin for OpenClaw
Install
npm install
npm
Configuration Example
{
"teams": {
"my-team": {
"description": "My first team",
"coordination": "peer",
"members": {
"alice": {
"role": "General-purpose assistant that helps with coding tasks"
}
}
}
}
}
README
# openclaw-plugin-agent-teams
Declarative multi-agent team coordination for OpenClaw.



## Overview
Agent Teams lets you define multi-agent teams in JSON. Teams coordinate through shared tools, messaging, and memory โ no custom orchestration code needed.
**Features:**
- Two coordination modes: **Orchestrator** (leader assigns & approves) and **Peer** (skill-based routing)
- 5 built-in tools for runs, tasks, memory, messaging, and inbox
- Shared state: KV store, event queue, document pool, message store, activity log
- File-based event broadcasting (`.jsonl`)
- Workflow templates with stages, fail-loopback, and approval gates
- Learning system with auto-capture and cross-run persistence
- CLI agent support โ spawn external Claude, Codex, or Gemini agents via PTY
- `/team` slash commands for status, control, and debugging
## Architecture
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ openclaw.plugin.json โ
โ (team config) โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโ
โ โ โ
โโโโโโผโโโโโ โโโโโโโผโโโโโโ โโโโโโโผโโโโโโ
โ Tools โ โ Hooks โ โ Commands โ
โ 5 tools โ โ 5 hooks โ โ /team ... โ
โโโโโโฌโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ
โ โ โ
โโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโผโโโโโ
โ State Stores โ
โ KV ยท Events ยท Docs ยท Runs ยท Messages โ
โ Activity Log โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ CLI Agents (PTY) โ Broadcast (.jsonl) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
Config is validated and parsed at activation. Stores are initialized per team with file-backed persistence (atomic write via tmp + rename). CLI agent infrastructure (IPC server + PTY spawner) starts only when CLI members are configured.
## Prerequisites
- **OpenClaw** >= 2026.2.26
- **Node.js** >= 22
- **node-pty** (optional) โ required only if using CLI agents (`cli: "claude"` etc.)
## Installation
### Quick Start
```bash
# Clone into the conventional plugins directory
mkdir -p ~/.openclaw/workspace/plugins
cd ~/.openclaw/workspace/plugins
git clone https://github.com/kuan0808/openclaw-agent-teams-plugin.git agent-teams
cd agent-teams
npm install
npm run build
# Register & enable
openclaw plugins install .
```
This plugin requires team configuration to function. After installing, use the built-in [onboarding skill](#onboarding-skill) to set up your first team interactively:
```
You: "set up agent teams"
```
Or configure manually โ see [Configuration](#configuration) for examples.
### Manual Registration
If you prefer manual control or need to keep existing plugins in your config, clone and build as above, then register manually instead of using `openclaw plugins install`:
```bash
# Add to allowed plugins list (keep any existing plugins in the array)
openclaw config set plugins.allow '["agent-teams"]'
# Tell OpenClaw where to find the plugin
openclaw config set plugins.load.paths '["~/.openclaw/workspace/plugins/agent-teams"]'
# Enable the plugin
openclaw config set plugins.entries.agent-teams.enabled true
```
### Dev Mode
```bash
npm run build
openclaw plugins link .
```
Use `npm run dev` for watch mode during development.
## Configuration
### Minimal Peer Team
```json
{
"teams": {
"my-team": {
"description": "My first team",
"coordination": "peer",
"members": {
"alice": {
"role": "General-purpose assistant that helps with coding tasks"
}
}
}
}
}
```
### Orchestrator Team
```json
{
"teams": {
"product": {
"description": "Product development team",
"coordination": "orchestrator",
"orchestrator": "pm",
"members": {
"pm": {
"role": "Project manager. Breaks down goals into tasks, assigns work, reviews results.",
"can_delegate": true
},
"frontend": {
"role": "Frontend developer specializing in React and UI/UX",
"skills": ["frontend", "react", "css", "ui"]
},
"backend": {
"role": "Backend developer specializing in APIs and databases",
"skills": ["backend", "api", "database", "nodejs"]
}
}
}
}
}
```
### Team Config Reference
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `description` | string | Yes | What this team does |
| `coordination` | `"orchestrator"` \| `"peer"` | Yes | Coordination mode |
| `orchestrator` | string | Orchestrator only | Member key of the team leader |
| `members` | object | Yes | Member definitions (at least one) |
| `shared_memory` | object | No | Memory store configuration |
| `routing` | object | No | Task routing settings |
| `workflow` | object | No | Workflow and gate settings |
| `knowledge` | object | No | Learning system settings |
### Member Config Reference
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `role` | string | โ | Role description (required unless `role_file` set) |
| `role_file` | string | โ | Path to file containing role description |
| `model` | `{ primary: string }` | โ | Model override |
| `skills` | string[] | โ | Skill tags for routing (e.g., `["frontend", "react"]`) |
| `can_delegate` | boolean | `false` | Whether this member can create tasks for others |
| `tools` | `{ deny?, allow? }` | โ | Tool access restrictions |
| `cli` | `"claude"` \| `"codex"` \| `"gemini"` | โ | Spawn as external CLI agent |
| `cli_options` | object | โ | CLI-specific settings (see [CLI Agents](#cli-agents)) |
### Defaults
| Field | Default |
|-------|---------|
| `workflow.max_rounds` | `10` |
| `workflow.timeout` | `600` (seconds) |
| `knowledge.retention` | `"across-runs"` |
| `knowledge.consolidation` | `true` |
| `knowledge.consolidation_timeout` | `30` (seconds) |
| `knowledge.notify_leader` | `true` |
| `routing.fallback` | `"orchestrator"` |
| `shared_memory.enabled` | `true` |
## Tools
| Tool | Purpose | Key Params |
|------|---------|------------|
| `team_run` | Manage execution runs | `action`: start / status / complete / cancel |
| `team_task` | Create, update, query tasks | `action`: create / update / query; `deliverables`, `learning` |
| `team_memory` | Read/write shared memory | `store`: kv / docs; `action`: get / set / delete / list |
| `team_send` | Send messages & publish events | `to` (direct), `topic` (pub/sub) |
| `team_inbox` | Read messages, events, activity | `source`: inbox / events / activity |
### Typical Workflow
```
1. team_run(action: "start", goal: "Build feature X")
โ Creates a run, returns run_id
โ If workflow template exists, auto-generates task chain
2. team_task(action: "create", description: "Implement API endpoint")
โ Routes to best member via skill matching
โ Returns task_id, assigned_to
3. team_task(action: "update", task_id: "...", status: "COMPLETED",
result: "API endpoint implemented", deliverables: [...])
โ Marks task done, captures learnings, unblocks dependents
4. team_send(to: "pm", message: "API is ready for review")
โ Direct message to a specific member
5. team_run(action: "complete", result: "Feature X shipped")
โ Closes the run, collects all learnings
```
## Commands
All commands use the `/team` prefix:
| Command | Description | Auth Required |
|---------|-------------|---------------|
| `/team status [name]` | Show run progress, task board, active members | No |
| `/team list` | List all teams with member count and status | No |
| `/team stop <name>` | Cancel the current run for a team | Yes |
| `/team agents` | Show status of all CLI agents | No |
| `/team logs <team/member>` | Print CLI agent log file path | No |
| `/team start <team/member>` | Manually spawn a CLI agent | Yes |
| `/team stop-agent <team/member>` | Kill a running CLI agent | Yes |
Commands accepting `<team/member>` also accept just `<member>` if the member name is unique across teams.
## Key Concepts
### Coordination Modes
- **Orchestrator** โ One leader member assigns tasks, reviews results, and has approval authority. Best for structured workflows with clear task ownership. Requires the `orchestrator` field to name the leader.
- **Peer** โ All members are equal. Tasks route automatically via skill matching. Best for collaborative work where any member can pick up tasks.
### Agent IDs
All team agents use the format `at--<team>--<member>`. For example, team `product` member `frontend` โ agent ID `at--product--frontend`. The `team` parameter is auto-resolved for team agents.
### Task State Machine
```
BLOCKED โ PENDING โ WORKING โ COMPLETED
โ โ
INPUT_REQUIRED
โ
FAILED / CANCELED
```
- **BLOCKED** โ Waiting for `depends_on` tasks to complete
- **PENDING** โ Ready to be picked up
- **WORKING** โ Currently being worked on
- **INPUT_REQUIRED** โ Needs clarification or human input
- **COMPLETED** โ Done (may trigger auto-learning capture)
- **FAILED** โ Failed (triggers fail-loopback if workflow template configured)
- **CANCELED** โ Canceled (e.g., by run cancellation)
### Three-Layer Routing
1. **Direct** โ `assign_to: "member-name"` bypasses all routing
2. **Skill match** โ `required_skills` matched against member `skills[]` with load balancing
3. **Fallback** โ Uses `routing.fallback` (default: `"orchestrator"`)
### Learning System
Learnings are auto-captured on task completion or failure:
- **Explicit** โ Provide `lear
... (truncated)
channels
Comments
Sign in to leave a comment