Automating ad management with rules — complete guide
Rules Engine: create rules, metrics, operators, actions, scope, schedule, protections, preview, templates, history. Mediabuyer automation hub.
Written By Salvatore Sinigaglia
Last updated About 5 hours ago
Rules Engine: create rules, metrics, operators, actions, scope, schedule, protections, preview, templates, history. Mediabuyer automation hub.
Automating ad management with rules — complete guide
TL;DR: Wevion's Rules Engine = if-then automation. Cron every 15 min evaluates active rules → SQS workers execute actions on matching entities. Verified: 34 condition metrics (19 universal + 15 Meta-only) + 6 actions + protections (cooldown / max-per-day / pending-check / failure-backoff / circuit breaker; budget-cap fields are configurable, enforcement is coming). Use for scale winners, kill losers, frequency caps, alert-only monitoring.
Table of contents
- Rules Engine overview
- Create your first rule
- Available metrics + operators
- Actions + scope
- Protections (cooldown + circuit breaker)
- Preview + templates
- Execution history
- Best practices
- Troubleshoot
- FAQ
- Next steps
Rules Engine overview
/rules. Each rule: scope (which entities) + conditions (when fire) + actions (what do) + schedule + protections.
Cron every 15 min evaluates rules with status: active + last_evaluated_at < 15 min ago → enqueues to SYNC SQS queue.
Create your first rule
/rules/new → 5-step wizard: scope → conditions → actions → schedule → protections.
Status starts paused. Use Preview before activating.
Available metrics + operators
- rul-103 available metrics — 34 condition metrics verified (19 universal + 15 Meta-only)
- rul-104 conditions + operators — 8 operators (gt / lt / gte / lte / eq / neq / between / not_between) + trend operators (extensions)
Time ranges: today / yesterday / last_3d / last_7d / last_14d / last_30d.
Actions + scope
6 verified actions:
pause— pause entityactivate— activate entityincrease_budget_pct/decrease_budget_pct— scale budgetrelaunch(Meta-only) — copy ad with new creativenotify_only— no action, just notification
Scope: ad_account_ids[] + entity_level (campaign / adset / ad) + entity_filter (name_contains / status_in).
- rul-105 actions overview
- rul-106 scope targeting
- rul-107 schedule — interval vs daily_at_time
Platform budget minimums apply (Google $1, TikTok $20-50, others $2).
Protections (cooldown + circuit breaker)
Verified protections:
cooldown_minutesdefault 360 (6h)max_executions_per_daydefault 3 (max 50)- Pending-action check (30 min)
- Failure backoff (skip an entity after 5 consecutive failures in 24h)
- Circuit breaker (auto-pause when error rate is above 50% with 20+ errors → status set back to
paused)
The rule also accepts budget_change_limit_pct / budget_daily_cap fields, but their enforcement is currently unverified — see rul-108 protections + cooldown.
Preview + templates
ALWAYS preview before activating:
POST /api/v1/rules/preview runs rule logic against current data WITHOUT triggering actions. Returns entities_evaluated / matched / skipped (with reasons).
Execution history
/rules/:id → executions tab. Per-fire log with entities counts + per-entity outcomes + metric snapshot.
automation_rule_execution table for fires + the audit log (/api/v1/audit-log) for lifecycle actions.
Best practices
Key recipes:
- Scale winners:
roas gt target × 1.2 AND spend gt 50 / last_3d → increase_budget_pct 20, cooldown 720, max 3/day - Kill losers:
cpa gt target × 1.5 AND spend gt 50 / last_7d → pause - Frequency cap:
frequency gt 5 / last_7d → pause - Daily spend protection:
budget_spent_pct gt 80 / today → notify_only
Troubleshoot
FAQ
Cooldown vs schedule — what's the difference?
Schedule = how often rule evaluates (every 15 min default). Cooldown = how long after acting on entity X before re-acting on same entity X (default 360 min).
Can a rule act on entities across multiple platforms?
Yes — single rule can have ad_account_ids[] from any platform. Actions apply per-platform (some action types are platform-specific, e.g. relaunch is Meta-only).
What happens at circuit breaker?
The rule's status is set back to paused (there is no separate error status), and it stops evaluating. Review last_error + auto_pause_reason, fix the cause, then manually re-activate.
Can I create rules with multiple conditions?
Yes. Multi-condition with AND / OR logic. Combine metrics across time ranges.
Templates vs build-from-scratch?
Templates accelerate common patterns. See rul-110 templates for built-in templates (kill_losers, scale_winners, frequency_cap, daily_spend_protection).
Bulk edit rules?
Yes — rul-112 bulk edit rules. Bulk pause/activate, bulk cooldown change, bulk delete.
Cross-platform rules?
Behind ENABLE_CROSS_PLATFORM_RULES env flag. Special template engine for cross-platform conditions.
Next steps
- First rule: rul-102 create first rule
- Understanding metrics: rul-103 available metrics
- Pick a template: rul-110 templates
- Best practices: rul-116 rule best practices
- Stuck: rul-118 rules troubleshooting
FAQ
Cooldown vs schedule — what's the difference?
Schedule = how often rule evaluates (every 15 min default). Cooldown = how long after acting on entity X before re-acting on same entity X (default 360 min).
Can a rule act on entities across multiple platforms?
Yes — single rule can have adaccountids[] from any platform. Actions apply per-platform (some action types are platform-specific, e.g. relaunch is Meta-only).
What happens at circuit breaker?
The rule's status is set back to paused (there is no separate error status), and it stops evaluating. Review lasterror + autopause_reason, fix the cause, then manually re-activate.
Can I create rules with multiple conditions?
Yes. Multi-condition with AND / OR logic. Combine metrics across time ranges.
Templates vs build-from-scratch?
Templates accelerate common patterns. See rul-110 templates for built-in templates (killlosers, scalewinners, frequencycap, dailyspend_protection).
Bulk edit rules?
Yes — rul-112 bulk edit rules. Bulk pause/activate, bulk cooldown change, bulk delete.
Cross-platform rules?
Behind ENABLECROSSPLATFORM_RULES env flag. Special template engine for cross-platform conditions.
Last updated: 2026-05-17