Skip to content

Schedule an agent

Page as Markdown

Create a schedule in the kagent UI that runs your agent automatically with a prompt that you choose.

Schedule an agent

Create a schedule in the kagent UI that runs your agent automatically with a prompt that you choose.

About this tutorial

A schedule runs an agent automatically, at times that you choose, with a prompt that you write. Each run starts a new conversation with the agent. In this tutorial, you schedule the personal assistant to write a plan for your day every morning. A schedule is not a Kubernetes resource. kagent keeps it in its database. For how schedules work, see Scheduled runs.

Time: about 5 minutes.

Before you begin

  1. Complete Build an agent, so that the personal-assistant agent exists.

Schedule the agent

Create and manage the schedule in the kagent UI, or with the kagent API.

Open the kagent UI

kagent dashboard

The command forwards the UI to http://localhost:8082 and opens it in your browser. Leave it running while you work.

Create the schedule

The kagent UI creating a daily schedule named morning-brief for the personal-assistant agent
Figure: Creating a daily schedule for the agent, sped up
  1. In the sidebar, click Schedules, and then click New Schedule.

  2. From the Agent list, choose kagent/personal-assistant.

  3. In the Name field, enter morning-brief.

  4. Set when the schedule runs.

    FieldValue
    Time zoneUTC, or your own time zone. The schedule follows daylight-saving changes in the time zone that you choose.
    RepeatDaily. The other choices are every few minutes, hourly, weekly, monthly, and a custom schedule.
    At time09:00
  5. In the Prompt field, enter the message that each run sends to the agent, such as Give me a short plan for today: three priorities and one reminder to take a break.

  6. Leave Enable Schedule on, and click Create schedule.

The page of the schedule shows its status, the next execution in your local time, and an Execution history table that fills in as the schedule runs.

Run, pause, or change the schedule

Use the buttons at the top of the page of the schedule.

ButtonAction
RunStart a run now, without waiting for the next scheduled time.
PauseStop future runs until you resume the schedule.
EditChange the agent, the times, or the prompt.

Each row of the Execution history table links to the conversation of that run.

Verify the schedule

  1. In the kagent UI, click Schedules, and open morning-brief. The page shows the schedule as enabled, with its next execution in your local time.

  2. Click Run to start a run now.

  3. Check that the Execution history table lists the run, and click its link to read the plan that the agent wrote.

What you built

A schedule that starts a conversation with the personal assistant every morning. Along the way, you used these features:

FeatureWhat you didRead more
Scheduled runsCreated a daily schedule with a time zone and a prompt, and ran it on demandScheduled runs

Clean up

  1. Delete the schedule. In the kagent UI, click Schedules, and delete morning-brief. With the API, call DeleteScheduledRun, as described in Scheduled runs.

    To keep the schedule but stop its runs, click Pause on its page instead.

Next steps