mirror of
https://github.com/mudler/LocalAGI.git
synced 2026-07-23 18:55:52 -04:00
57023d6386
* Initial plan * Add task scheduler with cron/interval/once support and comprehensive tests Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Add comprehensive documentation for scheduler package Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Add working example demonstrating scheduler usage Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Update .gitignore to exclude example binaries and task files Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Integrate task scheduler into existing reminder system Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Fix scheduler integration and compilation errors Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Remove standalone scheduler example - integrated into agent system Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * Update scheduler README to reflect integration with agent system Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> * replace old reminders logic Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * A task scheduler for each agent Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fixups Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * tests Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fixups Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * change to duration Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
50 lines
1.1 KiB
Go
50 lines
1.1 KiB
Go
package scheduler
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// TaskStore defines the interface for task persistence
|
|
type TaskStore interface {
|
|
// Create adds a new task
|
|
Create(task *Task) error
|
|
|
|
// Get retrieves a task by ID
|
|
Get(id string) (*Task, error)
|
|
|
|
// GetAll retrieves all tasks
|
|
GetAll() ([]*Task, error)
|
|
|
|
// GetDue retrieves tasks that are due for execution
|
|
GetDue() ([]*Task, error)
|
|
|
|
// GetByAgent retrieves all tasks for a specific agent
|
|
GetByAgent(agentName string) ([]*Task, error)
|
|
|
|
// Update updates an existing task
|
|
Update(task *Task) error
|
|
|
|
// Delete removes a task
|
|
Delete(id string) error
|
|
|
|
// LogRun records a task execution
|
|
LogRun(run *TaskRun) error
|
|
|
|
// GetRuns retrieves execution history for a task
|
|
GetRuns(taskID string, limit int) ([]*TaskRun, error)
|
|
|
|
// Close releases resources
|
|
Close() error
|
|
}
|
|
|
|
// AgentExecutor defines the interface for executing agent tasks
|
|
type AgentExecutor interface {
|
|
Execute(ctx context.Context, agentName string, prompt string) (*JobResult, error)
|
|
}
|
|
|
|
// JobResult represents the result of an agent execution
|
|
type JobResult struct {
|
|
Response string
|
|
Error error
|
|
}
|