package executor import ( "github.com/yaoapp/yao/agent/robot/types" ) // RunLearning executes P5: Learning phase // // Extracts learnings from execution and saves to private KB. // Learning types: execution (what worked), feedback (errors), insight (patterns). // // Implementation (TODO Phase 9): // 1. Build prompt with execution summary // 2. Call Learning Agent via Assistant.Stream() to extract learnings // 3. Save learning entries to private KB func (e *Executor) RunLearning(_ *types.Context, exec *types.Execution, _ interface{}) error { // TODO (Phase 9): Replace with real learning // agentID := robot.Config.Resources.GetPhaseAgent(types.PhaseLearning) // messages := buildLearningMessages(exec, robot) // response, err := callAgentStream(ctx, agentID, messages) // if err != nil { // return err // } // exec.Learning = parseLearningEntries(response) // err = saveLearningToKB(ctx, robot, exec.Learning) // if err != nil { // return err // } // Simulate Agent Stream delay e.simulateStreamDelay() // Generate mock learning entries exec.Learning = []types.LearningEntry{ { Type: types.LearnExecution, Content: "Execution completed successfully with all tasks passing. Total duration within expected range.", Tags: []string{"success", "performance"}, }, { Type: types.LearnInsight, Content: "Task execution order optimization: Running data analysis before report generation improves efficiency.", Tags: []string{"optimization", "workflow"}, }, } return nil }