What the agent does
This is for a software company that sells email and SMS reporting to online stores that run their marketing in Klaviyo. A store's welcome series, abandoned-cart and post-purchase flows earn money every day without anyone looking at them, which is also why nobody notices when one stops. A changed list, a renamed event from the store's checkout, a filter edited during a sale, and a flow that is still marked live sends to nobody for weeks. The app adds a Flow health section to each store's Monday report, written by an agent that reads the store's own Klaviyo account and compares each live flow's week with its usual one.
The company saves the agent once as a template with POST /o/{org}/agents, with "connections": ["klaviyo"] (connecting a Klaviyo account of its own first, because a template names connections its creator has) and instructions that keep it to reading. When a store turns Flow health on, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "flows-<store id>"}, then POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "klaviyo"}, and opens the authorize_url in a popup while the store's marketer is signed in to the app. Klaviyo's docs say its remote server signs in with OAuth and is open only to users with the Owner, Admin or Manager role, so the app asks for one of those.
On a run the agent calls get_flows, filtered to flows whose status is live and not archived, and keeps each flow's name, trigger_type and updated time. It calls get_metrics to find the store's Placed Order metric, which Klaviyo's flow report takes as conversion_metric_id. Then it calls get_flow_report twice, once for the last 7 days and once for the 28 days before, with recipients, delivered, bounced_or_failed and conversions as statistics. Klaviyo groups the report by flow_id and flow_message_id, so the agent adds each flow's messages together.
It flags a live flow that had recipients in the earlier weeks and none this week, one whose recipients fell below 40 percent of its weekly average, and one whose bounced_or_failed share rose sharply. Each flag carries the flow's trigger type and when it was last edited, because a flow edited this week and a flow nobody touched point to different causes. It writes the store's section and changes nothing in Klaviyo: no flow status, no list, no message.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Check my Klaviyo flows for the week 2026-11-09 to 2026-11-15, read only. 1) Call get_flows filtered to status live and archived false; keep id, name, trigger_type, updated. 2) Call get_metrics and find the Placed Order metric id. 3) Call get_flow_report with statistics recipients, delivered, bounced_or_failed, conversions, conversion_metric_id set to that metric, for a custom timeframe 2026-11-09T00:00:00 to 2026-11-16T00:00:00, then again for 2026-10-12T00:00:00 to 2026-11-09T00:00:00. Sum each flow's messages. 4) Flag a live flow if: it had recipients in the 28-day window and none this week; its recipients this week are under 40% of its 28-day weekly average; or its bounced_or_failed share is at least 3 times its 28-day share. Write flow-health.md (flagged flows first: name, trigger type, last edited, recipients this week vs weekly average, bounced_or_failed share, conversions) and flow-health.json with the same fields. Do not call update_flow, delete_flow, update_flow_action or any other tool that changes Klaviyo."
}- 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.phoenix.so/o/{org}/sessions. 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
The session returns flow-health.md and flow-health.json as artifacts. The app's webhook handler reads the JSON into the store's Monday report: flagged flows at the top with this week's recipients against their usual week and when each was last edited, then a single line for every flow that looks normal.
What the store's marketer checks: whether a flagged flow was paused or narrowed on purpose, for example a holiday flow that should go quiet; and for a flow that dropped to zero with no edit, the event or list that triggers it, since a flow can stay marked live after the event that starts it has stopped arriving. A small store's flows can swing week to week on a handful of orders, so the app shows the numbers beside each flag and the marketer judges whether a drop is real. The report is about volume, not about whether a flow's emails are good.
Run it on every Monday morning, per store
The app's scheduler sends one POST /o/{org}/sessions per store with Flow health on, early Monday in the store's time zone, with that store's agent id as agent, the week's dates in input, and a request_id that is a UUID v5 of the store id and the week, so a retried job starts no second run. Runs past the key's max_concurrent wait as queued, and the key's webhook brings each run.completed to the app.
Klaviyo's reporting endpoint for flows allows a small number of calls per day for each account, and this check makes two, so a store can also press Check flows now in the app after an edit without crowding out the Monday run.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Each store's Klaviyo sign-in belongs to that store and is stored in Rush's connection under that store's agent. The app runs no Klaviyo OAuth app and keeps no tokens, and one store's agent cannot read another store's flows. The session's accounts lists the Klaviyo connection every run used, so the app can show a store each time its account was read.
Each run has its own computer and a record of every Klaviyo call it made, which matters because the same sign-in could pause a flow or send a campaign. The app adds up each store's run costs with GET /o/{org}/sessions?agent=<agent id> to price the feature, and a new statistic Klaviyo adds to its flow report is one edit to the template's instructions, which reaches every store's next run.
Frequently asked questions
Why does the app ask for an Owner, Admin or Manager?
Klaviyo's docs say the remote MCP server is available only to users with one of those roles. A marketer with a lower role cannot finish the sign-in, so the app asks whoever owns the account to connect it.
Could the agent turn a flow off?
Klaviyo's server has update_flow, which changes a flow's status, and other tools that write. The template's instructions and every prompt forbid them, and the run's record lists every call. Klaviyo also documents a read-only=true parameter on the server's URL that removes the writing tools.
Why does the report need the Placed Order metric?
Klaviyo's flow report takes a conversion_metric_id for its conversion statistics. The agent finds the store's Placed Order metric with get_metrics each run, so a store that uses a different order event can name it in the prompt instead.
Does it read customers' profiles or emails?
No. It reads flows, metrics and the flow report, which are counts. Klaviyo marks the tools that read profiles and events as reading user-generated content, and this check calls none of them.
More Klaviyo jobs
More jobs like this: Run an agent per customer task
- Which Wedding Inquiries Haven't I Answered? Studio Software That Checks Each Photographer's Gmail Every Morning (Gmail)
- How Can Recruiting Software Find Next Week's Interviews a Candidate Hasn't Accepted? One Agent per Recruiter, Reading Their Microsoft Calendar (Microsoft Calendar)
- Which Donors Gave Last Year but Not This Year? A Fundraising App's Monthly Airtable Check for Each Nonprofit (Airtable)