# Which Subcontractors Haven't Sent Their Lien Waivers This Month? Construction Software That Checks Each Contractor's OneDrive Before Payday

Construction software makes one agent per general contractor, signed into its OneDrive, that checks each subcontractor's pay application folder for its lien waivers.

[Run this on Rush](https://cloud.getrush.ai/run/check-each-pay-application-for-lien-waivers/onedrive/). Opens the console with this prompt ready to send. Connect OneDrive there first.

## What the agent does

This is for a software company that sells job-cost and payment tools to small general contractors: home builders, remodelers, commercial fit-out firms with ten to thirty subcontractors on a job. Each month every subcontractor sends a pay application with the lien waivers the contractor's checklist asks for, usually a conditional waiver for this payment and an unconditional one for the last, and the office manager saves them to the contractor's OneDrive in a folder per job, per sub, per month. The contractor will not release a payment without the paperwork, and finding the gaps two days before payday means a day of opening folders. The software adds a check the week before each pay date.

The company connects a OneDrive of its own and saves the agent once as a template with `POST /o/{org}/agents`, naming `onedrive` in `connections`, with instructions that keep it to reading. When a contractor turns the check on, the backend calls `POST /o/{org}/agents {"template": "<template id>", "name": "waivers-<contractor id>"}`, then `POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "onedrive"}`, and opens the `authorize_url` for the office manager to sign in on Microsoft's own page. Rush's OneDrive sign-in asks Microsoft Graph for `Files.ReadWrite.All`, which could change files, so the template's instructions forbid any write. The software stores the agent id against the contractor.

On a run the agent lists the month's folders with Microsoft Graph's list children call on a known path, `root:/Pay Apps/<job>:/children` on the signed-in person's drive, and then each subcontractor's folder for the month. Graph's reference says a folder with more than the default page size of 200 items returns `@odata.nextLink` for the next page, so the agent follows it. For each subcontractor it reads every file's `name`, `lastModifiedDateTime` and size, and downloads the PDFs to read their text: the form's title, the subcontractor's name, the job, the payment amount or through-date, and whether it is signed.

It checks each folder against the contractor's checklist in the request: a pay application, a conditional waiver whose amount matches this month's application, an unconditional waiver for the previous month's payment, and a current insurance certificate where the checklist asks for one. It returns JSON per job and subcontractor: complete, or the documents missing or mismatched, with the file it read and what did not match. It never moves, renames, edits or deletes a file, and it gives no opinion on which waiver form the law requires; the contractor's checklist decides.

## Start it with one API call

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

```json
{
  "agent": "<agent id>",
  "input": "Lien waiver check for the December 2026 pay cycle, pay date 2026-12-10. Read only. Jobs: 'Maple Court Townhomes' and 'Elm Street Clinic Fit-Out'. Folder pattern: /Pay Apps/<job>/<subcontractor>/2026-12/; the previous month is 2026-11. Checklist per subcontractor: (1) pay application for 2026-12; (2) conditional waiver for this payment, amount equal to the pay application's current payment due; (3) unconditional waiver for the 2026-11 payment, amount equal to last month's pay application; (4) certificate of insurance with an expiry after 2026-12-10. 1) List children of /Pay Apps/<job> to find subcontractor folders, then each folder's 2026-12 and 2026-11 children, following @odata.nextLink. 2) Download each PDF and read: form title, subcontractor, job, amount, through-date or period, signed or not. 3) Return JSON only: {jobs: [{job, subcontractors: [{name, status: complete|missing|mismatch, missing: [..], mismatches: [{document, file, expected, found}], files_read: [..]}]}]}. If a PDF cannot be read, list it under mismatches with found 'unreadable'. Never create, move, rename, edit, share or delete any file, and never judge whether a form meets any law."
}
```

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 agent marks each subcontractor on each job complete, missing a document, or holding one that does not match, and names the file it read. The answer is JSON in the session's `result` and in the `run.completed` webhook the software's API key sends. A document that does not match is, for example, a conditional waiver for a different amount than this month's pay application or an insurance certificate that expires before the pay date. Because every finding names its file, the office manager can open it in one click.

What the office manager checks before chasing anyone: a scanned waiver the agent could not read, a subcontractor who filed under a slightly different folder name, and amounts that differ because of retainage or a change order the checklist does not describe. The software turns the list into reminders the office manager sends to each subcontractor; the agent contacts no one, and a person decides whether a payment is released.

## Run it on every pay cycle, one week before the pay date

The software knows each contractor's pay dates. A week before each one, its scheduler sends `POST /o/{org}/sessions` with the contractor's agent id as `agent`, the month, the pay date, the job list and the checklist in `input`, and a `request_id` that is a UUID v5 of the contractor id and the pay date. The office manager can rerun it from the software two days later, with a new `request_id`, to see what came in.

Contractors who share a pay date start their runs at once. Past the API key's concurrent limit the extra runs wait `queued` and start in turn, and each result arrives on the webhook, so the scheduler needs no queue of its own.

## Why run it on Rush?

Each contractor's office manager signs in on Microsoft's page, and the account belongs to that contractor's agent alone: no run can open another contractor's OneDrive, and the software company's own runs never see one. The Microsoft token is signed outside the agent's computer and limited to Microsoft Graph files, and the session's `accounts` names the account every run read.

Each run has its own computer, so the subcontractors' waivers and insurance certificates it downloads stay in that run and are not kept on the software company's servers. When a subcontractor insists they sent a waiver, the company opens the session and sees exactly which folders and files the agent listed. The sum of `total_cost_usd` per contractor shows what the check costs per pay cycle.

## Frequently asked questions

### Does the agent decide whether a waiver is legally valid?

No. It checks that the documents the contractor's checklist names are there, signed, and for the right amount and period. Which form a state requires, and whether one is valid, is a question for the contractor and their lawyer.

### Why not let the agent file misnamed documents into the right folder?

Rush's OneDrive sign-in can write files, but the template forbids it. A waiver moved to the wrong folder is worse than one left where the subcontractor put it, so the agent reports the stray file and the office manager moves it.

### What if the contractor keeps documents in SharePoint instead?

This template reads the signed-in person's OneDrive by path. A contractor whose pay applications live in a SharePoint document library needs that folder synced or shared into their OneDrive, or a prompt that names the library.

### Can it read scanned paper waivers?

It reads the text in the PDF. A scan with no text layer may be unreadable, and the agent lists it as unreadable rather than guessing, so the office manager opens it by hand.

## More OneDrive jobs

- [Which Supplier Prices Went Up This Month? A Field-Service App's Check of Each HVAC Contractor's OneDrive Price Lists](https://getrush.ai/run/compare-supplier-price-lists/onedrive/)
- [Read Supplier Invoice PDFs From Each Customer's OneDrive Into Draft Bills](https://getrush.ai/run/extract-supplier-invoices/onedrive/)
- [Flag Subcontractors' Expiring Insurance Certificates in Each Contractor's OneDrive](https://getrush.ai/run/flag-expiring-insurance-certificates/onedrive/)

## 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](https://getrush.ai/run/check-if-a-ticket-is-a-known-bug/sentry/)
- [Which of Next Week's Home Inspections Are Missing an Address or Access Notes? Scheduling Software With One Agent per Inspector's Google Calendar](https://getrush.ai/run/check-next-weeks-inspections-for-missing-addresses/google-calendar/)
- [Are Next Week's Viewings Ready to Go? A Property Management App's Check of Each Leasing Agent's Outlook Calendar](https://getrush.ai/run/check-next-weeks-property-viewings/microsoft-calendar/)

## Keep reading

- [Connect OneDrive to Rush once, then name it on any run](https://getrush.ai/integrations/onedrive/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
