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 Agent
2from kern.models.openai import OpenAIChat
3from kern.tools.scheduler import SchedulerTools
4
5agent = 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)
14
15agent.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

ParameterTypeDefaultDescription
dbAny-Database adapter implementing scheduler methods
default_endpointOptional[str]NoneDefault API endpoint to invoke on each run
default_methodstr"POST"HTTP method for scheduled requests
default_timezonestr"UTC"Timezone used for cron expressions
default_payloadOptional[Dict]NoneDefault request payload (e.g. {"message": "..."})

Toolkit Functions

FunctionDescription
create_scheduleCreate a recurring schedule from a cron expression
list_schedulesList existing schedules
get_scheduleFetch a schedule by ID
delete_schedulePermanently remove a schedule
enable_scheduleActivate a disabled schedule
disable_schedulePause a schedule without deleting it
get_schedule_runsRetrieve execution history for a schedule

All functions have sync and async variants.

Developer Resources