collaboration
Module: vibex/collaboration
Collaboration Module - Multi-Agent Collaboration Engine
Provides:
- Parallel agent execution
- Agent-to-agent communication
- Shared context management
- Collaborative planning
Classes
AgentCollaborationManager
View sourceAgent Collaboration Manager Handles agent-to-agent communication and shared context
Methods:
sendMessage
View sourceSend a message from one agent to another
function sendMessage(from: string, to: string, content: string, metadata?: Record<string, any>): voidParameters:
| Name | Type | Description |
|---|---|---|
from | string | |
to | string | |
content | string | |
metadata | Record<string, any> (optional) |
getMessages
View sourceGet pending messages for an agent
function getMessages(agentId: string): AgentMessage[]Parameters:
| Name | Type | Description |
|---|---|---|
agentId | string |
subscribe
View sourceSubscribe to messages for an agent
function subscribe(agentId: string, callback: (message: AgentMessage) => void): () => voidParameters:
| Name | Type | Description |
|---|---|---|
agentId | string | |
callback | (message: AgentMessage) => void |
updateContext
View sourceUpdate shared context
function updateContext(agentId: string, updates: Record<string, any>): voidParameters:
| Name | Type | Description |
|---|---|---|
agentId | string | |
updates | Record<string, any> |
getContext
View sourceGet shared context
function getContext(): SharedContextgetContextValue
View sourceGet a specific value from shared context
function getContextValue(key: string): anyParameters:
| Name | Type | Description |
|---|---|---|
key | string |
ParallelExecutionEngine
View sourceParallel Execution Engine Executes multiple agent tasks in parallel
Methods:
executeParallel
View sourceExecute multiple tasks in parallel
function executeParallel(tasks: ParallelTask[]): Promise<ParallelExecutionResult[]>Parameters:
| Name | Type | Description |
|---|---|---|
tasks | ParallelTask[] |
cancelTask
View sourceCancel a running task
function cancelTask(taskId: string): voidParameters:
| Name | Type | Description |
|---|---|---|
taskId | string |
getActiveTaskCount
View sourceGet active task count
function getActiveTaskCount(): numberCollaborativePlanner
View sourceCollaborative Planner Helps agents plan together
Methods:
createCollaborativePlan
View sourceCreate a collaborative plan with multiple agents
function createCollaborativePlan(goal: string, agentIds: string[]): Promise<{ plan: any; agentAssignments: Map<string, string[]> }>Parameters:
| Name | Type | Description |
|---|---|---|
goal | string | |
agentIds | string[] |
Interfaces
AgentMessage
View sourceProperties:
| Name | Type | Description |
|---|---|---|
from | string | |
to | string | |
content | string | |
metadata | Record<string, any> | (optional) |
timestamp | Date |
SharedContext
View sourceProperties:
| Name | Type | Description |
|---|---|---|
spaceId | string | |
data | Record<string, any> | |
updatedAt | Date | |
updatedBy | string |
ParallelTask
View sourceProperties:
| Name | Type | Description |
|---|---|---|
id | string | |
agentId | string | |
messages | any[] | |
system | string | (optional) |
metadata | Record<string, any> | (optional) |
priority | number | (optional) |
ParallelExecutionResult
View sourceProperties:
| Name | Type | Description |
|---|---|---|
taskId | string | |
agentId | string | |
result | AgentResponse | |
error | Error | (optional) |
duration | number |