Workflows
Performance Snapshot
Capture a point-in-time KPI snapshot for trend tracking and learning insights.
Performance Snapshot Workflow
The Performance Snapshot Workflow captures a tenant's marketing KPIs at a point in time and persists them for trend analysis and the Self-Optimization loop.
When it runs
- Inngest cron, fanned out per tenant
- Default cadence: weekly
- Also triggered ad hoc by the Analyst when investigating an anomaly
Inputs
| Field | Type | Description |
|---|---|---|
period | 'day' | 'week' | 'month' | Aggregation window |
resourceId | string | Tenant ID |
What's captured
| Metric | Source |
|---|---|
| Published content count | ContentPiece table |
| Average eval scores (brand voice, quality, citability) | Eval results |
| Engagement rate | query_post_analytics |
| Channel-level CTR / conversions | query_ga4 |
| Lead volume | Event table (eventType='lead_logged') |
| Workflow durability metrics | Inngest run records |
Steps
- Aggregate KPIs — Roll up the metrics above for the requested period.
- Compare against the prior snapshot — Compute deltas and flag significant changes.
- Persist — Write a
performance_snapshotrow keyed bycustomerId + capturedAt. - Feed Self-Optimization — The snapshot is one of the inputs the Self-Optimization workflow uses to update routing weights and autonomy levels.
Querying snapshots
The Analyst uses the get_performance_trend tool to read snapshots over a date range; the get_learning_insights tool surfaces the most actionable deltas.