> For the complete documentation index, see [llms.txt](https://university.mindstudio.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://university.mindstudio.ai/video-courses/2-workflow-mastery/building-ai-agents-that-run-on-a-schedule.md).

# Building AI Agents that Run on a Schedule

This guide walks you through building a website monitoring agent that checks for changes daily and sends an email if updates are detected.

{% embed url="<https://youtu.be/pIIu2LuJR8g>" %}

MindStudio enables you to schedule AI agents to run automatically at specific times. This is useful for automating repetitive workflows like monitoring web content, generating reports, or triggering notifications without manual input.

## Use Case: Website Change Tracker

In this example, we’ll build an AI agent that checks for changes on a website (e.g. OpenAI’s news page) each morning and emails a summary of those changes.

### Step 1: Add the “Track Website Changes” AI Module

* Create a new workflow and add the **Track Website Changes** module.
* In the configuration panel:
  * Enter the target URL (e.g., `https://openai.com/blog`).
  * Use the default variable names unless you need to customize them.
  * Set a **Detection Prompt**, such as:\
    `Any changes to the main content of the website. Specifically, we are looking for new news stories.`

### Step 2: Handle Detected Changes

You’ll configure two outcomes:

* **No Changes:** Route to an **End Workflow** block.
* **Changes Detected:** Route to a **Send Email** block.

In the **Send Email** block:

* Connect your email account via the integrations menu (gear icon).
* Set a subject like:\
  `Changes Detected on OpenAI News`
* Use the `{{changes}}` variable as the email body to show the summary of detected content updates.

### Step 3: Set the Schedule

Click the **Start Block**, and in the **Trigger** section on the right:

1. Change the **Run Mode** from “On Demand” to **Scheduled**.
2. Click **Add** to define your schedule.
3. Use natural language or presets like:\
   `Every morning at 9:00 AM`
4. Set your **Time Zone**, e.g., `America/Los_Angeles`.
5. Click **Generate Schedule**, then **Save**.

The agent will now run automatically each morning.

## Step 4: Preview & Test

Use the **Preview** button and run the agent in the **Debugger**:

* On the first run, it will detect all visible content (no baseline exists yet).
* On subsequent runs, it will only email you if changes are detected.

## Summary

Scheduled AI agents are powerful for automating:

* News monitoring
* Report generation
* Notifications
* Daily or weekly workflows

To configure:

1. Use the **Track Website Changes** module.
2. Send detected changes via **Email**.
3. Set the **schedule** from the Start block.

You now have a self-running AI agent that keeps you informed—automatically, every day.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://university.mindstudio.ai/video-courses/2-workflow-mastery/building-ai-agents-that-run-on-a-schedule.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
