All jobs

Which Lessons Next Week Clash With a Teacher's Time Off? A Music School's Thursday Check of Its Teachers' Google Calendars

A music school's agent reads every teacher's Google Calendar on Thursday and lists next week's lessons that fall during that teacher's time off or another booking.

Run this on RushOpens the console with this prompt ready to send. Connect Google Calendar there first.

What the agent does

This is for a community music school with a dozen part-time teachers and a few hundred weekly lessons. The office books every lesson as a recurring event on the teacher's Google Calendar, titled with the student and instrument. Teachers are working musicians, so they mark gigs, auditions and trips as Out of office in the same calendar, often weeks ahead and without telling the office. The clash surfaces when a family arrives for a 4:30 piano lesson and the teacher is in another city. Every Thursday afternoon an agent finds next week's clashes while there is still time to find a substitute or move the lesson.

Each teacher shares their calendar with the school's office account with permission to see all event details. The office manager connects that account once with POST /me/connections {"type": "app", "name": "google-calendar"} and signs in on Google's page. The Google Calendar connection asks Google for calendar.readonly and calendar.events, so it could create events; the agent only lists them, and the prompt says so.

On a run the agent calls the events list, GET /calendar/v3/calendars/{calendarId}/events, once per teacher's calendar id, with timeMin and timeMax for next Monday to Sunday (each with the school's offset, which Google requires), singleEvents=true so each weekly lesson comes back as that week's instance, orderBy=startTime, and eventTypes set to default and outOfOffice. It follows nextPageToken until there are no more. Lessons are the default events whose summary starts with "Lesson:"; everything else in the teacher's calendar is their own.

For each lesson it checks whether it overlaps one of the teacher's outOfOffice events, or another of their own events that is not marked free (transparency of transparent). Each clash names the lesson, the student, its time, and the event it clashes with by its type and time, but not its title, because a teacher's own events are theirs. For every lesson in a clash it drafts a short note to the family offering a substitute or another time, in the school's voice. It sends nothing and changes no event.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Use the Google Calendar connection, reading only. Check next week, Monday 2026-11-23 to Sunday 2026-11-29, time zone America/New_York. Teacher calendars: ana.ruiz@harmonyhall.example (piano), ben.cho@harmonyhall.example (guitar), dee.martin@harmonyhall.example (voice). For each calendar call GET /calendar/v3/calendars/{calendarId}/events with timeMin 2026-11-23T00:00:00-05:00, timeMax 2026-11-30T00:00:00-05:00, singleEvents true, orderBy startTime, eventTypes default and outOfOffice, following nextPageToken. Lessons are default events whose summary starts with 'Lesson:'. Flag a lesson that overlaps an outOfOffice event or any other event in that calendar whose transparency is not transparent. Write clashes.md by teacher: lesson summary, start and end, and what it clashes with as 'out of office' or 'another event' with its time, never that event's title. Write notes.json: [{teacher, lesson, start, draft}] where draft is a short, warm note to the family offering a substitute teacher or another time this week. Do not create, change or delete any event and do not send anything.",
  "connections": [
    "google-calendar"
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

The session returns clashes.md and notes.json as artifacts, and the answer says how many lessons clash and with which teachers. The office manager reads it on Thursday afternoon, calls or texts the teacher about each clash, and only then decides between a substitute and a new time.

What the office checks first: that the teacher really is away, since an Out of office event left from last year's recurring plan or a gig that was cancelled reads the same; that a substitute plays the right instrument and is free, which the office can see in the substitute's own calendar; and that the family's note offers something the office can deliver. The office moves the lesson in Google Calendar itself and sends the note from the school's email. A lesson booked somewhere other than the teacher's calendar is not in the check.

Run it on every Thursday afternoon

The office manager saves the agent with POST /o/{org}/agents, naming the google-calendar connection and the instructions above with the list of teacher calendars, and adds a console automation on it with a schedule trigger (0 15 * * 4, timezone America/New_York). The saved instructions say "next Monday to Sunday" instead of dates, since a schedule fills nothing into the prompt.

When a new teacher joins, the office adds their calendar to the agent's instructions with a PATCH and the next Thursday's run includes them. In recital weeks, a second automation can run on Monday mornings for the same week.

The use case this job follows, with its automation and trigger: Produce a report or file, no repo.

Why run it on Rush?

The office account can see every teacher's calendar in full, including their private bookings, so its Google sign-in should not sit in a script on the front-desk computer. On Rush it stays in one connection, each run reads with it and nothing else, and the session's accounts names the Google account every run used. The report shows a teacher's own events only as out of office or another event, so the office learns what it needs and no more.

Each Thursday's run has its own computer, a record of every Calendar request it made, and the cost of its model calls. When a family asks why nobody warned them, the run for that week shows whether the clash was there on Thursday or was added afterwards.

Frequently asked questions

What sharing does each teacher's calendar need?

The office account needs to see all event details. With less, the events list cannot tell the agent which events are lessons or which are Out of office, so ask each teacher to share their calendar with the office account at that level.

Why ask for singleEvents?

Google's events list returns a recurring lesson as one event unless singleEvents is true, which expands it into each week's instance. The check needs next week's instance, including any one-off change the office made to it.

Can the agent reschedule the lesson itself?

The connection could create and change events, but the prompt forbids it. Moving a lesson means agreeing a new time with a family and often a substitute, so the agent drafts the note and the office decides and moves the event.

Does it read what a teacher's own events say?

It reads them to find the clash, because Google returns the event with its details, but the report never repeats a teacher's own event titles. Each clash says only out of office or another event, with its time.

More Google Calendar jobs

More jobs like this: Produce a report or file, no repo

Keep reading