What the agent does
This is for a company that sells back-office software to small real-estate brokerages. Most of those brokerages keep each transaction in a Google Drive folder, one folder per property under an "Open deals" folder, and a transaction coordinator spends part of every week opening each one to see whether the purchase agreement, the disclosures, the inspection report and the earnest-money receipt are there before the closing date. The company saves one agent as a template whose connections name google-drive, and makes one agent from it per brokerage, storing the agent id against that brokerage's account.
Each brokerage connects its own Drive once. The backend calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "google-drive"} and opens the authorize_url in a popup, where the coordinator signs in on Google's page. Rush asks Google for drive.readonly, drive.file and spreadsheets only, the software company registers no Google app, and the token is used from outside the agent's computer. Each brokerage's checklist comes from the software's own settings and is sent in the run's input, because what a deal file must hold is the brokerage's own rule.
On a run, the agent lists the deal folders with the Drive API's files.list and a q of '<open deals folder id>' in parents and mimeType = 'application/vnd.google-apps.folder' and trashed = false, then lists each folder's files the same way, with name, mimeType and modifiedTime in fields. A file name rarely says what is inside, so for each PDF or Google Doc whose name does not match an item on the checklist, it downloads it with files.get and alt=media (or exports a Google Doc as text) and reads the first page to tell what kind of document it is.
For each deal it matches what it found to the checklist and returns: the folder name and link, the closing date when a file in the folder states one, each required document marked found (with the file it matched) or missing, and files it could not identify. It does not judge whether a document is complete, correctly signed or legally sufficient; it says what is in the folder. It creates, moves and renames nothing.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "In Google Drive, the folder with id 1QrStUvWxYzAbCdEfGhIjKlMnOp holds one subfolder per open deal. For each subfolder, list its files (not trashed). Required documents: purchase agreement, seller disclosure, HOA documents (only if the purchase agreement says the property is in a homeowners association), inspection report or signed inspection waiver, earnest money receipt, title commitment. Match each file to a required document by its name, and when the name is unclear, by reading its first page. Return only JSON: {deals: [{folder, folder_url, closing_date, documents: [{required, status: found|missing|not_required, file}], unidentified_files: [string]}]}. Do not create, move, rename or edit any file, and do not judge whether a document is correct or complete."
}- 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, with your repository as the resources URL. 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 answer is JSON in the session's result and in the run.completed webhook. The software shows each deal as a row on the brokerage's dashboard with its missing documents in red and links straight to the Drive folder, so the coordinator knows which agent to ask for what, starting with the deals that close soonest.
What the coordinator checks: a document marked found because a file's first page looked right, which they open before they rely on it; deals where the agent could not find a closing date; and unidentified_files, which are often scans with no text. The agent says what is in a folder, not whether a document meets the brokerage's legal or licensing requirements; that review stays with the coordinator and the broker. The transcript lists every folder and file the agent opened.
Run it on every Monday, per brokerage
The software's scheduler sends one POST /o/{org}/sessions per connected brokerage early each Monday, with that brokerage's agent id as agent, its open-deals folder id and checklist in input, and a request_id that is a UUID v5 of the brokerage's id and the date so a retried job never starts the same check twice.
When a coordinator adds a deal in the software, it can send the same request for that one folder at once. The key's webhook delivers each answer, and the handler matches the execution_id to the brokerage it saved when it started the run.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Deal folders hold buyers' and sellers' names, addresses and finances, so each brokerage's Drive must stay with that brokerage. On Rush, a brokerage's Google sign-in belongs to its own agent: that agent's runs read that Drive and nothing else, and the software company's own runs never see it. A session that used it is readable only by whoever started it and the org's owners and admins.
Telling an inspection report from a disclosure by its first page is reading, which a file-name rule cannot do. Each run keeps a record of the files it opened and what it decided about each, and the session lists the accounts it used, so when a coordinator asks why a deal showed a missing receipt, the answer is in the transcript.
Frequently asked questions
Can the agent read the brokerage's whole Drive?
The drive.readonly scope reads every file the signed-in account can, which is why the prompt names one folder and the run lists only inside it. A brokerage can sign in with an account that only has the deals folder shared to it.
Will it upload or rename files?
No, because the prompt forbids it. drive.readonly only reads and drive.file reaches only files Rush created or the person opened with it, but the spreadsheets scope can edit any Google Sheet the account can, so the rule lives in the prompt and the transcript records every call.
Does it check that documents are signed?
It does not certify anything. It reports which documents are present by what they are, and the coordinator or broker reviews each one before closing.
What about scanned PDFs with no text?
The agent can look at a scanned page as an image, but a blurry scan can still be unclear. Anything it cannot identify goes in unidentified_files rather than being guessed into the checklist.
More Google Drive jobs
More jobs like this: Run an agent per customer task
- Is This Support Ticket a Known Bug? A Help Desk App Checks Each Customer's Sentry When a Ticket Arrives (Sentry)
- Are Next Week's Viewings Ready to Go? A Property Management App's Check of Each Leasing Agent's Outlook Calendar (Microsoft Calendar)
- Where Are Last Month's Receipts? A Bookkeeping App Collects Each Freelancer's Emailed Receipts From Their Gmail (Gmail)
- Which Supplier Prices Went Up This Month? A Field-Service App's Check of Each HVAC Contractor's OneDrive Price Lists (OneDrive)