orchestration

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

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 NewDefaultOrchestrator added in v1.2.0

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

NewDefaultOrchestrator creates an Orchestrator pre-loaded with all built-in pattern adapters (collaboration, crew, hierarchical, handoff). This is the recommended entry point for wiring orchestration into the agent builder or any top-level API.

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 OrchestratorAdapter added in v1.2.0

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

OrchestratorAdapter wraps *Orchestrator to satisfy agent.OrchestratorRunner. This bridges the orchestration package types with the agent-layer local interface, following the §12 workflow-local interface pattern.

func NewOrchestratorAdapter added in v1.2.0

func NewOrchestratorAdapter(o *Orchestrator) *OrchestratorAdapter

NewOrchestratorAdapter creates an adapter that satisfies agent.OrchestratorRunner.

func (*OrchestratorAdapter) Execute added in v1.2.0

Execute converts agent-layer types to orchestration types and delegates.

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