Scheduler
Let agents create and manage recurring schedules through natural language.
SchedulerTools gives an agent natural-language control over the AgentOS Scheduler. It wraps ScheduleManager so an agent can create, list, enable, disable, and delete cron-based schedules in response to prompts like "Run a daily health check at 9am".
Prerequisites
Install the scheduler extras:
1uv pip install "kern-ai[scheduler]"SchedulerTools persists schedules to the same database your AgentOS uses. For scheduled tasks to actually execute, run an AgentOS instance with scheduler=True pointed at that database. See the Scheduler overview for the AgentOS setup.
Example
1from kern.agent import Agent2from kern.models.openai import OpenAIChat3from kern.tools.scheduler import SchedulerTools45agent = Agent(6 model=OpenAIChat(id="gpt-4o"),7 tools=[8 SchedulerTools(9 db=scheduler_db,10 default_endpoint="/agents/my-agent/runs",11 )12 ],13)1415agent.print_response("Run a health check every morning at 9am.")Re-creating a schedule with the same name updates it instead of erroring (if_exists="update").
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
db | Any | - | Database adapter implementing scheduler methods |
default_endpoint | Optional[str] | None | Default API endpoint to invoke on each run |
default_method | str | "POST" | HTTP method for scheduled requests |
default_timezone | str | "UTC" | Timezone used for cron expressions |
default_payload | Optional[Dict] | None | Default request payload (e.g. {"message": "..."}) |
Toolkit Functions
| Function | Description |
|---|---|
create_schedule | Create a recurring schedule from a cron expression |
list_schedules | List existing schedules |
get_schedule | Fetch a schedule by ID |
delete_schedule | Permanently remove a schedule |
enable_schedule | Activate a disabled schedule |
disable_schedule | Pause a schedule without deleting it |
get_schedule_runs | Retrieve execution history for a schedule |
All functions have sync and async variants.