orchestration

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package orchestration provides a unified orchestrator that dynamically selects between collaboration, crews, hierarchical, and handoff patterns based on task characteristics and agent composition.

Stability: Beta

The orchestrator analyzes the provided agents and task metadata to automatically choose the most appropriate multi-agent coordination pattern, or allows explicit pattern selection via configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollaborationAdapter

type CollaborationAdapter struct {
	// contains filtered or unexported fields
}

CollaborationAdapter wraps agent/collaboration into a PatternExecutor.

func NewCollaborationAdapter

func NewCollaborationAdapter(coordinationType string, logger *zap.Logger) *CollaborationAdapter

NewCollaborationAdapter creates a new collaboration adapter.

func (*CollaborationAdapter) CanHandle

func (a *CollaborationAdapter) CanHandle(task *OrchestrationTask) bool

func (*CollaborationAdapter) Execute

func (*CollaborationAdapter) Name

func (a *CollaborationAdapter) Name() Pattern

func (*CollaborationAdapter) Priority

func (a *CollaborationAdapter) Priority(task *OrchestrationTask) int

type CrewAdapter

type CrewAdapter struct {
	// contains filtered or unexported fields
}

CrewAdapter wraps agent/crews into a PatternExecutor.

func NewCrewAdapter

func NewCrewAdapter(logger *zap.Logger) *CrewAdapter

NewCrewAdapter creates a new crew adapter.

func (*CrewAdapter) CanHandle

func (a *CrewAdapter) CanHandle(task *OrchestrationTask) bool

func (*CrewAdapter) Execute

func (*CrewAdapter) Name

func (a *CrewAdapter) Name() Pattern

func (*CrewAdapter) Priority

func (a *CrewAdapter) Priority(task *OrchestrationTask) int

type HandoffAdapter

type HandoffAdapter struct {
	// contains filtered or unexported fields
}

HandoffAdapter wraps agent/handoff into a PatternExecutor.

func NewHandoffAdapter

func NewHandoffAdapter(logger *zap.Logger) *HandoffAdapter

NewHandoffAdapter creates a new handoff adapter.

func (*HandoffAdapter) CanHandle

func (a *HandoffAdapter) CanHandle(task *OrchestrationTask) bool

func (*HandoffAdapter) Execute

func (*HandoffAdapter) Name

func (a *HandoffAdapter) Name() Pattern

func (*HandoffAdapter) Priority

func (a *HandoffAdapter) Priority(task *OrchestrationTask) int

type HierarchicalAdapter

type HierarchicalAdapter struct {
	// contains filtered or unexported fields
}

HierarchicalAdapter wraps agent/hierarchical into a PatternExecutor.

func NewHierarchicalAdapter

func NewHierarchicalAdapter(logger *zap.Logger) *HierarchicalAdapter

NewHierarchicalAdapter creates a new hierarchical adapter.

func (*HierarchicalAdapter) CanHandle

func (a *HierarchicalAdapter) CanHandle(task *OrchestrationTask) bool

func (*HierarchicalAdapter) Execute

func (*HierarchicalAdapter) Name

func (a *HierarchicalAdapter) Name() Pattern

func (*HierarchicalAdapter) Priority

func (a *HierarchicalAdapter) Priority(task *OrchestrationTask) int

type OrchestrationResult

type OrchestrationResult struct {
	Pattern   Pattern
	Output    *agent.Output
	AgentUsed []string // agent IDs that participated
	Duration  time.Duration
	Metadata  map[string]any
}

OrchestrationResult wraps agent.Output with pattern info and metrics.

type OrchestrationTask

type OrchestrationTask struct {
	ID          string
	Description string
	Input       *agent.Input
	Agents      []agent.Agent
	Metadata    map[string]any
}

OrchestrationTask wraps agent.Input with orchestration metadata.

type Orchestrator

type Orchestrator struct {
	// contains filtered or unexported fields
}

Orchestrator dynamically selects and executes orchestration patterns.

func NewOrchestrator

func NewOrchestrator(config OrchestratorConfig, logger *zap.Logger) *Orchestrator

NewOrchestrator creates a new orchestrator.

func (*Orchestrator) Execute

Execute runs the task using the configured or auto-selected pattern.

func (*Orchestrator) RegisterPattern

func (o *Orchestrator) RegisterPattern(executor PatternExecutor)

RegisterPattern registers a pattern executor.

func (*Orchestrator) SelectPattern

func (o *Orchestrator) SelectPattern(task *OrchestrationTask) (Pattern, error)

SelectPattern analyzes the task to pick the best pattern.

type OrchestratorConfig

type OrchestratorConfig struct {
	DefaultPattern    Pattern
	AutoSelectEnabled bool
	Timeout           time.Duration
	MaxAgents         int
}

OrchestratorConfig configures the orchestrator behavior.

func DefaultOrchestratorConfig

func DefaultOrchestratorConfig() OrchestratorConfig

DefaultOrchestratorConfig returns sensible defaults.

type Pattern

type Pattern string

Pattern identifies an orchestration pattern.

const (
	PatternCollaboration Pattern = "collaboration"
	PatternCrew          Pattern = "crew"
	PatternHierarchical  Pattern = "hierarchical"
	PatternHandoff       Pattern = "handoff"
	PatternAuto          Pattern = "auto"
)

type PatternExecutor

type PatternExecutor interface {
	Execute(ctx context.Context, task *OrchestrationTask) (*OrchestrationResult, error)
	Name() Pattern
	CanHandle(task *OrchestrationTask) bool
	Priority(task *OrchestrationTask) int // higher = better fit
}

PatternExecutor is the unified interface for all orchestration patterns.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL