What the agent does
The agent reads invoices through your selected PayPal connection and establishes the reporting date and timezone before deciding what is overdue. The PayPal entry in rush/shared/connectors/integrations.ts describes tools to "Create and manage invoices" and points to https://mcp.paypal.com/mcp. This assignment uses invoice reads only. It includes sent invoices whose due dates have passed and whose balances remain unpaid, rather than treating every non-paid status as an overdue bill. Draft, cancelled and fully settled invoices do not belong on the collections list.
For each eligible invoice, the agent reads the invoice number, customer reference, due date, currency, original amount and remaining balance when available. It calculates days overdue against the declared cutoff and records partial payments explicitly. Different currencies stay separate. A missing due date or unclear status goes into an exceptions section instead of receiving a guessed overdue age. The report uses the returned invoice identifier to distinguish records, because one customer may have several invoices with similar descriptions.
The agent groups the eligible invoices by customer and drafts one polite reminder for each customer, under 80 words. Each draft names the relevant invoice numbers and outstanding amounts, and asks for payment or clarification without inventing penalties, legal threats or a payment deadline. Multiple currencies are written as separate balances. Where the connection does not supply a reliable customer grouping, the report flags the uncertainty rather than combining people because their names happen to resemble one another.
It writes unpaid-invoices.md with the aging table, customer reminder drafts and exceptions. Before sending the minimal request below, explicitly select your PayPal MCP connection through the API's connections field; the developer API quickstart documents that setup. Merely naming PayPal in input provides no access. No repository is needed, and the agent must not use a reminder-sending tool, change an invoice or initiate a refund. These drafts are files for your review, not outgoing messages.
Start it with one API call
POST https://api.prix.dev/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Use the explicitly selected PayPal connection to read sent invoices with an unpaid balance past their due date. If PayPal tools are unavailable, stop and report the missing connection. Write unpaid-invoices.md with the cutoff and timezone, customer reference, invoice number, due date, currency, original and outstanding amounts, and days overdue. Separate missing dates and unclear statuses. Group reliably identified customers and write one polite reminder under 80 words per customer naming every relevant invoice and outstanding amount. Do not invent fees or deadlines. Do not send reminders, contact customers, edit invoices, refund payments or change anything in PayPal."
}- 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.prix.dev/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
unpaid-invoices.md contains an overdue-invoice table, totals separated by currency, an exceptions section and a set of clearly labeled unsent reminders. The table distinguishes the original invoice value from the balance still due so a partial payment does not disappear. Each draft can be traced back to the exact invoice rows it summarizes. Missing information stays visible for the person handling collections.
Before sending any draft yourself, recheck the invoice in PayPal for payments received after extraction. Verify the recipient, amount and invoice number, then edit the wording for your relationship with that customer. The report records the snapshot cutoff; it is not a live receivables ledger. Read the finished Rush session for the answer and report file, and inspect its transcript when an invoice's inclusion needs explanation.
Run it on every collections review
Have your own schedule submit one request before the regular collections review, with the PayPal connection explicitly selected. Give each snapshot its own Idempotency-Key and reuse it for transport retries only. Your completion-webhook handler can read the session and place unpaid-invoices.md in an internal approval queue. Keep actual customer messaging as a separate, deliberate step so a retried report request cannot turn into repeated reminders.
The use case this job follows, with its automation and trigger: Produce a report or file, no repo.
Why run it on Rush?
Collections work often starts with repetitive invoice reads but ends with wording that deserves judgment. Rush lets an agent gather the records, calculate the ages and draft the messages in its own sandbox while your laptop is elsewhere. The result combines the factual balance table with the proposed copy, so the reviewer does not have to reconstruct which invoice a draft was about.
The tool record makes it possible to distinguish a bad overdue calculation from stale source data or a missing due date. Independent reporting runs can handle their own snapshots without sharing a local export directory. The boundary remains concrete: the cloud run returns a report with proof of its reads, and your team decides whether any reminder should leave the business.
Frequently asked questions
Will this send PayPal's built-in invoice reminders?
No. The task explicitly prohibits sending reminders and any other account changes. It returns draft text in unpaid-invoices.md for a person to review and send separately.
How are partially paid invoices handled?
The agent uses the outstanding balance when that value is available and keeps the original amount alongside it. The reminder must request the remaining amount, not charge the customer again for payments already made. An unavailable balance is an exception to resolve.
Can one customer receive a combined draft?
Yes, when the source records identify that customer reliably. The combined draft names the applicable invoice numbers and amounts while staying under the requested word limit. It does not merge unrelated customers or currencies into a single guessed balance.
Does the report need access to my code?
No, resources is omitted because this is account reporting rather than repository work. It does require a PayPal connection selected on the actual API request. Use the documented connection sign-in, not credentials embedded in the prompt.