Skip to main content
Schedule lets you create timed executions for your agents — from code or from the agent itself during a conversation. When a user says “remind me tomorrow at 9am”, the agent can create that schedule automatically using built-in tools.

Quick Start: Agent with Schedule

Give your agent the ability to create schedules:
Now the agent handles conversations like:
User: “Me chama amanha as 9h pra eu enviar o relatorio” Agent: uses create_schedule tool — Schedule “Lembrete relatorio” created. I’ll remind you tomorrow at 09:00.

What createScheduleTools() Returns

This function returns an object with 4 independent tools. You choose which ones to give your agent — don’t spread all tools blindly.

Choosing the Right Tools

createScheduleTools() returns: Pick only the tools your agent actually needs:
Security: schedules are scoped per agent, not per user. The list_schedules tool returns all active schedules for the agent — including schedules created by other users. If user A creates a reminder and user B asks “what are my reminders?”, the agent will show user A’s schedules too.Only give list_schedules, update_schedule, and cancel_schedule to agents where this is acceptable (e.g., internal admin bots, single-user agents, or agents where all users share the same context). For multi-user agents, prefer giving only create_schedule.

Tool Details

create_schedule

Creates a new scheduled execution. The LLM fills in the parameters based on the user’s request. Input schema: Returns: "Schedule created successfully. ID: {id}, Name: {name}, Type: {type}, Status: {status}"

list_schedules

Lists all active schedules for the current agent. Takes no parameters. Returns: A formatted list of all schedules with ID, name, type, status, and message — or "No schedules found."

update_schedule

Updates an existing schedule. Only the fields you provide are changed. Input: id (required) + any field from create_schedule (optional). Returns: "Schedule updated successfully. ID: {id}, Name: {name}, Status: {status}"

cancel_schedule

Permanently deletes a schedule. Input: id (required). Returns: "Schedule {id} has been cancelled and deleted successfully."
The LLM decides which tool to call based on the conversation. You don’t need to write any routing logic — the tool descriptions guide the model. For example, when a user says “change my reminder to 10am”, the LLM will call list_schedules first to find the ID, then update_schedule with the new time.

How It Works End-to-End

Understanding the full lifecycle is important. Here’s what happens from creation to execution:

Step-by-step breakdown

Creation (steps 1-4): When the agent calls create_schedule, the SDK sends the configuration to the Runflow API. The API creates a SCHEDULER trigger in the database with the cron expression, next run time, and the message payload. Scheduling (step 5): The Runflow trigger engine runs a periodic job (every minute) that queries the database for triggers where nextRun <= now. This is powered by the trigger-engine service. Execution (steps 6-7): When a trigger is due, the trigger engine sends an HTTP POST to the agent’s endpoint with a payload containing the schedule data. The agent processes the message field as if it were a new conversation input. Response (step 8): The agent’s response is delivered through the configured channel (API response, webhook, WhatsApp, etc.) depending on how the agent is deployed.

What the Agent Receives When a Schedule Fires

When a scheduled trigger fires, your agent receives an AgentInput with the schedule’s message as the input, plus metadata about the trigger:
This means:
  • The message field is what drives the agent’s behavior. Write it as if you were sending a chat message to the agent. The agent processes it with all its tools, RAG, and memory — just like a regular conversation.
  • The metadata lets you know this was a scheduled execution (not a user message), which is useful for logging or conditional logic in tools.

Example: Agent Reacting to a Scheduled Message

Conversation Context (Automatic)

When an agent creates a schedule during a conversation where identify() is active, the SDK automatically captures the conversation context (entityType, entityValue, sessionId) and stores it in the trigger. When the schedule fires, this context is injected back into the agent input — so memory loads and the agent resumes the conversation.
main.ts
No extra code from the developer. The create_schedule tool captures and the trigger engine restores — the agent doesn’t know the difference between a live message and a scheduled callback.
One-time vs recurring: When the LLM creates a schedule from a request like “call me tomorrow”, it must set maxExecutions: 1 — otherwise the schedule fires every day forever. The tool description guides the LLM to do this, but you should also reinforce it in your agent’s instructions:
See the SDR Agent with Scheduled Follow-ups use case for a complete working example with lead qualification, scheduled callbacks, and inactive lead follow-ups.

Programmatic API

Use the schedule object directly in your code — useful for creating schedules in workflows, during deployment, or from external triggers:

Create a Schedule

List, Update, Cancel

Schedule Types

Interval

Runs every N minutes, starting from the moment it’s created:

Daily

Runs at a specific time every day in the given timezone:

Cron

Full cron expression support for advanced scheduling:
Common cron patterns:

The message Field: Designing Good Schedules

The message is the most important field — it’s literally what the agent “hears” when the schedule fires. Write it as a clear instruction:
Think of message as the system prompt for that specific execution. The more context you give, the better the agent performs.

Using in Workflows

Combine schedules with workflows to create automated follow-up sequences:

Configuration Reference

Schedule Isolation and Security

Schedules are scoped to the agent, not to the user. This has important implications:
  • An agent can only see schedules belonging to itself (not other agents). This is enforced at the API level using the agent ID from the SDK authentication context.
  • All users of the same agent share the same schedule pool. If user A creates a daily reminder and user B calls list_schedules, user B will see user A’s reminder.
  • update_schedule and cancel_schedule can modify any schedule on that agent — including schedules created by other users.

Best Practices

  1. For multi-user agents (customer-facing bots, support agents): only include create_schedule. Don’t expose list_schedules, update_schedule, or cancel_schedule — a user could see or delete another user’s schedules.
  2. For single-user or internal agents: you can safely include all tools since there’s no cross-user risk.
  3. For admin agents: use all tools with observability: 'full' to track who creates, modifies, or cancels schedules.

Next Steps

Web Search

Give agents internet search capabilities

Connectors

Connect to external APIs

Observability

Track schedule executions and metrics

Tools

Create custom tools for scheduled tasks