- Marked the Executor Stub Enhancement section in TODO.md as complete, detailing the enhancements made to the executor's functionality. - Improved the Executor to simulate full execution with Job integration, including phase transitions and logging. - Introduced a Config struct for customizable executor behavior, allowing for testing with callbacks and job integration control. - Implemented phase-specific methods for modular execution, preparing for future real phase implementations. - Added comprehensive tests for the executor, including smoke tests and verification of phase progression and job logs. - Updated progress tracking in TODO.md to reflect the current status of the executor and integration testing.
48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
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
|
|
}
|