Agent context
Klaviyo models
5 SQL models that turn the raw Klaviyo tables into the reports people ask about. Deploy them in Weld and your agent queries the definitions behind every number.
How the set is built
- 7Raw tables
- 1Staging
- 5Core
- 4Analytics
Staging cleans each raw table once, core holds the logic, and analytics is the table dashboards and agents read.
- Monthly User Engagement per CampaignCalculates the monthly user engagement per campaign using data from Klaviyo integration. It extracts the year, month, campaign ID, event name, and counts the number of unique persons for specific events. It then aggregates the counts for each event type and campaign, grouping them by year, month, campaign ID, and campaign name. The final result is ordered by year, month, and campaign name.3 raw tables
- Monthly Campaign Status Breakdown by ListGenerates a monthly breakdown of campaign status for a specific integration with Klaviyo. It retrieves the number of campaigns, the number of campaigns sent, the number of campaigns in draft and scheduled status, as well as other campaign statuses if needed. Additionally, it includes the list name, the number of lists used, and the last send time. The results are grouped by campaign month and list name, and ordered in descending order of the campaign month.4 raw tables
- Monthly Flow EventsGenerates a report of monthly flow events from the Klaviyo integration. It calculates the total number of events triggered and the number of distinct persons triggered for each flow in a given month. The result includes the month, flow ID, flow name, flow status, trigger type, total events triggered, and distinct persons triggered, ordered by month and flow name.2 raw tables
- Email EventsRetrieves various event details from the Klaviyo integration, including the event ID, timestamp, event name, custom properties, Klaviyo properties, UUID, person ID, metric ID, campaign ID, flow ID, flow, attributed event ID, message ID, send cohort and order ID (if the event name is "Placed Order"). The results are ordered by the event timestamp in descending order.2 raw tables
- Events Flow Campaign Report Retrieves data from the Klaviyo integration to generate an Events Flow Campaign Report. It combines information from the events, campaign, and flow tables to provide details such as event timestamps, event names, custom properties, Klaviyo properties, metric IDs, campaign IDs, person IDs, flow IDs, attributed event IDs, message IDs, send cohorts, order IDs, flow names, flow statuses, campaign names, and campaign send times. The final result is sorted in descending order based on the event timestamps.4 raw tables
- Weld or dbt
- The same SQL in both dialects. Sync the folder with GitHub Sync, or copy the dbt models into your project.
- Check before you rely on it
- Reconcile a month against Klaviyo's own reports first. Each model's notes say what the synced data can and can't support.
Connect Klaviyo.
Your agents start with context.
Sync Klaviyo to your warehouse, deploy these models, and query them from Claude, Cursor or ChatGPT over MCP. Free for 14 days, no credit card.