# Which Jobs Next Week Leave No Time to Drive? Field-Service Software That Checks Each Technician's Microsoft 365 Calendar

Home-services scheduling software makes one agent per technician that reads next week's Outlook calendar on Sunday and lists overlapping or too-tight jobs.

[Run this on Rush](https://cloud.getrush.ai/run/find-back-to-back-jobs-without-travel-time/microsoft-calendar/). Opens the console with this prompt ready to send. Connect Microsoft Calendar there first.

## What the agent does

This is for a company that sells scheduling software to home-service businesses: house cleaners, pest control, appliance repair, small HVAC outfits. Their office staff book jobs into the software, but many technicians also keep their week in their own Microsoft 365 calendar, where a dentist appointment, a supplier pickup or a job a customer called them about directly lands without the office knowing. The result is Tuesday at 10:00 in one town and 10:15 across the county, or two jobs on top of each other. The software adds a Sunday Week check per technician, written by an agent that reads that technician's own calendar.

The company saves the agent once as a template with `POST /o/{org}/agents`, with `"connections": ["microsoft-calendar"]` (it connects a Microsoft calendar of its own first, because a template names connections its creator has). When a technician turns the check on in the app, the backend calls `POST /o/{org}/agents {"template": "<template id>", "name": "week-<technician id>"}`, then `POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "microsoft-calendar"}`, and opens the `authorize_url` in a popup while the technician is signed in. They sign in on Microsoft's own page to Rush's app, so the company registers no Azure application, and the agent reaches Microsoft Graph signed from outside its computer.

On a run the agent calls `GET /me/calendarView` with `startDateTime` and `endDateTime` for Monday to Saturday, each with the business's UTC offset, and the `Prefer: outlook.timezone` header so times come back in local time; Microsoft documents that the calendar view returns each occurrence of a recurring event, so a weekly standing appointment is counted on each day. It asks with `$select` for `subject`, `start`, `end`, `location`, `isAllDay`, `isCancelled`, `showAs` and `categories`, and follows `@odata.nextLink` until there are no more pages. The software files its own bookings in the category `Job`, which is how the agent tells a booked job from everything else.

For each day it puts the events in order, drops cancelled ones and anything marked `free`, and checks each pair that follows: two events that overlap; two jobs at different addresses with less than the business's minimum gap between one's end and the next one's start; a job with no `location`; and a job that ends after the technician's working hours. Each finding names both events, their times and their locations. The agent reads only. The Microsoft sign-in can create and change events, and the prompt forbids every call that is not a `GET`.

## Start it with one API call

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

```json
{
  "agent": "<agent id>",
  "input": "Check my calendar for Monday 2026-11-23 to Saturday 2026-11-28. Working hours 07:30-17:30, time zone America/Chicago, minimum gap between jobs at different addresses 30 minutes. Use Microsoft Graph, GET requests only. 1) GET /me/calendarView with startDateTime 2026-11-23T00:00:00-06:00 and endDateTime 2026-11-29T00:00:00-06:00, header Prefer: outlook.timezone=\"Central Standard Time\", $select=subject,start,end,location,isAllDay,isCancelled,showAs,categories, $top=100, following @odata.nextLink. 2) Drop events with isCancelled true or showAs free. Events with category Job are jobs. 3) For each day in order flag: any two events that overlap; two jobs with different location addresses less than 30 minutes apart (end to next start); a job with no location; a job ending after 17:30. Write week-check.md by day (each finding: what, both events' subjects, times and locations) and week-check.json: [{date, kind, events: [{subject, start, end, location}]}]. Do not create, update, accept, decline or delete any event."
}
```

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 `week-check.md` and `week-check.json` as artifacts. The software's webhook handler puts the findings on the technician's Monday view and on the office's dispatch board, each pair of clashing events side by side with their times and addresses.

What the office checks before calling anyone: whether two jobs flagged as too close are really far apart, since the agent compares addresses and times and does not measure the drive; whether a personal appointment that overlaps a job can move, which only the technician knows; and whether a job with no address is one the office booked or one the technician added. The office moves jobs in the software, which updates the calendar as it always does. The check never moves anything itself.

## Run it on every Sunday evening, per technician

The software's scheduler sends one `POST /o/{org}/sessions` per technician with the check on, at 18:00 on Sunday in the business's time zone, with that technician's agent id as `agent`, the week's dates, working hours and the business's minimum gap in `input`, and a `request_id` that is a UUID v5 of the technician id and the week, so a retried job starts no second run. Runs past the key's `max_concurrent` wait as `queued`, and the key's webhook delivers each `run.completed`.

When the office books a job on Wednesday for Thursday, the software can send the same request for the next two days only, so a late booking is checked against the technician's calendar the moment it is made.

## Why run it on Rush?

Each technician's Microsoft sign-in is their own and lives in Rush's connection under their agent, so the software keeps no Graph tokens and runs no Azure app registration, and one technician's agent cannot read another's calendar. Each session's `accounts` names the Microsoft account it used, which the software can show a technician who asks what was read.

Each run has its own computer, a record of every Graph request it made and the cost of its model calls. A business with forty technicians gets forty runs on Sunday evening at once, each separate, and the software adds up what the check costs per business from each agent's sessions.

## Frequently asked questions

### Does the agent work out driving time?

No. It compares the addresses and the gap between events against the minimum the business sets. A business that wants a different gap for jobs in the same neighbourhood can send pairs of service areas and their gaps in `input`.

### Could the agent change a technician's calendar?

The Microsoft Calendar connection asks Microsoft for `Calendars.ReadWrite`, so it could. The template's instructions and every prompt allow only `GET` requests, and the run's record lists every request it sent.

### What about recurring appointments?

Microsoft documents that `calendarView` returns the occurrences, exceptions and single instances of events in the range, so a weekly standing appointment appears on each day it falls and is checked like any other event.

### Does the technician need a Rush account?

No. They sign in to Microsoft only, from the popup in the software. Their agent, its runs and their cost belong to the person at the software company who created the API key.

## More Microsoft Calendar jobs

- [Which Managed IT Clients Are Due a Quarterly Business Review? Read It From Outlook Calendar](https://getrush.ai/run/find-clients-due-a-business-review/microsoft-calendar/)
- [How Can Recruiting Software Find Next Week's Interviews a Candidate Hasn't Accepted? One Agent per Recruiter, Reading Their Microsoft Calendar](https://getrush.ai/run/find-interviews-the-candidate-has-not-accepted/microsoft-calendar/)
- [Time Audit From a Microsoft Calendar Each Month](https://getrush.ai/run/monthly-time-audit-for-each-coaching-client/microsoft-calendar/)

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

- [Which of Last Week's Email Campaigns Drove Unsubscribes? A Retention App Checks Each Store's Klaviyo Every Monday](https://getrush.ai/run/find-campaigns-that-drove-unsubscribes/klaviyo/)
- [How Can a Tutoring Company Find Cancelled Lessons Nobody Rebooked? One Agent per Tutor, Reading Their Google Calendar Each Week](https://getrush.ai/run/find-cancelled-lessons-not-yet-rebooked/google-calendar/)
- [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/)

## Keep reading

- [Connect Microsoft Calendar to Rush once, then name it on any run](https://getrush.ai/integrations/microsoft-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/)
