# Building AI Agents that Run on a Schedule

{% 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
