# Audit Klaviyo Flows

Yes. An agent reads every Klaviyo flow and its step metrics, then writes flow-audit.md on gaps, weak steps and missing flows.

[Run this on Rush](https://cloud.getrush.ai/run/flow-audit/klaviyo/).

## What the agent does

The account is a Klaviyo connection and nothing else. Catalog entry: official MCP server at https://mcp.klaviyo.com/mcp, OAuth, and the catalog text says the user needs an Owner, Admin or Manager role. Connect once, name the connection on the session, and the key run receives only that name. This job is a read. Klaviyo's tool table marks get_flows, get_flow, get_flow_action, get_flow_message and get_flow_report as read-only and available on the remote server. update_flow is described there as updating a flow's status, and it is not read-only. The prompt does not allow update_flow, delete_flow, create_flow or update_flow_action.

The agent calls get_flows for the full list, then get_flow for each id so status and trigger are taken from the detail rather than from the list row alone. get_flow_action and get_flow_message describe the steps. get_flow_report covers the last 90 days of performance. Per-step click rate is whatever statistic that report returns for the action. The agent computes the flow's average click rate from those step figures and flags a step whose click rate is at or below half that average. If the report has no click statistic for a step, the step is listed as not measured, not as half of zero. Draft and manual statuses are whatever status strings get_flow returns; the file quotes them and does not translate an unknown status into draft.

The four flows the prompt treats as standard are welcome, abandoned cart, browse abandonment and win-back. The agent matches them by trigger and by name, using get_flows_triggered_by_metric, get_flows_triggered_by_list and get_flows_triggered_by_segment when the trigger is a metric, list or segment. A flow that is missing is one of those four with no matching live flow. A flow that exists but is off is listed under status, not under missing. The agent does not create the missing flow.

flow-audit.md has three sections: flows whose status is not live, with the status string quoted; steps at or below half the flow's average click rate, with the two numbers; and which of the four standard flows are absent, with the trigger the agent looked for. A closing line repeats that no flow was updated.

## Start it with one API call

`POST https://api.prix.dev/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Use the Klaviyo connection to read every flow. Call get_flows, then get_flow, get_flow_action, get_flow_message and get_flow_report for the last 90 days. Write flow-audit.md listing flows whose status is not live (quote the status), steps whose click rate is at or below half that flow's average (show both numbers; if click rate was not returned, say not measured), and which of welcome, abandoned cart, browse abandonment and win-back are missing. Match those four by name and by trigger, using get_flows_triggered_by_metric, get_flows_triggered_by_list and get_flows_triggered_by_segment. Do not call create_flow, update_flow, delete_flow or update_flow_action.",
  "connections": [
    "klaviyo"
  ]
}
```

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.prix.dev/o/{org}/sessions, with your repository as the resources URL. 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

flow-audit.md is the artifact. The session lists it with a url that downloads the file without a key for an hour. result is a count of not-live flows, weak steps, and missing standard flows, small enough for the webhook's 16 KiB result cap. The sections with the quoted statuses stay in the file.

Review means opening one flagged step and finding its get_flow_report result in the transcript. The half-average comparison should be reproducible from the numbers in that payload. A status of manual or draft should appear as the API spelled it. The missing-flow section should name the trigger that was searched, so a welcome flow that is live under another name is not reported as absent without that search being visible. update_flow must not appear.

Turning a flow on, or building a missing abandoned-cart flow, is a later decision. This file does not change status. A follow-up on the parked session can ask for a proposed trigger for one missing flow, still without calling create_flow, if you want a design note before anyone builds it.

## Run it on every first Monday of the month

Your scheduler POSTs this body on the first Monday, with the year and month as the Idempotency-Key. A second tick that morning returns the same session. The 90-day window is inside the prompt, so each month's report overlaps the previous one on purpose; the file is a fresh read, not a delta against last month's artifact.

The key's webhook receives run.completed and session_url. Check the signature, store flow-audit.md, and only then notify the channel. A 202 from the original POST is the session starting, with status allocating. Wait for the webhook or for GET /o/{org}/sessions/{id} to leave running. Starting more audits than max_concurrent (default 4) returns 429.

## Why run it on Rush?

Flow status and a 90-day step report are a lot of get calls, and the same server exposes update_flow, which changes status. The prompt lists the read tools and names the write tools it must not call. The work happens in a sandbox whose only Klaviyo access is the connection on the request. An analyst's laptop does not need a key that can change a live flow.

The half-average rule is crude, and the file shows the numbers so a person can throw the flag out. That is the point of keeping the report payload in the transcript. One account is one session. A second Klaviyo account is a second connection name and a second session, not a shared login.

## Frequently asked questions

### Will it turn a draft flow live?

No. update_flow is the tool Klaviyo describes as updating a flow's status, and the prompt forbids it, along with create_flow, delete_flow and update_flow_action. The audit quotes status and stops. Changing a status is a person in Klaviyo, after they agree with the section.

### How does it decide a standard flow is missing?

By name and by trigger, not by name alone. It uses get_flows_triggered_by_metric, get_flows_triggered_by_list and get_flows_triggered_by_segment. A live flow with an unusual name and a cart-checkout trigger should not be called a missing abandoned cart. The section says which trigger it matched. If nothing matches, it is listed as missing.

### What if a step has no click rate?

The step is marked not measured. It is not compared with half the average, and it is not given a click rate of zero. The average is computed from steps that did return a click rate. A flow whose report returned no click rates is described that way, with no weak-step flags.

### Does the remote server include these flow tools?

Klaviyo's tool table marks get_flows, get_flow, get_flow_action, get_flow_message and get_flow_report as available on the remote server, and as read-only. The remote server loads a core set unless core-tools-only is left disabled, which their docs describe as the way to load the full set. If a tool is missing from the connection, the report says which call failed instead of skipping the section silently.
