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 4 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

/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)

Verified protections:

  • cooldown_minutes default 360 (6h)
  • max_executions_per_day default 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

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