# How Can a Tutoring Company Find Cancelled Lessons Nobody Rebooked? One Agent per Tutor, Reading Their Google Calendar Each Week

A tutoring company makes one agent per tutor, signed into the tutor's Google Calendar, that lists last week's cancelled lessons with no new lesson booked.

[Run this on Rush](https://cloud.getrush.ai/run/find-cancelled-lessons-not-yet-rebooked/google-calendar/). Opens the console with this prompt ready to send. Connect Google Calendar there first.

## What the agent does

This is for a tutoring company with a few dozen independent tutors who teach maths, languages and exam prep, mostly one-to-one, each from their own Google Calendar. Families cancel for illness, school trips and exams, and the tutor agrees to "find another time". Half the time nobody does: the student drifts, the family stops paying, and the company learns about it at renewal. The company's tutor app saves one agent as a template, makes one agent from it per tutor signed into that tutor's own Google Calendar, and every Monday each tutor gets a short list of last week's cancelled lessons whose student has nothing booked in the next three weeks.

The company connects its own Google Calendar first and saves the template with `POST /o/{org}/agents`, naming `google-calendar` in `connections`. When a tutor joins, the app calls `POST /o/{org}/agents {"template": "<template id>", "name": "rebook-<tutor id>"}` and `POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "google-calendar"}`, and opens the `authorize_url` for the tutor to sign in on Google's own page. Rush's Google Calendar sign-in asks for reading calendars and for events, and the app's prompt tells the agent to read only. The app keeps the agent id against the tutor.

On a run the agent calls the Calendar API's `events.list` on the tutor's primary calendar for the last seven days with `showDeleted=true` and `singleEvents=true`. Google's reference says `showDeleted` includes deleted events "with `status` equals `cancelled`", and `singleEvents` expands a weekly lesson series into its instances, so one cancelled Tuesday out of a recurring series shows up as its own event. When a cancelled instance does not carry the title or the attendees, the agent uses its `recurringEventId` and `originalStartTime`, which Google's reference defines for every instance of a recurring event, to find the series it belonged to and reads the student's email from that series' `attendees`. It keeps only events that look like lessons by the rule in the request, such as a title that starts with "Lesson:".

For each cancelled lesson it then calls `events.list` again for the next 21 days with `q` set to the student's email, which Google's reference says searches attendee emails as well as the title and description, and `orderBy=startTime`. A student with a confirmed lesson ahead is dropped from the list; a student with nothing, or only a lesson they have declined (`responseStatus` `declined` on their attendee entry), stays on it. The agent writes the list per student with the cancelled date, the subject, the last lesson they attended, and a two-line rebooking note in the tutor's voice. It creates, changes and deletes no event.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "<agent id>",
  "input": "Weekly rebooking check for this tutor. Time zone Europe/London. Today is Monday 2026-11-23. On the primary calendar, call events.list with timeMin 2026-11-16T00:00:00Z, timeMax 2026-11-23T00:00:00Z, showDeleted=true, singleEvents=true. Keep events with status 'cancelled' that are lessons: the title starts with 'Lesson:' (for a cancelled instance with no title, look up its series by recurringEventId and use the series' title and attendees). For each, take the student's email from attendees (not the tutor). Then call events.list with timeMin 2026-11-23T00:00:00Z, timeMax 2026-12-14T00:00:00Z, singleEvents=true, orderBy=startTime, q=<student email>. Keep the student on the list only if no future event has status 'confirmed' with that student's responseStatus other than 'declined'. Return JSON only: {students: [{student_email, subject, cancelled_start, last_attended_start, next_booked_start (omit if none), note}]} where note is two friendly sentences the tutor could send to the family offering to rebook, with no dates promised. Read only: never create, update, move or delete an event, and never send anything."
}
```

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 run lists the students whose lesson was cancelled last week with nothing booked ahead, each with a short note offering to rebook. The answer is JSON in the session's `result` and in the `run.completed` webhook the app's API key sends, one entry per student with the subject, the cancelled date and the last lesson they came to. The app shows it on the tutor's Monday screen with a Send button beside each note, and puts a count on the company's own dashboard of students at risk across all tutors.

What the tutor checks before sending: a rebooking agreed outside the calendar, such as a family that said by text they will be back after exams, which the agent cannot see; a lesson the tutor cancelled themselves, where the note should say sorry rather than offer a time; and siblings booked under one parent's email, which can make one student look unbooked. The tutor sends each note from the app, or edits it first.

## Run it on every Monday morning, per tutor

The app's scheduler sends one `POST /o/{org}/sessions` per tutor at seven on Monday morning in the tutor's time zone, with the tutor's agent id as `agent`, last week's dates and the next three weeks in `input`, and a `request_id` that is a UUID v5 of the tutor id and the week, so a retried job does not show a tutor the same list twice.

A company with two hundred tutors starts two hundred small runs on Monday morning. Runs past the API key's concurrent limit wait `queued` and start in turn, and each result arrives on the webhook, so the scheduler sends them all at once and needs no retry loop.

## Why run it on Rush?

Each tutor signs in on Google's own page, and that sign-in belongs to the tutor's agent alone: no run can read another tutor's calendar, and the company's own runs never see a tutor's. A tutor who leaves is one `DELETE /o/{org}/agents/{agent}`, which disconnects their Google account. The session's `accounts` names the calendar each run read, which answers a tutor who asks exactly what the app looked at.

Each run has its own computer and a record of every Calendar call, so when a tutor says a student was listed by mistake, the company opens that session and sees which events the agent read. The `total_cost_usd` of one tutor's sessions shows what the check costs per tutor, which the company can set against one student kept for another term.

## Frequently asked questions

### Why does the agent look at the recurring series for a cancelled lesson?

When one instance of a weekly lesson is cancelled, the instance Google returns may not carry the title or the student. Its `recurringEventId` and `originalStartTime` point to the series and the time it would have started, so the agent reads the student and title from the series rather than skipping the lesson.

### Can the agent book the new lesson itself?

The connection could create events, since Rush's Google Calendar sign-in asks for events access, but this template's prompt forbids it. Booking needs the family to agree a time, and the app already has a booking flow for that; the agent's job is to make sure nobody is forgotten.

### What if a tutor teaches from several calendars?

Name the calendars in the prompt by their ids from the app's settings and the agent runs both searches on each. A tutor who keeps lessons in a calendar the prompt does not name will see those students missed, so the app asks tutors which calendar holds their lessons when they connect.

### Does the agent read the lesson notes in event descriptions?

It reads what `events.list` returns, which includes the description, but the prompt asks only for dates, subjects and the parent's email. A company that wants notes left out entirely can say so in the template's instructions, and every tutor's agent follows the change on its next run.

## More Google Calendar jobs

- [Find Personal-Training Clients With No Next Session Booked in Each Trainer's Google Calendar](https://getrush.ai/run/find-clients-without-a-next-session/google-calendar/)
- [Which Lessons Next Week Clash With a Teacher's Time Off? A Music School's Thursday Check of Its Teachers' Google Calendars](https://getrush.ai/run/find-lessons-that-clash-with-teacher-time-off/google-calendar/)
- [Where Are the Gaps in My Book Next Week? A Salon App Finds Each Stylist's Open Slots From Their Google Calendar](https://getrush.ai/run/find-open-slots-to-fill-next-week/google-calendar/)

## More jobs like this: Run an agent per customer task

- [Which Candidates Emailed Us and Never Heard Back? A Recruiting App's Daily Check of Each Recruiter's Outlook](https://getrush.ai/run/find-candidates-waiting-on-a-reply/outlook/)
- [Which Customers Are Paying Us Slower? Cash-Flow Software That Checks Each Manufacturer's QuickBooks Monthly](https://getrush.ai/run/find-customers-paying-slower/quickbooks/)
- [Which Days Next Week Have Nothing Scheduled? Gym Marketing Software That Checks Each Gym's Buffer Queue Every Friday](https://getrush.ai/run/find-empty-days-in-next-weeks-queue/buffer/)

## Keep reading

- [Connect Google Calendar to Rush once, then name it on any run](https://getrush.ai/integrations/google-calendar/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
