Creating AI Workers that Run on a Schedule

Need to regularly fetch data, process information, or update reports? In this tutorial, we'll create a worker that automatically fetches wind speed data and stores it in a database. This pattern can be used to create workers that:

  • Monitor websites for changes
  • Update dashboards periodically
  • Generate regular reports
  • Process data on a schedule
  • Keep information synchronized

Creating the Worker

  1. Click the "+ New Worker" button in the Workers tab
  2. Enter this system prompt:
You will be run every 12 hours. Fetch wind speed vs altitude from:

https://aviationweather.gov/cgi-bin/data/windtemp.php?region=mia&fcst=06&level=low

Insert all the values in a database called "wind-speed" in this project.
  1. Click "Save"

Setting Up the Schedule

  1. Click the "Schedule" button
  2. Set the schedule to run:
    • Every 12 hours
  3. Click "Save"

That's it!

You've just created an AI worker that will:

  • Fetch unstructured data from a webpage
  • Parse the wind speed information
  • Store it in a structured database
  • Repeat this every 12 hours

Understanding What's Happening

When you visit the URL directly, you see unstructured text like this:

FT  3000    6000    9000   12000   18000   24000  30000  34000  39000 
MIA  1519   1826    2030   2236    2648    2957   3260   3459   3557
FLL  1520   1827    2031   2236    2648    2957   3260   3459   3557
PBI  1521   1828    2032   2236    2648    2957   3260   3459   3557
...


The worker automatically:

  1. Understands this is a table of wind speeds at different altitudes
  2. Extracts the relevant data points
  3. Creates a structured database to store them
  4. Updates this data every 12 hours

Testing It Out

  1. Click "Run Worker" to test it immediately
  2. Check the "wind-speed" database to see the structured data
  3. Watch as new data points are added on schedule

Next Steps

Now that you know how to create scheduled workers, try:

  • Create a compute task to visualize the data in a plot
  • Modifying the schedule for different intervals
  • Creating workers that process different data sources
  • Building automated reports from the collected data
  • Setting up alerts for specific conditions

Related Links