Automating ad management with rules — complete guide

Last updated: May 19, 2026

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: 22 conditions + 6 actions + 5 protections (cooldown / max-per-day / budget caps / pending-check / circuit breaker). Use for scale winners, kill losers, frequency caps, alert-only monitoring.

Table of contents

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

Time ranges: today / yesterday / last_3d / last_7d / last_14d / last_30d.

Actions + scope

6 verified actions:

  • pause — pause entity

  • activate — activate entity

  • increase_budget_pct / decrease_budget_pct — scale budget

  • relaunch (Meta-only) — copy ad with new creative

  • notify_only — no action, just notification

Scope: ad_account_ids[] + entity_level (campaign / adset / ad) + entity_filter (name_contains / status_in).

Platform budget minimums apply (Google $1, TikTok $20-50, others $2).

Protections (cooldown + circuit breaker)

5 verified protections:

  • cooldown_minutes default 360 (6h)

  • max_executions_per_day default 3 (max 50)

  • budget_change_limit_pct per-action cap

  • budget_daily_cap per-day cap

  • Circuit breaker (auto-pause at 50% error rate + 20 errors → status: error)

  • rul-108 protections + cooldown

Plus exponential backoff on individual failures.

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 + ai_action_log for audit.

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: daily_budget_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?

Rule's status flips to error. Stops evaluating. Admin reviews last_error + auto_pause_reason + manually re-activates.

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

Related