What the agent does
This is for a company that sells project-management software to general contractors and builders. Its users hire dozens of subcontractors a year, and before a sub sets foot on site the contractor wants a current certificate of insurance on file. Those certificates arrive as PDFs and end up in a OneDrive folder, one file per sub, and nobody notices when a policy lapses mid-project. The company saves one agent as a template, POST /o/{org}/agents {"name": "COI check", "harness": "claude", "instructions": "…", "connections": ["onedrive"]}, after connecting its own OneDrive, and makes one agent per contractor account with {"template": "<template id>", "name": "coi-<your account id>"}.
The contractor connects their OneDrive once. The backend calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "onedrive"} and opens the returned authorize_url in a popup for the signed-in contractor, who approves on Microsoft's own page. Rush asks for Microsoft Graph's Files.ReadWrite.All for this app and nothing for mail or calendars. The software company registers no app with Microsoft and never stores a token; it stores the agent id and the folder path the contractor chose in its settings.
Each run lists the folder with Graph's GET /me/drive/root:/{path}:/children, following @odata.nextLink, and downloads each PDF or image with GET /me/drive/items/{id}/content. It extracts the text (a scanned certificate needs OCR, which the agent installs in its sandbox when the text layer is empty) and reads what the standard certificate form lays out: the insured's name, the certificate holder, and for each coverage line (general liability, automobile, umbrella, workers' compensation) the insurer, policy number, effective date, expiration date and limits.
It compares each line's expiration date with the run date and the window in input, and each limit with the minimums the contractor entered in the app. A certificate whose holder is not the contractor's company, one with no workers' compensation line, or one whose insured name does not match the subcontractor list is flagged with the reason. It writes nothing to OneDrive: no renames, no moves, no new files. The contractor or their office manager chases the sub, and the software can show the list beside each project.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Check certificates of insurance in OneDrive folder 'Subcontractors/Insurance' as of 2026-11-13. List it with GET /me/drive/root:/Subcontractors/Insurance:/children, following @odata.nextLink, and download each PDF or image with /content. Extract text, running OCR when a PDF has no text layer. For each certificate read: insured name, certificate holder, and per coverage line (general liability, automobile, umbrella, workers compensation) insurer, policy number, effective date, expiration date and limits. Our company name is 'Keystone Builders LLC'. Subcontractors: Apex Electric, Delgado Concrete, Summit Roofing, Pine Ridge Plumbing. Minimums entered by the user: general liability each occurrence 1,000,000; automobile combined single limit 1,000,000. Flag: any line expired or expiring within 30 days; a limit below the minimums; a certificate holder that is not our company; no workers compensation line; an insured name not on the list; a subcontractor with no certificate. Return only JSON: certificates (file name, insured, lines with dates and limits, flags) and missing (subcontractors with no certificate). Do not rename, move, upload or delete any file."
}- 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 that JSON, in the session's result and in the run.completed webhook's data.result. The app matches the webhook's execution_id to the contractor it started the run for and shows a list per subcontractor: each coverage line with its expiration date, the flags in red, and the file name so the office manager can open the certificate it came from. Subcontractors in missing show as having nothing on file.
What the contractor checks: every flag against the certificate itself, since OCR of a faxed or photographed form can misread a date, and any line the agent could not read. The agent reports what each certificate says and compares it with the minimums the contractor entered; it does not say whether a sub's coverage satisfies a contract or the law, which is between the contractor, the sub and their insurance agent. A certificate is also only evidence that a policy existed when it was issued, so a contractor who needs certainty asks the sub's insurer.
Run it on every Monday morning, per contractor
Each Monday the app's scheduler sends one POST /o/{org}/sessions per contractor with the feature on, naming that contractor's agent, with their folder, subcontractor list, minimums and the date in input, and a request_id that is a UUID v5 of the account id and the date. Runs past the key's concurrent limit are created queued and start as slots free, so a few hundred contractors need no batching of their own.
The app can also start a run when a contractor uploads a new certificate through its own interface and saves it to the folder. A contractor who revoked Rush's access in their Microsoft account shows needs_reauth on GET /o/{org}/agents/{agent}/connections, and the app asks them to reconnect instead of showing a stale list.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Certificates are semi-structured documents in a dozen insurers' layouts, many of them scans. Template-based extraction breaks on each new insurer; an agent that reads the page the way an office manager does handles the variety and says what it could not read. Running it on Rush means the software company never builds Microsoft sign-in, token storage or per-customer isolation: each contractor's OneDrive belongs to their own agent, and an agent's run sees only that drive.
Each run has its own computer, so one contractor's documents are opened in a machine no other customer's run touches, with its own record of every Graph call and its cost. GET /o/{org}/sessions?agent=<agent id> lists a contractor's runs and what they cost, and DELETE /o/{org}/agents/{agent} disconnects their OneDrive when they leave.
Frequently asked questions
Does it need write access to OneDrive?
Rush's OneDrive app asks for Files.ReadWrite.All, the one permission it uses for files. This agent's instructions keep it to listing and downloading, and each run's transcript shows every call it made, so a write would be visible.
What if certificates are in SharePoint, not OneDrive?
The prompt reads the signed-in user's own drive through /me/drive. A folder in a SharePoint document library that the contractor has synced or shortcut into their OneDrive may not be reachable this way; the simplest setup is a folder in their own OneDrive.
Can it email the subcontractor for a new certificate?
Not with this template, which names OneDrive only. The app can show a "Request certificate" button that drafts the email for the contractor to send, keeping a person in charge of what reaches the sub.
How accurate is the date reading?
It depends on the scan. Typed PDFs from an insurer's system read cleanly; faxed copies and phone photos are where OCR mistakes happen, so the app shows the file name next to every date for a quick check.