Scheduler
Let an agent create and manage AgentOS schedules.
SchedulerTools gives an agent natural-language control over the AgentOS Scheduler. It wraps ScheduleManager so an agent can create, list, trigger, enable, disable, delete, and inspect recurring schedules.
Prerequisites
Install the scheduler extras and the openai library:
uv pip install "agno[scheduler]" sqlalchemy "psycopg[binary]" openaiSchedules are stored in the same database used by AgentOS. To execute schedules, run AgentOS with scheduler=True.
The Agent model uses an OpenAI key, separately from any toolkit provider credentials.
Set OpenAI Key
Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.
export OPENAI_API_KEY=sk-***This fragment configures the toolkit; it does not start a server or execute a schedule. Set up the database and serve this agent using the scheduler guide.
Configuration Example
from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.models.openai import OpenAIChat
from agno.tools.scheduler import SchedulerTools
db = PostgresDb(
id="scheduler-tools-demo-db",
db_url="postgresql+psycopg://ai:ai@localhost:5532/ai",
)
scheduler_agent = Agent(
id="scheduler-agent",
name="Scheduler Agent",
model=OpenAIChat(id="gpt-4o-mini"),
tools=[
SchedulerTools(
db=db,
default_endpoint="/agents/scheduler-agent/runs",
default_timezone="UTC",
)
],
instructions=[
"When the user asks for recurring work, create a schedule.",
"Confirm the cron expression and timezone.",
],
db=db,
markdown=True,
)When targeting an AgentOS /runs endpoint, the schedule payload must include a message field.
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
db | Any | - | Database adapter implementing scheduler methods. |
default_endpoint | Optional[str] | None | Endpoint to call when a schedule fires. |
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. |
user_id | Optional[str] | None | Fixed schedule owner; otherwise uses RunContext.user_id. Without either value, operations are unfiltered by user. |
include_agents | Optional[Sequence[Agent]] | None | Live code-defined agents served by this process, used for target validation. |
include_teams | Optional[Sequence[Team]] | None | Live code-defined teams used for target validation. |
include_workflows | Optional[Sequence[Workflow]] | None | Live code-defined workflows used for target validation. |
Toolkit Functions
| Function | Description |
|---|---|
create_schedule | Create or update a recurring schedule from a cron expression. |
list_schedules | List schedules. |
get_schedule | Fetch one schedule by ID. |
delete_schedule | Permanently remove a schedule. |
enable_schedule | Enable a paused schedule. |
disable_schedule | Pause a schedule. |
trigger_schedule | Make a schedule due immediately; the poller performs execution. |
get_schedule_runs | Read schedule execution history. |
All functions have sync and async variants.