Agent setup guide
Affiliate Payout Calculator
Monthly: each affiliate's sales and commission from your sales sheet, totals checked in code, a statement per partner after your approval. It never pays anyone.
What it does
Monthly: each affiliate's sales and commission from your sales sheet, totals checked in code, a statement per partner after your approval. It never pays anyone.
- On the 1st of each month, reads your sales sheet and keeps, in code, the sales at least 30 days old (past your refund window) that aren't on a statement yet.
- For each partner in your partners tab, AI picks their sales (leaving out refunded rows) and drafts a statement email.
- Code adds up each partner's sales and works out the commission at their rate; anything the AI got wrong is corrected and shown to you.
- Totals are recalculated in code before anyone sees them — never by the AI: each line (quantity × rate), the subtotal, markups and the total; anything the AI got wrong is corrected and flagged to the reviewer, and lines it couldn't price stay TBD.
- All statements wait for one approval; then each is checked in code and emailed, and every sale row in the batch is marked “Statement <date>”.
- You get a summary: sent and held statements, the batch total (added up in code) and sales whose affiliate isn't in your partners tab.
- The summary is counted in code from what each step really did (sent, held, skipped, failed), so it never reports a held message as sent.
What it needs
- A paid plan (agents run live on paid plans).
- An AI provider key (Settings → AI Providers).
- Google Sheets, connected in Settings → Integrations.
- A sales tab (Date | Order | Product | Affiliate | Amount | Refunded | Statement) and a partners tab (Affiliate | Email | Commission %).
What it doesn't do
- It never pays anyone or connects to a bank or PayPal: you pay partners yourself.
- It reads affiliate data from your sheet, not from Gumroad or Lemon Squeezy directly.
- Up to 50 partners and 500 sales rows per run; it makes no tax decisions.
- Nothing is sent or marked before you approve the batch.
Availability and plans
Available
Its workflow is built and tested, and every app it needs is live. You can get it and set it up now.
Included free on the Enterprise plan; on other paid plans it's a one-time purchase per workspace (the price is on the Agents page). The Agents page in the app always shows its current status.
Before you start
- A paid plan: agents run live, and the Free plan only runs Dry Runs.
- An AI provider key (OpenAI, Anthropic, Google and more) in Settings → AI Providers. AI usage is billed by your provider.
- These apps, connected in Settings → Integrations: Google Sheets.
- Nothing to send: the agent runs on a schedule.
- About 20 minutes.
Set it up step by step
Get the agent first (buy it, or it's already yours when your plan includes it), then in Agents → My agents press “Set up this agent”. That creates the agent's workflow in your workspace (it counts towards your plan's workflow limit) and opens the canvas with a setup checklist above it. Each item links to the exact place to go and ticks itself off when it's done.
1. Connect your AI provider
The AI steps run on your own key (OpenAI, Anthropic, Google and more). Add one in Settings → AI Providers.
2. Connect Google Sheets
Connect the Google account that can open your sales sheet (Settings → Integrations → Google Sheets).
3. Pick the sales and partners tabs
Open “Read the sales” and “Read your partners” and pick the account, spreadsheet and tab for each.
| Setting | What to enter | In step |
|---|---|---|
| Google account (Sales) | The Google account that can open the spreadsheet. Pick your connected Google Sheets account. | “Read the sales” |
| Sales spreadsheet | Paste the link of the spreadsheet. | “Read the sales” |
| Sales tab | The tab with one row per sale (Date | Order | Product | Affiliate | Amount | Refunded | Statement). | “Read the sales” |
| Google account (Partners) | The Google account that can open the spreadsheet. Pick your connected Google Sheets account. | “Read your partners” |
| Partners spreadsheet | Paste the link of the spreadsheet. | “Read your partners” |
| Partners tab | The tab with one row per partner (Affiliate | Email | Commission %). | “Read your partners” |
4. Describe your program
Open “Draft the partner's statement” and replace the placeholder, then enter the Reply-to on “Email the statement”.
| Setting | What to enter | In step |
|---|---|---|
| Your program and payout terms | Replace the placeholder with your program name, currency, how and when you pay partners, how the Affiliate column names partners, tone and sign-off. It starts as “[DESCRIBE YOUR AFFILIATE PROGRAM: ITS NAME, THE CURRENCY, HOW AND WHEN YOU PAY PARTNERS (E.G. PAYPAL BY THE 10TH), HOW THE AFFILIATE COLUMN NAMES PARTNERS (NAME OR CODE), YOUR TONE AND YOUR SIGN-OFF]” until you replace it. | “Draft the partner's statement” |
| Your email (partner replies) | Partners' replies to their statement come back to this address. | “Email the statement” |
5. Where to mark the rows
Open “Mark the row”: the same account, spreadsheet and sales tab, and the letter of the Statement column.
| Setting | What to enter | In step |
|---|---|---|
| Google account (marking rows, same one) | The same Google account. Pick your connected Google Sheets account. | “Mark the row” |
| Sales spreadsheet (same one) | The same spreadsheet as the sales tab. | “Mark the row” |
| Sales tab (same one) | The same sales tab. | “Mark the row” |
| Statement column letter | The letter of your Statement column, e.g. G. | “Mark the row” |
6. Your summary
Open “Email your summary” and enter your email and Reply-to.
| Setting | What to enter | In step |
|---|---|---|
| Your email (summary) | Who gets the monthly summary (up to 5, comma-separated). Replace the example address. It starts as “you@your-business.example” until you replace it. | “Email your summary” |
| Reply-to on the summary | Usually your own address. | “Email your summary” |
7. Test it with Dry Run
Press Dry Run: the agent runs on sample data with no messages sent and nothing written to your apps.
8. Switch the trigger on
Open the trigger, set your time zone and switch the schedule on. It runs on the 1st of each month at 8:00.
How it works
The agent is a normal workflow with 20 steps (2 AI steps, with a person approving in Reviews). You can open, edit and monitor it like any other workflow.
- 1st of every month at 8:00 — Runs on a schedule (cron 0 8 1 * *, UTC — change it in the trigger's settings). Runs on the 1st of each month. Set your time zone on the trigger.
- Read the sales — Google Sheets: Read rows. Reads your sales tab (Date | Order | Product | Affiliate | Amount | Refunded | Statement), e.g. a Gumroad, Lemon Squeezy or Shopify export with the affiliate on each row.
- Pick this month's sales — Step. In code, not AI: keeps sales at least 30 days old (past your refund window) that aren't on a statement yet (blank Statement cell). Change the 30 days here (olderThan).
- Read your partners — Google Sheets: Read rows. Reads your partners tab (Affiliate | Email | Commission %).
- Each partner — Repeats the steps below for each item (up to 50 per run). Drafts a statement for every partner row (up to 50).
- [For each item — “Each partner”] Draft the partner's statement — AI step (runs on your AI provider key). AI picks this partner's sales from the batch (copying each amount), leaves out refunded rows, and drafts the statement email with placeholders for the totals.
- [For each item — “Each partner”] Check the math — Step. In code, never by the AI: adds up the partner's sales, works out the commission at their rate, corrects anything the AI got wrong (flagged to the reviewer) and fills the totals into the email.
- Add up the batch — Step. In code: the total commission across every statement in this batch, for you.
- Approve the statements — A person approves or rejects it in Reviews (the run waits). Every partner's statement waits in Reviews together, with the math corrections first. Edit any, set send to false on any that shouldn't go, and approve.
- Each approved statement — Repeats the steps below for each item (up to 50 per run). Branch: Approved. Checks and emails every approved statement.
- [For each item — “Each approved statement”] Check before sending — Step. In code: has sales, still marked to send, one valid partner email, the math fully checked (no TBD) and no placeholders left.
- [For each item — “Each approved statement”] Send it? — Decision: picks the branch to follow. Passes: emailed. Otherwise held and listed in your summary.
- [For each item — “Each approved statement”] Held — Kept in the run history. Branch: Held. No sales, set to not send, no valid email or the math couldn't be checked; listed in your summary.
- [For each item — “Each approved statement”] Email the statement — Sends an email from your workspace's sender. Branch: Passes. Sends the statement to the partner from your workspace's sender, with replies to you.
- Count what happened — Step. In code, not AI: which statements were sent and which are held, with the reason.
- Find sales without a partner — AI step (runs on your AI provider key). AI lists the sales in this batch whose Affiliate cell matches none of your partners, so you can add the partner or fix the cell.
- Each sale in the batch — Repeats the steps below for each item (up to 500 per run). Marks every sale row of the approved batch so it's never counted twice.
- [For each item — “Each sale in the batch”] Mark the row — Google Sheets: Update a row. Writes “Statement <today>” into the row's Statement cell.
- Email your summary — Sends an email from your workspace's sender. Emails you what was sent and held, the batch total checked in code and the sales without a partner.
- Done — Kept in the run history. The run history keeps every statement, the checks and the summary.
Test it with Dry Run
Press Dry Run in the canvas. The agent runs on the sample data stored on its trigger (the “Sample data for Dry Run” box), so you can check every step's output before anything is live.
- Nothing is sent or written: app actions, emails and Slack posts are simulated, and AI steps don't call your AI provider.
- Approval steps use the Dry Run decision you pick in the step's settings (approved, rejected or timeout), so you can try each branch.
- For-each loops repeat only the first 3 items.
Go live
- Open the trigger, set your time zone and switch the schedule on. It runs on the 1st of each month at 8:00.
- Scheduled runs start only once the schedule is activated, and can't repeat faster than your plan's minimum interval.
- The setup checklist adds a “paid plan” item before activation: live runs need a paid plan (the Free plan only runs Dry Runs).
- When every checklist item is done and the trigger is on, the checklist says “Live — this agent is running”. Follow its runs in the workflow's History tab and in Analytics → Agents.
Questions
Where do the sales come from?
From a Google Sheet: paste or import your Gumroad, Lemon Squeezy or Shopify sales export with an Affiliate column. Gumroad's API doesn't return affiliate details, so the sheet is the source.
Who does the math?
Code. AI only matches sales to partners and writes the email; the sales total and commission are recalculated in code and any correction is shown to you before approval.
How is a sale never counted twice?
After you approve, every sale row in the batch gets “Statement <date>” in its Statement cell, and only rows with a blank Statement cell are picked next month. Rows with an affiliate that isn't in your partners tab are listed in your summary; clear their Statement cell to include them next month.
Troubleshooting
- “No AI provider connected” or a rejected key: connect or fix the key in Settings → AI Providers, then press Test there.
- A checklist item stays unticked: the setting is still empty or still contains its placeholder text. Open the step from the checklist and fill it in.
- An app step fails with “Needs reconnect”: the account's access was revoked or expired. Reconnect it in Settings → Integrations.
- It didn't run at the expected time: the schedule must be activated, and its time is in the trigger's timezone.
- A run shows as paused: it's waiting for someone in Reviews to approve or reject it.
- A step failed: open the run in History and check that step in the Trace tab for the error and what it received.
Generated from the agent's own workflow, so it always matches what the agent does. Last updated .