# Restaurant Labor Cost Percentage From Square

Restaurant scheduling software gives each restaurant an agent that reads Square timecards and orders each Monday and reports labor cost percentage by location.

[Run this on Rush](https://cloud.getrush.ai/run/weekly-labor-cost-percentage-by-location/square/). Opens the console with this prompt ready to send. Connect Square there first.

## What the agent does

This is for a company that sells scheduling and tip-pooling software to independent restaurants, most of which run Square for Restaurants at the counter and for the time clock. The number owners ask it for every week is labor cost as a share of sales, by location and by day, and whether the schedule they built matched the sales they got. The figures are all in Square, but working it out means exporting timecards, multiplying hours by each wage, subtracting unpaid breaks and dividing by sales without tax and tips. The company adds a weekly Labor review to its app, written by an agent that reads each restaurant's own Square account.

The company connects a Square account of its own and saves the agent once as a template with `POST /o/{org}/agents`, naming `square` in `connections` and with instructions that keep it to reading. When a restaurant turns Labor review on, the backend calls `POST /o/{org}/agents {"template": "<template id>", "name": "labor-<restaurant id>"}`, then `POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "square"}`, and opens the `authorize_url` in a popup for the owner. The owner signs in on Square's own page. Square's docs say its remote server reaches production accounts only, is in beta, and keeps an allowlist for dynamic client registration.

Square's server has three tools: `get_service_info` to list a service's methods, `get_type_info` for a method's parameters, and `make_api_request` to call it. The agent reads the locations service for each location's name and time zone. For labor it calls the Labor API's timecard search, `POST /v2/labor/timecards/search`, filtered to the restaurant's locations and the week's workdays, at the documented maximum of 200 per page, following `cursor`. Each timecard carries `team_member_id`, `location_id`, `start_at`, `end_at`, `status` (`OPEN` or `CLOSED`), a `wage` with `title` and `hourly_rate`, and `breaks` whose `is_paid` says whether a break counts as paid time. Labor cost for a closed timecard is its paid hours times its `hourly_rate`; an open one, a shift with no clock-out, is listed for the manager and left out of the totals.

For sales it calls `POST /v2/orders/search` for the same locations (Square allows up to 10 per call) with a `state_filter` of `COMPLETED` and a `closed_at` date filter, sorted by `CLOSED_AT` as Square requires when filtering on that field. From each order's `net_amounts`, which Square describes as sale money less return money, it subtracts `tax_money` and `tip_money`, so labor is measured against sales before tax and tips. It writes labor hours, labor cost, sales and labor cost percentage for each location and day, the same by wage title, the days above the owner's target, open timecards, and team members with more than 40 hours in the week, whose hours it costs at their timecard rate and labels so the owner knows an overtime premium is not included.

## Start it with one API call

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

```json
{
  "agent": "<agent id>",
  "input": "Labor review for 2026-11-16 to 2026-11-22. Target labor cost: 30% of sales. Read only. Use get_service_info and get_type_info as needed, then make_api_request. 1) List locations: id, name, timezone. 2) Search timecards for all locations with workdays in that range, limit 200, following cursor. For each CLOSED timecard: paid hours = end_at minus start_at minus breaks where is_paid is false; cost = paid hours x wage.hourly_rate. List OPEN timecards separately and leave them out of totals. List timecards with no hourly_rate as hours only. 3) Search orders for the same locations, state_filter COMPLETED, date_time_filter closed_at for the week in each location's time zone, sort CLOSED_AT, following cursor. Sales per order = net_amounts.total_money minus net_amounts.tax_money minus net_amounts.tip_money. 4) Write labor-review.md: per location and per day, sales, labor hours, labor cost and labor cost %; the same by wage.title; days over target; open timecards; team members over 40 hours, costed at their timecard rate and labelled 'overtime premium not included'. Write labor-review.json with the same figures. Show money in dollars. Create, update or delete nothing in Square."
}
```

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 session returns `labor-review.md` and `labor-review.json` as artifacts. The app's webhook handler reads the JSON into the restaurant's Monday Labor review: a line per location with the week's labor cost percentage against the target, a day-by-day grid that shows which shifts ran heavy, and the role breakdown that tells the owner whether the extra hours were in the kitchen or on the floor.

What the owner checks: the open timecards first, since a forgotten clock-out either inflates a day's hours or, left out as here, understates them, and the list of team members on salary or without an hourly rate, whose cost is not in the percentage. Square's docs say orders taken offline can take up to 72 hours to reach Square, so a figure for the last days of the week can move if the review is read too early. The review shows what happened; it does not tell the owner whom to schedule.

## Run it on every Monday morning, per restaurant

The app's scheduler sends one `POST /o/{org}/sessions` per restaurant with Labor review on, mid-morning on Monday in the restaurant's time zone, with its agent id as `agent`, the week and the owner's target in `input`, and a `request_id` that is a UUID v5 of the restaurant id and the week, so a retried job starts no second run. Runs past the key's `max_concurrent` wait as `queued` and start as slots free, and the key's webhook brings each `run.completed` back to the app.

A manager who wants yesterday's numbers before a scheduling call can press Run now, which sends the same request for the week so far.

## Why run it on Rush?

Each restaurant's Square sign-in is stored in Rush's connection under that restaurant's agent, so the company holds no Square tokens, runs no Square OAuth app, and a run for one restaurant cannot read another's payroll hours. The session's `accounts` names the Square connection each run used, which the company can show an owner who asks who has read their timecards.

Each run has its own computer for a week of timecards and orders, and a transcript of every `make_api_request` with its arguments, so a disputed number can be traced to the call it came from. The company adds up `total_cost_usd` per restaurant with `GET /o/{org}/sessions?agent=<agent id>`, and because the server describes its services through `get_type_info`, a field Square adds to timecards is readable on the next run without an app release.

## Frequently asked questions

### What sales figure is the percentage measured against?

Each completed order's `net_amounts`, sale money less returns, minus the tax and tips inside it. Restaurants that measure against a different line, such as sales including service charges, put that rule in the prompt and the agent follows it and states it at the top of the review.

### Does the figure include overtime pay, payroll taxes or salaried managers?

No. A timecard carries an hourly rate, not what payroll later paid, so the review costs every paid hour at that rate, labels team members over 40 hours, and lists salaried staff as hours only. Owners who want a fully loaded figure add their own uplift in the prompt.

### What permission does the owner's Square sign-in need?

Square documents `TIMECARDS_READ` as the permission the timecard search requires. If Square refuses a timecard or order call for a missing permission, the review says which part could not be read instead of showing a percentage, and the owner signs in again from the app.

### Could the agent change a timecard?

Square documents a read-only switch for its local server and none for the hosted one. The template's instructions and each prompt forbid every call that is not a read, and the transcript lists each request the run made.

## More Square jobs

- [Get a Daily Sales Summary From Square](https://getrush.ai/run/daily-sales-summary/square/)
- [How Can Salon Software Draft a Birthday Message for Each Client in Next Week's Square Customer List? One Agent per Salon](https://getrush.ai/run/draft-birthday-messages-for-next-weeks-clients/square/)
- [Chargeback Response Drafts for Each Square Dispute](https://getrush.ai/run/draft-each-chargeback-response/square/)

## More jobs like this: Run an agent per customer task

- [Send a Personal Welcome Email for Each Signup Through an API](https://getrush.ai/run/welcome-email-per-signup/resend/)
- [Summarize Each Customer's Product Usage From PostHog Through an API](https://getrush.ai/run/account-activity-summary/posthog/)
- [Accounts Receivable Aging Report From QuickBooks](https://getrush.ai/run/accounts-receivable-aging-report-for-each-client/quickbooks/)

## Keep reading

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