Skip to main content

Multi-Agent Orchestration

OrcBot provides production-ready multi-agent orchestration for parallel task execution, specialization, and autonomous coordination. The orchestration system uses real Node.js worker processes with IPC communication.

Architecture

Orchestration Components

  1. AgentOrchestrator: Manages worker pool and task distribution
  2. Worker Processes: Isolated Node.js processes forked from main agent
  3. IPC Channel: Inter-process communication for coordination
  4. Task Queue: Shared priority queue for work distribution
  5. Message Bus: Agent-to-agent messaging system

Worker Lifecycle

Process Isolation

Each worker is a separate Node.js process with:
  • Isolated memory: No shared state with main agent
  • Separate config: Can override LLM model, API keys
  • Independent execution: Runs tasks without blocking main agent
  • IPC communication: Sends results back via message passing

spawn_agent

Create a sub-agent for parallel work.

Parameters

string
required
Agent name (used in logs and status)
string
required
Agent role: "worker" (general task execution) or "researcher" (specialized research)
array
Optional skill subset this agent can use

Return Value

string
Confirmation with agent ID and PID (process ID)

Roles

Worker Agent:
  • General-purpose task execution
  • Full skill access (unless restricted by capabilities)
  • Suitable for parallel automation
  • Example: scraping multiple websites simultaneously
Researcher Agent:
  • Specialized for deep research tasks
  • Higher isResearch skill budgets
  • Optimized for multi-step web navigation
  • Example: comprehensive market research

Example Usage

Spawn general worker:
Spawn researcher:
Spawn with capability restrictions:

Response Example

Worker Process Details

Workers inherit:
  • Config from main agent (unless overridden)
  • LLM credentials
  • Memory store paths
  • Skill registry
Workers DO NOT inherit:
  • Channel connections (no Telegram/WhatsApp/Discord)
  • Current action state
  • Short-term memory (starts fresh)

Metadata

  • isDeep: false
  • isDangerous: false
  • isElevated: false
Spawn workers for I/O-bound parallelism. If you need to scrape 10 websites, spawn 10 workers and delegate one URL to each.

delegate_task

Assign a task to an agent or the orchestrator.

Parameters

string
required
Natural language task description
number
default:"5"
Task priority (1-10, higher = more urgent)
string
Specific agent to assign to. If omitted, orchestrator auto-assigns to available worker.

Return Value

string
Confirmation with task ID and assigned agent

Auto-Assignment

If agent_id is omitted, the orchestrator:
  1. Finds idle workers
  2. Assigns to least-loaded worker
  3. If no workers idle, queues for next available

Example Usage

Delegate to specific agent:
Auto-assign to available worker:

Response Example

Task Dependencies

Tasks support dependsOn metadata for chaining:

Metadata

  • isDeep: false

distribute_tasks

Auto-assign pending tasks to available workers.

Parameters

None. Distributes all pending tasks in the queue.

Return Value

string
Summary of distributed tasks

Example Usage

Response Example

Metadata

  • isDeep: false

orchestrator_status

Get orchestration summary.

Parameters

None.

Return Value

object
Orchestration state including active workers, pending tasks, and completion stats

Example Usage

Response Example

Metadata

  • isDeep: false

complete_delegated_task

Mark a delegated task as completed. Typically called by workers.

Parameters

string
required
Task ID to mark complete
string
Optional result summary

Example Usage

Metadata

  • isDeep: false

fail_delegated_task

Mark a delegated task as failed.

Parameters

string
required
Task ID to mark failed
string
required
Error message or reason for failure

Example Usage

Metadata

  • isDeep: false

Inter-Agent Messaging

send_agent_message

Send a message to another agent. Parameters:
string
required
Recipient agent ID
string
required
Message content
string
default:"info"
Message type: info, request, response, alert
Example:

broadcast_to_agents

Broadcast a message to all agents. Parameters:
string
required
Message to broadcast
Example:

get_agent_messages

Retrieve messages for an agent. Parameters:
string
Agent ID. If omitted, returns messages for current agent.
number
default:"10"
Max messages to return
Example:

Peer Agents

create_peer_agent

Create an independent peer agent with specialized configuration. Parameters:
string
required
Peer agent name
string
required
Role description
object
Custom WORLD.md governance rules
Example:
Difference from Workers:
  • Peer agents are independent long-lived agents with their own identity
  • Workers are temporary sub-processes for parallel task execution
Peers inherit WORLD.md governance but can have specialized rules.

configure_peer_agent

Update peer agent configuration and restart. Parameters:
string
required
Peer agent ID
object
required
Configuration updates (API keys, channel tokens, etc.)
Example:

Common Patterns

Parallel Web Scraping

Research Coordination

Task Pipeline

Best Practices

When to spawn workers:
  1. I/O-bound parallelism (multiple web scrapes, API calls)
  2. Long-running tasks that shouldn’t block main agent
  3. Specialized work requiring different LLM models
  4. Tasks with natural parallelization boundaries
Resource considerations:
  • Each worker is a full Node.js process (~50-100MB RAM)
  • Limit workers to 5-10 on typical servers
  • Workers don’t share memory, so results must be communicated via IPC or files
  • Channel connections (Telegram, etc.) are NOT available in workers
Workers vs peer agents:
  • Use workers for temporary parallel task execution
  • Use peer agents for long-lived specialized bots
  • Workers are cheaper (terminate after task completion)
  • Peers have full autonomy and channel access

Configuration

Troubleshooting

”Worker crashed”

  • Cause: Unhandled exception in worker process
  • Fix: Check daemon logs, add error handling to delegated tasks

”Task stuck in pending”

  • Cause: No idle workers or dependency not met
  • Fix: Check orchestrator_status(), spawn more workers or resolve dependencies

”IPC timeout”

  • Cause: Worker took too long to respond
  • Fix: Increase ipcTimeout or split task into smaller chunks

”No workers available”

  • Cause: All workers busy or crashed
  • Fix: Spawn more workers or terminate/restart hung workers

Scheduling

Schedule autonomous tasks for workers

Memory

Share context between agents