# Vendor Dispatch Coordination

Match an open work order to an approved vendor, dispatch the job, chase acceptance until confirmed, and close the loop with the tenant once work is complete.

## When to use

- A maintenance or repair work order needs a qualified vendor assigned and dispatched.
- A vendor has been dispatched but has not yet accepted or scheduled the job.
- Work is reported done and the tenant needs to confirm the fix before the work order closes.

## Tools

- `http-get`
- `http-post`
- `send-email`
- `send-message`
- `check-task`
- `schedule-task`

## Playbook

1. Pull the work order details and property/unit info with `http-get` against the property management system, e.g. GET `https://api.property-mgmt.example.com/v1/work_orders/{id}`.
2. Pull the list of approved vendors for the relevant trade (plumbing, electrical, HVAC — heating, ventilation, and air conditioning — etc.) with `http-get`, e.g. GET `https://api.property-mgmt.example.com/v1/vendors?trade=plumbing&status=approved`.
3. Select the best-fit vendor by trade match, service area, and rating. If no approved vendor exists for the trade or area, stop and use `send-message` to hand off to a human property manager naming the gap.
4. Treat "emergency" or life-safety maintenance (active leak, no heat in freezing conditions, gas smell, electrical hazard) as an immediate human escalation: use `send-message` to alert the on-call manager before doing anything else, and do not proceed with routine dispatch steps below.
5. Create the dispatch record with the selected vendor using `http-post`, e.g. POST `https://api.property-mgmt.example.com/v1/work_orders/{id}/dispatch` with vendor ID, access instructions, and requested window. Notify the vendor with `send-email` summarizing the job, address, access details, and requested response time.
6. Use `schedule-task` to check back in 24 hours for vendor acceptance. When it fires, use `check-task` to review the dispatch status; if still unaccepted, `send-message` the vendor's dispatch contact (or a backup approved vendor if the first has gone silent) to chase acceptance.
7. Once the vendor confirms a scheduled visit, use `send-message` (or `send-email` if that is the tenant's preferred channel per the property record) to tell the tenant the vendor name, expected date/window, and any access steps needed.
8. After the vendor marks the job complete, use `send-message` to ask the tenant to confirm the repair resolved the issue; if the tenant reports it is not resolved, reopen the work order via `http-post` to the same dispatch endpoint with a re-dispatch flag and repeat from step 3.
9. When the tenant confirms resolution, update the work order status to closed with `http-post` and note the vendor, dates, and confirmation in the work order record.

## Failure modes

- Vendor never responds to dispatch or the acceptance chase — escalate to a human after two chase attempts rather than looping indefinitely.
- No approved vendor exists for the trade or service area — hand off to a human property manager instead of dispatching an unapproved vendor.
- Tenant reports the issue persists after "completion" — reopen and re-dispatch rather than closing the work order.
- Any formal notice tied to the work order (e.g. a lease violation or cost-recovery notice) must be drafted for manager review only, never sent autonomously.

## Done when

- The work order is marked closed with vendor, schedule, and completion details recorded.
- The tenant has explicitly confirmed the repair resolved the issue.
- Any emergency or unresolvable case has been escalated to a human rather than left pending.