MCPcopy
hub / github.com/mudler/LocalAGI / NewTask

Function NewTask

core/scheduler/task.go:79–98  ·  view source on GitHub ↗

NewTask creates a new task with the given parameters

(agentName, prompt string, scheduleType ScheduleType, scheduleValue string)

Source from the content-addressed store, hash-verified

77
78// NewTask creates a new task with the given parameters
79func NewTask(agentName, prompt string, scheduleType ScheduleType, scheduleValue string) (*Task, error) {
80 task := &Task{
81 ID: uuid.New().String(),
82 AgentName: agentName,
83 Prompt: prompt,
84 ScheduleType: scheduleType,
85 ScheduleValue: scheduleValue,
86 Status: TaskStatusActive,
87 CreatedAt: time.Now(),
88 UpdatedAt: time.Now(),
89 ContextMode: "agent",
90 Metadata: make(map[string]interface{}),
91 }
92
93 if err := task.CalculateNextRun(); err != nil {
94 return nil, err
95 }
96
97 return task, nil
98}
99
100// CalculateNextRun calculates the next run time based on schedule type
101func (t *Task) CalculateNextRun() error {

Callers 3

scheduler_test.goFile · 0.92
RunMethod · 0.92
RunMethod · 0.92

Calls 2

CalculateNextRunMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…