Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSchedule ¶
func NewSchedule(cfg ScheduleConfig, deps ScheduleDeps) (agentkit.Tool, error)
NewSchedule registers tool/schedule: Let the agent list, add and remove its own cron jobs.
Best practices:
- Ids are assigned by the registry (agent-1, agent-2, ...); read them back with op=list before op=remove.
- Needs a schedule registry that schedule/cron also uses, or nothing will fire the jobs.
- Slash: /cron lists jobs for the current channel; /cron remove <id> cancels one.
Types ¶
type ScheduleConfig ¶
type ScheduleConfig struct {
// MaxJobs is cap on agent-created jobs, default 32; jobs declared in config do not count against it.
MaxJobs int `json:"maxJobs"`
}
type ScheduleDeps ¶
type ScheduleEntry ¶
type ScheduleEntry struct {
ID string `json:"id"`
Kind string `json:"kind"`
Cron string `json:"cron,omitempty"`
In string `json:"in,omitempty"`
FireAt string `json:"fireAt,omitempty"`
Prompt string `json:"prompt"`
Source string `json:"source"`
Note string `json:"note,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Fired bool `json:"fired,omitempty"`
FiredAt string `json:"firedAt,omitempty"`
LastError string `json:"lastError,omitempty"`
NextRun string `json:"nextRun,omitempty"`
}
ScheduleEntry is one job as reported to the model, with the next fire time resolved so the agent can reason about it without parsing cron itself.
type ScheduleInput ¶
type ScheduleInput struct {
Op string `json:"op" jsonschema:"list to see the schedule; add to create a job; remove to delete one"`
Kind string `` /* 133-byte string literal not displayed */
Cron string `` /* 134-byte string literal not displayed */
In string `json:"in,omitempty" jsonschema:"Relative delay for kind=delay, e.g. 30s, 1m, 2h, 1h30m"`
At string `json:"at,omitempty" jsonschema:"Absolute fire time for kind=at, e.g. RFC3339 or local 2006-01-02T15:04:05"`
Prompt string `json:"prompt,omitempty" jsonschema:"The task to run when the schedule fires; required for add"`
ID string `json:"id,omitempty" jsonschema:"Job id; required for remove"`
Note string `json:"note,omitempty" jsonschema:"Optional context for your future self"`
IncludeFired bool `json:"includeFired,omitempty" jsonschema:"Include fired one-shot jobs in list output"`
}
type ScheduleOutput ¶
type ScheduleOutput struct {
Jobs []ScheduleEntry `json:"jobs"`
Instruction string `json:"instruction,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.