types.go
1 package agents 2 3 import ( 4 "context" 5 "time" 6 7 "github.com/TransformerOS/kamaji-go/internal/tools" 8 "github.com/TransformerOS/kamaji-go/internal/types" 9 ) 10 11 // IntelligenceLevel defines the sophistication level of an agent 12 type IntelligenceLevel int 13 14 const ( 15 // Basic - Simple task execution with minimal reasoning 16 Basic IntelligenceLevel = iota 17 // Intermediate - Multi-step reasoning with tool chaining 18 Intermediate 19 // Advanced - Complex problem solving with memory and learning 20 Advanced 21 // Expert - Domain-specific expertise with deep reasoning 22 Expert 23 // Master - Transcendent wisdom with artistic and philosophical depth 24 Master 25 // Autonomous - Self-improving with goal decomposition 26 Autonomous 27 ) 28 29 // AgentCapability defines what an agent can do 30 type AgentCapability struct { 31 Name string 32 Description string 33 Tools []string 34 MinLevel IntelligenceLevel 35 } 36 37 // AgentPersonality defines behavioral traits 38 type AgentPersonality struct { 39 Name string 40 Traits []string 41 Tone string 42 Approach string 43 Specialties []string 44 } 45 46 // AgentMetrics tracks performance and learning 47 type AgentMetrics struct { 48 TasksCompleted int64 49 SuccessRate float64 50 AverageTime time.Duration 51 LearningScore float64 52 ExpertiseLevel float64 53 UserSatisfaction float64 54 LastImprovement time.Time 55 } 56 57 // SpecializedAgent represents a domain-specific intelligent agent 58 type SpecializedAgent struct { 59 ID string 60 Name string 61 Type string 62 Level IntelligenceLevel 63 Personality AgentPersonality 64 Capabilities []AgentCapability 65 Tools []tools.Tool 66 Memory types.Memory 67 Metrics AgentMetrics 68 Config AgentConfig 69 Status types.AgentStatus 70 LLM types.LLMProvider 71 } 72 73 // AgentConfig defines agent behavior parameters 74 type AgentConfig struct { 75 MaxIterations int 76 Timeout time.Duration 77 EnableMemory bool 78 EnableLearning bool 79 Verbose bool 80 SelfImprovement bool 81 CollaborationMode bool 82 CreativityLevel float64 83 RiskTolerance float64 84 PrecisionLevel float64 85 } 86 87 // TaskContext provides context for agent execution 88 type TaskContext struct { 89 UserID string 90 SessionID string 91 Priority int 92 Deadline *time.Time 93 Resources map[string]interface{} 94 Constraints []string 95 Goals []string 96 History []TaskResult 97 } 98 99 // TaskResult represents the outcome of an agent task 100 type TaskResult struct { 101 TaskID string 102 AgentID string 103 Success bool 104 Result string 105 Duration time.Duration 106 ToolsUsed []string 107 Reasoning []string 108 Confidence float64 109 Improvements []string 110 Timestamp time.Time 111 } 112 113 // Agent interface defines the contract for all agents 114 type Agent interface { 115 // Core execution 116 Execute(ctx context.Context, task string, context TaskContext) (TaskResult, error) 117 ExecuteStream(ctx context.Context, task string, context TaskContext) (<-chan types.StreamChunk, error) 118 119 // Intelligence and learning 120 Learn(feedback TaskResult) error 121 Improve() error 122 GetIntelligenceLevel() IntelligenceLevel 123 124 // Capabilities 125 GetCapabilities() []AgentCapability 126 CanHandle(task string) (bool, float64) 127 128 // Collaboration 129 Collaborate(other Agent, task string) (TaskResult, error) 130 Delegate(subtask string, targetAgent Agent) (TaskResult, error) 131 132 // Management 133 GetMetrics() AgentMetrics 134 GetStatus() types.AgentStatus 135 Configure(config AgentConfig) error 136 Close() error 137 } 138 139 // AgentFactory creates specialized agents 140 type AgentFactory interface { 141 CreateAgent(agentType string, level IntelligenceLevel, config AgentConfig) (Agent, error) 142 ListAvailableTypes() []string 143 GetAgentCapabilities(agentType string) []AgentCapability 144 } 145 146 // AgentOrchestrator manages multiple agents 147 type AgentOrchestrator interface { 148 RegisterAgent(agent Agent) error 149 RouteTask(task string, context TaskContext) (Agent, error) 150 ExecuteWithBestAgent(ctx context.Context, task string, context TaskContext) (TaskResult, error) 151 GetAgentRecommendations(task string) []Agent 152 }