What the agent does
This is for a company that sells studio-management software to wedding photographers: contracts, galleries, payment schedules. Most of its users work alone, and most of their bookings start as one email from a couple asking whether a date is free. Couples write to several photographers at once and book whoever answers well and first, so an inquiry that sat for three days during a busy wedding weekend is often a lost booking. The software adds a morning Waiting on you list, made by an agent that reads each photographer's own Gmail.
The software saves the agent once as a template with POST /o/{org}/agents, naming {"name": "gmail", "access": "read"} in its connections, so each photographer's Google consent page asks for gmail.readonly alone. When a photographer turns the list on, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "inquiries-<photographer id>"}, then POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "gmail"}, and opens the authorize_url in a popup while the photographer is signed in to the software. The software registers no Google app and stores only the agent id against its user.
A run reaches the Gmail REST API as that photographer. It calls users.threads.list with a q search such as in:inbox newer_than:21d -category:promotions -category:social, follows nextPageToken, and then users.threads.get for each thread, because the list returns threads without their messages. A thread is an inquiry when its first message came from the photographer's contact form address (the software passes it in input) or reads like one: a couple, a date, a venue, a question about availability or packages. Vendor emails, newsletters and gallery notifications are left out.
For each inquiry it looks at who wrote last. If the newest message is from the couple and is more than 24 hours old, the inquiry is waiting. The agent writes waiting.json for the software: names, wedding date and venue as the couple wrote them, how long they have waited, a one-line summary of what they asked, and a reply drafted in the photographer's voice from the examples the software keeps, which thanks them, answers what it can from the photographer's package notes and asks to confirm the date. It cannot send: the connection only reads.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "List wedding inquiries waiting for my reply. Today is 2026-11-18. My address: hello@juneandpinephoto.com. My contact form sends from forms@juneandpinephoto.com. Use the Gmail REST API, reads only. 1) Call users.threads.list for userId me with q 'in:inbox newer_than:21d -category:promotions -category:social', following nextPageToken. 2) Call users.threads.get for each thread. 3) A thread is an inquiry when its first message is from forms@juneandpinephoto.com, or is from someone asking about a wedding, elopement or engagement date, venue, availability or prices. Skip vendors, newsletters, gallery and payment notifications. 4) An inquiry is waiting when its newest message is not from hello@juneandpinephoto.com and is more than 24 hours old. 5) For each waiting inquiry write: couple names, wedding date and venue as written, hours waiting, a one-line summary of what they asked, and a reply draft of at most 120 words in this voice: 'Hi Sam and Priya, thank you for thinking of me for your day at Hollow Creek Farm.' Answer only from these package notes: full-day and elopement packages, an engagement session with every full day, travel included within 60 miles, pricing guide sent on request. Ask them to confirm the date; do not say the date is free. Write waiting.json (an array of those fields plus the Gmail thread id) and waiting.md. Do not send, draft, label or change any email."
}- 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
The session returns waiting.json and waiting.md as artifacts. The software's webhook handler loads the JSON into that photographer's Waiting on you list, longest wait first, each with the couple's question in one line and a draft reply beside it with a button that opens the thread in Gmail.
What the photographer checks before replying: that the date is really free, which only their calendar knows and the draft deliberately does not claim; that what the draft says about packages is this season's offer; and that the thread is an inquiry at all, since a couple following up on a signed contract can read like a new one. The draft is a starting point the photographer pastes into Gmail and edits. Rush never sends it.
Run it on every morning, per photographer
The software's scheduler sends one POST /o/{org}/sessions per photographer with the list on, at 07:00 in their time zone, with their agent id as agent, their addresses, package notes and voice examples in input, and a request_id that is a UUID v5 of the photographer id and the date, 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.
In peak season the software can offer a second check at 17:00. The same request with the afternoon's date in its request_id starts a separate run, and the list in the app shows whichever finished last.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
A photographer's inbox holds contracts, addresses and payment details for every couple they work with. Each photographer's Google sign-in belongs to their own agent, at the read level, so the software never holds a Google token and a run of one photographer's agent cannot open another's mail. Every session lists the Google account it used in accounts, so the software can show a photographer each morning's run against their inbox.
Each morning's run has its own computer and a record of every Gmail call it made and what its model calls cost, which the software can add up per photographer with GET /o/{org}/sessions?agent=<agent id>. Reading a few dozen threads and judging which are inquiries is the part a filter rule gets wrong, and the part an agent does well.
Frequently asked questions
Can the agent send the reply?
No. The template names Gmail at the read level, so each photographer's sign-in grants gmail.readonly and the run's token cannot send. Replies go out from Gmail, by the photographer.
Why not just list unread emails?
Photographers open an inquiry on their phone and mean to answer later, which marks it read. The agent looks at who wrote last in each thread instead, which still catches it.
Will the draft say the date is free?
No. The run reads mail, not the photographer's calendar, and the prompt tells it to ask the couple to confirm the date. A software that also connects each photographer's calendar could add that check to the template later; each photographer would then connect it once.
What happens if a photographer revokes access in their Google account?
Their connection reads needs_reauth, because Google refuses the stored grant, and the morning list cannot be made. The software shows a reconnect button that starts a new sign-in for the same agent, and connecting again clears it.
More Gmail jobs
More jobs like this: Run an agent per customer task
- 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)
- Where Are the Gaps in My Book Next Week? A Salon App Finds Each Stylist's Open Slots From Their Google Calendar (Google Calendar)