What the agent does
This is for a company that sells trip-planning and client software to independent travel advisors: home-based advisors who plan honeymoons, family holidays and small group trips, often affiliated with a host agency. Each advisor's trips live in the app, with every flight, hotel and transfer and its booking reference. When an airline moves a flight or a hotel changes a reservation, the notice goes to the email address the booking was made with, the advisor's Gmail, among dozens of marketing emails from the same suppliers. A flight retimed by three hours can break a connection or a pre-paid transfer, and the advisor who spots it a week before departure has far fewer options than one who spots it the morning it arrives. The app adds a morning list of overnight changes to booked trips, read from each advisor's own inbox.
The company connects a Gmail account of its own and saves the agent once as a template with POST /o/{org}/agents, naming {"name": "gmail", "access": "read"} in connections, so each advisor's sign-in asks Google for gmail.readonly alone. When an advisor turns the feature on, the app's backend calls POST /o/{org}/agents {"template": "<template id>", "name": "trip-changes-<advisor id>"}, stores the agent id against the advisor, calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "gmail"}, and opens the authorize_url in a popup while the advisor is signed in to the app. The advisor signs in on Google's own page. The company registers no Google app of its own.
On a run the agent reaches the Gmail REST API through that connection. It calls users.messages.list with a q search for mail from the last day from the supplier domains in the prompt, with words such as schedule change, itinerary change, flight change, cancelled or reservation modified, and follows nextPageToken until it has every match. It reads each with users.messages.get and pulls out the booking reference, the flight or property, and the old and new dates and times. Each change is matched against the trips the app put in the input by booking reference; a notice whose reference matches no trip is listed as unmatched rather than guessed.
For a matched change, the agent checks it against the rest of that trip from the input: a connection that now leaves less than the minimum time the prompt sets, a hotel check-in now after the guest lands a day later, a transfer booked for the old arrival time. It writes what changed and what it affects, and drafts a short note the advisor could send the client. It sends no email, applies no label, and archives or deletes nothing; the read-only sign-in could not do those anyway.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Morning trip-change check. Window: the last 24 hours to 2026-11-23 06:00, time zone America/Chicago. Read only. Suppliers: united.com, delta.com, aa.com, alaskaair.com, marriott.com, hilton.com, hyatt.com, royalcaribbean.com. Trips (trip id; booking refs; items in order): T-4471; DL ABC123, HI 88412; DL 1450 MSP-ATL 2026-12-19 07:05-10:55, DL 615 ATL-SJU 12:10-15:45, transfer 16:30, Hilton San Juan check-in 2026-12-19. T-4502; UA QWE789; UA 1123 ORD-DEN 2027-01-04 09:00-10:35, UA 2290 DEN-JAC 11:40-13:05. Minimum connection: 60 minutes domestic. 1) users.messages.list with q 'newer_than:1d' plus from: each supplier and the words schedule change, itinerary change, flight change, cancelled, reservation modified; follow nextPageToken. 2) users.messages.get each; extract booking reference, item, old and new date and time. 3) Match by booking reference to the trips above; unmatched notices go to a separate list. 4) For each match, check the trip's later items: connections under the minimum, a transfer or check-in that no longer fits. Return JSON only: {window, changes: [{trip_id, booking_ref, message_id, supplier, item, old, new, affects: [string], severity: 'action needed' or 'FYI', client_note}], unmatched: [{supplier, subject, received_at, booking_ref}]}. client_note under 80 words, no new booking suggested. Never send, label, archive or delete mail."
}- 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.
- 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.
- 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
What comes back is the JSON in the session's result, which the run.completed webhook carries to the app's server: each change matched to a trip with the old and new times, what else in the trip it affects, whether it needs action or is for information, and a short note to the client, plus any change notice that matched no trip in the app. The app shows the list on the advisor's home screen before their working day starts.
What the advisor checks before contacting the client: the supplier's notice itself, which the app links from the message id, because airlines sometimes send a change and a correction a few hours apart; and the booking in the airline's or hotel's own system, which is the record that counts. Rebooking, asking for a waiver and calling the client are the advisor's work. The agent only reads and drafts.
Run it on every morning before the advisor's day starts
The app's scheduler sends POST /o/{org}/sessions with {"agent": "<agent id>", "input": "…"} for each advisor at 6:00 in their time zone, writing that advisor's upcoming trips, booking references and supplier list into the input, with a fresh request_id, a UUID, per advisor and morning so a retried call starts no second run.
In the two weeks before a big group departure, an advisor can raise the check to every few hours from the app's settings; each check is another run of the same agent with a shorter window.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Each advisor's Gmail sign-in is held in Rush's connection under that advisor's own agent, read-only, and Rush signs the agent's Gmail requests outside its computer with a token limited to Gmail. One advisor's run never sees another's mail, and deleting an advisor's agent when they leave disconnects their account.
Each run has its own computer and a record of every message it read, so when an advisor asks why a notice was called unmatched, support opens that morning's session. A mail filter can catch the word "change" but cannot read the new time, match it to a trip and see that the transfer no longer fits. Each agent's sessions, listed with GET /o/{org}/sessions?agent=<agent id>, add up to what that advisor's model calls cost.
Frequently asked questions
Why put the trips in the input instead of letting the agent search all mail?
The app already knows which trips are booked and their references. Giving them to the agent keeps it from reading unrelated mail closely and makes every match checkable against the booking reference.
What about suppliers we did not list?
The search covers the domains in the input, which the app builds from the suppliers on the advisor's upcoming trips. A notice from a tour operator or a consolidator joins the list once its domain is on a trip.
Can the agent reply to the airline or the client?
No. The template asks Google for read access only, so the sign-in cannot send mail, and the instructions forbid it as well. The advisor sends the drafted note from their own mail after checking it.
More Gmail jobs
More jobs like this: Run an agent per customer task
- Which Klaviyo Flows Quietly Stopped Sending? An Email Reporting App's Weekly Check of Each Store's Live Flows (Klaviyo)
- How Can Recruiting Software Find Next Week's Interviews a Candidate Hasn't Accepted? One Agent per Recruiter, Reading Their Microsoft Calendar (Microsoft Calendar)
- Which Donors Gave Last Year but Not This Year? A Fundraising App's Monthly Airtable Check for Each Nonprofit (Airtable)