@agentlib/orchestrator
Agent orchestrator for AgentLIB — coordinate multiple specialized agents to solve complex tasks.Installation
Overview
The@agentlib/orchestrator package provides a meta-agent system that can:
- Coordinate multiple specialized sub-agents
- Execute agents in parallel or sequentially
- Manage agent state and communication
- Share global context across agents
- Automatically summarize multi-agent workflows
Quick Start
Configuration
Core Concepts
Planner Agent
The planner is a special agent that controls the orchestrator. It decides:- Which agents to invoke
- What prompts to send them
- When to run agents in parallel vs sequential
- How to synthesize results
Sub-Agents
Sub-agents are specialized workers that the planner can invoke:Built-in Tools
WhenexposeAgentsAsTools: true (default), the orchestrator automatically provides these tools to the planner:
invoke_agent
Launch an agent with a prompt (runs in parallel):wait_for_agent
Wait for a specific agent to finish and get its output:wait_all_agents
Wait for all currently running agents:get_agent_state
Get current status of a specific agent:get_all_agent_states
Get status of all agents:clear_agent_history
Clear memory/history of a specific agent:Execution Patterns
Sequential Execution
invoke_agent(researcher, 'Find AI trends')wait_for_agent(researcher)invoke_agent(writer, 'Write blog post about: ...')wait_for_agent(writer)
Parallel Execution
invoke_agent(researcher, 'AI in healthcare')invoke_agent(researcher, 'AI in education')(parallel!)wait_all_agents()- Synthesize results
Global Context
Share read-only context across all agents:Memory Management
Each sub-agent automatically gets aBufferMemory if none is provided:
Summarization
Enable automatic summarization of agent work:- Each agent’s output is summarized
- Summaries are injected into subsequent planner runs
- Helps maintain context across long workflows
Event Handling
Advanced Usage
Step Interception
Manual Agent Control
Extended Sub-Buffers
Agent State
Use Cases
Research + Writing Pipeline
Multi-Modal Analysis
Customer Support
Requirements
- Node.js: >= 18.0.0
- Dependencies:
@agentlib/core(workspace)@agentlib/memory(workspace)@agentlib/utils(workspace)
Exports
Classes
Orchestrator- Main orchestrator class
Types
OrchestratorConfigAgentStateStepSummaryOrchestratorEvents
Related Packages
- @agentlib/core - Core agent system
- @agentlib/memory - Memory for sub-agents
- @agentlib/reasoning - Planner reasoning engine