Documentation
¶
Index ¶
- Variables
- type Conflict
- type ConflictManager
- type ConflictType
- type EmbeddingAdapter
- type ManagerConfig
- type ProcessType
- type RecoveryStrategy
- type ResolutionStrategy
- type SimpleEmbedder
- type TaskError
- type Team
- func (t *Team) AddAgent(agent *agents.Agent) error
- func (t *Team) AssignTask(ctx context.Context, task *tasks.Task, agent *agents.Agent) error
- func (t *Team) CreateTask(description string, expectedOutput string, opts ...tasks.TaskOption) (*tasks.Task, error)
- func (t *Team) DeleteTaskOutput(taskID string) error
- func (t *Team) Execute(ctx context.Context) ([]string, error)
- func (t *Team) ExecuteTask(ctx context.Context, task *tasks.Task) error
- func (t *Team) GetSharedMemories(ctx context.Context, agentID string, query string) ([]*memory.SharedMemoryContext, error)
- func (t *Team) GetTaskHistory(taskID string) (*tasks.TaskOutput, error)
- func (t *Team) GetTaskOutput(taskID string) (*tasks.TaskOutput, error)
- func (c *Team) HandleVotingRound(ctx context.Context, task *tasks.Task) (bool, error)
- func (t *Team) ListTaskOutputs() []*tasks.TaskOutput
- func (t *Team) Pipeline() *tasks.Pipeline
- func (t *Team) QueryTaskOutputs(criteria map[string]interface{}) []*tasks.TaskOutput
- func (t *Team) Recall(ctx context.Context, query string) (map[string]interface{}, error)
- func (t *Team) RecoverTask(ctx context.Context, taskErr *TaskError, strategy RecoveryStrategy) error
- func (t *Team) Remember(ctx context.Context, value interface{}, metadata map[string]interface{}) error
- func (t *Team) RememberEntity(ctx context.Context, name string, entityType memory.EntityType, ...) error
- func (t *Team) SaveMemory(value string, metadata map[string]interface{}, source string, ...) error
- func (t *Team) ShareMemory(ctx context.Context, source string, value interface{}, targets []string, ...) error
- func (t *Team) ValidateProcess() error
- type TeamOption
- type Vote
- type VotingConfig
- type VotingSession
Constants ¶
This section is empty.
Variables ¶
var DefaultManagerConfig = ManagerConfig{ AnalysisFormat: "A detailed analysis including: 1) Key requirements and constraints 2) Potential challenges and risks 3) Recommended execution approach 4) Success criteria", ReviewFormat: "APPROVE or REJECT with detailed explanation", RequireApproval: true, }
Default manager configuration
var DefaultVotingConfig = VotingConfig{ ConsensusThreshold: 70, MaxRounds: 3, RequireUnanimous: false, TieBreaker: "manager", VoteFormat: "APPROVE or REJECT with detailed explanation", }
DefaultVotingConfig provides default voting configuration
Functions ¶
This section is empty.
Types ¶
type Conflict ¶
type Conflict struct { ID string Type ConflictType Description string InvolvedAgents []*agents.Agent RelatedTask *tasks.Task StartTime time.Time ResolutionTime *time.Time Status string Resolution ResolutionStrategy VotingSession *VotingSession Context map[string]interface{} ResolutionNotes string }
Conflict represents a conflict between agents
type ConflictManager ¶
type ConflictManager struct {
// contains filtered or unexported fields
}
ConflictManager handles conflict detection and resolution
func NewConflictManager ¶
func NewConflictManager(team *Team) *ConflictManager
NewConflictManager creates a new conflict manager
func (*ConflictManager) DetectConflicts ¶
func (cm *ConflictManager) DetectConflicts(ctx context.Context) error
DetectConflicts checks for potential conflicts in the current state
func (*ConflictManager) ResolveConflict ¶
func (cm *ConflictManager) ResolveConflict(ctx context.Context, conflictID string) error
ResolveConflict attempts to resolve a conflict using the appropriate strategy
type ConflictType ¶
type ConflictType string
ConflictType represents different types of conflicts that can occur
const ( // TaskExecutionConflict occurs when agents disagree on task execution approach TaskExecutionConflict ConflictType = "task_execution" // ResourceConflict occurs when multiple agents compete for resources ResourceConflict ConflictType = "resource" // PriorityConflict occurs when there's disagreement about task priorities PriorityConflict ConflictType = "priority" // CapabilityConflict occurs when there's disagreement about agent capabilities CapabilityConflict ConflictType = "capability" // DecisionConflict occurs when agents disagree on decisions DecisionConflict ConflictType = "decision" )
type EmbeddingAdapter ¶
type EmbeddingAdapter struct {
// contains filtered or unexported fields
}
EmbeddingAdapter adapts embeddings.Model to memory.Embedder
func (*EmbeddingAdapter) Dimension ¶
func (a *EmbeddingAdapter) Dimension() int
type ManagerConfig ¶
type ManagerConfig struct { // Format for task analysis output AnalysisFormat string // Format for task review output ReviewFormat string // Whether to require explicit approval/rejection RequireApproval bool }
ManagerConfig defines custom manager configuration
type ProcessType ¶
type ProcessType string
ProcessType defines how agents in a team work together
const ( // Sequential - agents work one after another, passing results forward Sequential ProcessType = "sequential" // Hierarchical - agents work in a manager-worker relationship Hierarchical ProcessType = "hierarchical" // Consensus - agents work together to reach agreement through voting Consensus ProcessType = "consensus" )
type RecoveryStrategy ¶
type RecoveryStrategy string
RecoveryStrategy defines how to handle task failures
const ( // RetryWithSameAgent retries the failed task with the same agent RetryWithSameAgent RecoveryStrategy = "retry_same" // RetryWithDifferentAgent retries the task with a different agent RetryWithDifferentAgent RecoveryStrategy = "retry_different" // EscalateToManager sends the failed task to manager for review EscalateToManager RecoveryStrategy = "escalate" )
type ResolutionStrategy ¶
type ResolutionStrategy string
ResolutionStrategy defines how to resolve a conflict
const ( // ConsensusResolution uses voting to reach agreement ConsensusResolution ResolutionStrategy = "consensus" // HierarchicalResolution escalates to manager for decision HierarchicalResolution ResolutionStrategy = "hierarchical" // MediationResolution uses a third-party agent to mediate MediationResolution ResolutionStrategy = "mediation" // CompromiseResolution attempts to find middle ground CompromiseResolution ResolutionStrategy = "compromise" // FallbackResolution uses predefined fallback approach FallbackResolution ResolutionStrategy = "fallback" )
type SimpleEmbedder ¶
type SimpleEmbedder struct {
// contains filtered or unexported fields
}
SimpleEmbedder provides basic local embeddings without external API
func NewSimpleEmbedder ¶
func NewSimpleEmbedder(dimension int) *SimpleEmbedder
func (*SimpleEmbedder) Dimension ¶
func (e *SimpleEmbedder) Dimension() int
type TaskError ¶
type TaskError struct { TaskID string AgentName string Context string Recoverable bool // contains filtered or unexported fields }
TaskError represents a task execution error with context
func NewTaskError ¶
NewTaskError creates a new TaskError
type Team ¶
type Team struct { Name string Description string Agents []*agents.Agent Tasks []*tasks.Task ProcessType ProcessType Manager *agents.Agent // Used in hierarchical process Memory bool // contains filtered or unexported fields }
Team represents a team of agents working together
func NewTeam ¶
func NewTeam(name, description string, processType ProcessType, workDir string, memoryConfig memory.MemoryConfig, opts ...TeamOption) (*Team, error)
NewTeam creates a new team instance
func (*Team) AssignTask ¶
AssignTask assigns a task to an agent and sets up the execution function
func (*Team) CreateTask ¶
func (t *Team) CreateTask(description string, expectedOutput string, opts ...tasks.TaskOption) (*tasks.Task, error)
CreateTask creates a new task in the team
func (*Team) DeleteTaskOutput ¶
DeleteTaskOutput removes a task's output from storage
func (*Team) ExecuteTask ¶
ExecuteTask executes a task with the team
func (*Team) GetSharedMemories ¶
func (t *Team) GetSharedMemories(ctx context.Context, agentID string, query string) ([]*memory.SharedMemoryContext, error)
GetSharedMemories retrieves shared memories accessible to an agent
func (*Team) GetTaskHistory ¶
func (t *Team) GetTaskHistory(taskID string) (*tasks.TaskOutput, error)
GetTaskHistory returns the execution history of a task
func (*Team) GetTaskOutput ¶
func (t *Team) GetTaskOutput(taskID string) (*tasks.TaskOutput, error)
GetTaskOutput retrieves a task's output from storage
func (*Team) HandleVotingRound ¶
HandleVotingRound manages a complete voting round
func (*Team) ListTaskOutputs ¶
func (t *Team) ListTaskOutputs() []*tasks.TaskOutput
ListTaskOutputs returns all stored task outputs
func (*Team) QueryTaskOutputs ¶
func (t *Team) QueryTaskOutputs(criteria map[string]interface{}) []*tasks.TaskOutput
QueryTaskOutputs searches for outputs matching the given criteria
func (*Team) RecoverTask ¶
func (t *Team) RecoverTask(ctx context.Context, taskErr *TaskError, strategy RecoveryStrategy) error
RecoverTask attempts to recover from a task error
func (*Team) Remember ¶
func (t *Team) Remember(ctx context.Context, value interface{}, metadata map[string]interface{}) error
Remember stores information in the team's memory
func (*Team) RememberEntity ¶
func (t *Team) RememberEntity(ctx context.Context, name string, entityType memory.EntityType, description string, metadata map[string]interface{}) error
RememberEntity stores entity information in memory
func (*Team) SaveMemory ¶
func (t *Team) SaveMemory(value string, metadata map[string]interface{}, source string, scope memory.MemoryScope) error
SaveMemory saves a memory item to both short-term and long-term storage
func (*Team) ShareMemory ¶
func (t *Team) ShareMemory(ctx context.Context, source string, value interface{}, targets []string, metadata map[string]interface{}) error
ShareMemory shares a memory context with other agents
func (*Team) ValidateProcess ¶
ValidateProcess checks if the team is properly configured for its process type
type TeamOption ¶
type TeamOption func(*Team)
TeamOption defines functional options for configuring a team
func WithManager ¶
func WithManager(manager *agents.Agent) TeamOption
WithManager sets the manager for the team
func WithManagerConfig ¶
func WithManagerConfig(config ManagerConfig) TeamOption
WithManagerConfig sets custom manager configuration
func WithMemory ¶
func WithMemory(enabled bool) TeamOption
WithMemory enables memory capabilities for the team
type Vote ¶
type Vote struct { AgentID string Decision string // "APPROVE" or "REJECT" Rationale string Timestamp time.Time }
Vote represents a single agent's vote
type VotingConfig ¶
type VotingConfig struct { // Minimum percentage of votes needed to reach consensus (0-100) ConsensusThreshold int // Maximum number of voting rounds before escalating MaxRounds int // Whether to require unanimous agreement RequireUnanimous bool // How to handle ties TieBreaker string // Format for vote responses VoteFormat string }
VotingConfig defines configuration for consensus voting
type VotingSession ¶
type VotingSession struct { TaskID string Config VotingConfig Votes []Vote Round int StartTime time.Time // contains filtered or unexported fields }
VotingSession manages voting for a specific task
func NewVotingSession ¶
func NewVotingSession(taskID string, config VotingConfig) *VotingSession
NewVotingSession creates a new voting session
func (*VotingSession) CastVote ¶
func (vs *VotingSession) CastVote(agentID, decision, rationale string) error
CastVote adds a vote to the session
func (*VotingSession) GetVotingResults ¶
func (vs *VotingSession) GetVotingResults() (bool, float64, error)
GetVotingResults calculates current voting results