collaboration

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportsEphemeralAgents

func SupportsEphemeralAgents(provider AgentProvider) bool

SupportsEphemeralAgents checks if the provider can create ephemeral agents.

Types

type AgentFactory

type AgentFactory interface {
	// CreateEphemeralAgent creates a new agent with the specified role/capabilities.
	// The returned agent should be closed after use to release resources.
	CreateEphemeralAgent(ctx context.Context, role string) (*agent.Agent, error)
}

AgentFactory creates ephemeral agents on-demand for collaboration patterns. This enables runtime agent creation for roles like judges, moderators, specialists.

type AgentProvider

type AgentProvider interface {
	// GetAgent retrieves an agent by ID.
	// Context parameter allows for cancellation and deadlines.
	GetAgent(ctx context.Context, id string) (*agent.Agent, error)
}

AgentProvider retrieves agents by ID. This interface allows different agent sources (registry, orchestrator, etc.)

type AgentProviderWithFactory

type AgentProviderWithFactory interface {
	AgentProvider
	AgentFactory
}

AgentProviderWithFactory combines AgentProvider with optional factory capabilities. If the provider implements AgentFactory, orchestrators can create ephemeral agents. Otherwise, they fall back to requiring pre-registered agents.

type DebateOrchestrator

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

DebateOrchestrator manages multi-agent debates with round-by-round tracking.

func NewDebateOrchestrator

func NewDebateOrchestrator(provider AgentProvider) *DebateOrchestrator

NewDebateOrchestrator creates a new debate orchestrator.

func NewDebateOrchestratorWithObservability

func NewDebateOrchestratorWithObservability(provider AgentProvider, tracer observability.Tracer, logger *zap.Logger) *DebateOrchestrator

NewDebateOrchestratorWithObservability creates a new debate orchestrator with observability.

func (*DebateOrchestrator) Execute

Execute runs a multi-agent debate with specified rounds and topic.

type Engine

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

Engine orchestrates multi-agent collaboration patterns. It dispatches to specialized orchestrators based on pattern type.

func NewEngine

func NewEngine(provider AgentProvider) *Engine

NewEngine creates a new collaboration engine.

func NewEngineWithObservability

func NewEngineWithObservability(provider AgentProvider, tracer observability.Tracer, logger *zap.Logger) *Engine

NewEngineWithObservability creates a new collaboration engine with observability.

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, pattern *loomv1.WorkflowPattern) (*loomv1.WorkflowResult, error)

Execute runs a collaboration pattern and returns detailed results.

type EvaluationContext

type EvaluationContext struct {
	// Consensus tracking
	ConsensusReached  bool
	AverageConfidence *float32

	// Voting tracking
	TieDetected      bool
	VoteDistribution map[string]int32
	WinningVoteCount *int32
	TotalVotes       *int32

	// Explicit signals
	EscalationRequested bool

	// Custom fields for expression evaluation
	CustomFields map[string]interface{}
}

EvaluationContext provides context for trigger evaluation.

func FromDebateResult

func FromDebateResult(result *loomv1.DebateResult) *EvaluationContext

FromDebateResult creates evaluation context from debate result.

func FromSwarmResult

func FromSwarmResult(result *loomv1.SwarmResult) *EvaluationContext

FromSwarmResult creates evaluation context from swarm voting result.

func NewEvaluationContext

func NewEvaluationContext() *EvaluationContext

NewEvaluationContext creates a new evaluation context.

type PairProgrammingOrchestrator

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

PairProgrammingOrchestrator manages driver/navigator collaboration.

func NewPairProgrammingOrchestrator

func NewPairProgrammingOrchestrator(provider AgentProvider) *PairProgrammingOrchestrator

NewPairProgrammingOrchestrator creates a new pair programming orchestrator.

func (*PairProgrammingOrchestrator) Execute

Execute runs a pair programming session.

type PolicyEvaluator

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

PolicyEvaluator evaluates ephemeral agent spawn policies. It tracks spawns, costs, and trigger conditions.

func NewPolicyEvaluator

func NewPolicyEvaluator(logger *zap.Logger) *PolicyEvaluator

NewPolicyEvaluator creates a new policy evaluator.

func (*PolicyEvaluator) GetSpawnStats

func (e *PolicyEvaluator) GetSpawnStats(role string) (count int, costUSD float64)

GetSpawnStats returns current spawn statistics.

func (*PolicyEvaluator) RecordSpawn

func (e *PolicyEvaluator) RecordSpawn(role string, costUSD float64)

RecordSpawn records that an ephemeral agent was spawned.

func (*PolicyEvaluator) Reset

func (e *PolicyEvaluator) Reset()

Reset clears all tracking state (call at workflow start).

func (*PolicyEvaluator) ShouldSpawn

func (e *PolicyEvaluator) ShouldSpawn(ctx context.Context, policy *loomv1.EphemeralAgentPolicy, evalCtx *EvaluationContext) (bool, string)

ShouldSpawn evaluates whether an ephemeral agent should be spawned based on policy and context.

type SwarmOrchestrator

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

SwarmOrchestrator manages swarm intelligence voting patterns.

func NewSwarmOrchestrator

func NewSwarmOrchestrator(provider AgentProvider) *SwarmOrchestrator

NewSwarmOrchestrator creates a new swarm orchestrator.

func NewSwarmOrchestratorWithObservability

func NewSwarmOrchestratorWithObservability(provider AgentProvider, tracer observability.Tracer, logger *zap.Logger) *SwarmOrchestrator

NewSwarmOrchestratorWithObservability creates a new swarm orchestrator with observability.

func (*SwarmOrchestrator) Execute

Execute runs a swarm voting process.

type TeacherStudentOrchestrator

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

TeacherStudentOrchestrator manages expert-to-novice knowledge transfer.

func NewTeacherStudentOrchestrator

func NewTeacherStudentOrchestrator(provider AgentProvider) *TeacherStudentOrchestrator

NewTeacherStudentOrchestrator creates a new teacher-student orchestrator.

func (*TeacherStudentOrchestrator) Execute

Execute runs a teacher-student learning session.

Jump to

Keyboard shortcuts

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