Skip to content

Key Features

John Jansen edited this page Feb 27, 2026 · 1 revision

Key Features

Beyond basic scheduling, anvil gives you several knobs to turn.

Priority Queue

Lower number = higher priority. Task p0 runs before p1, p1 before p2, etc.

anvil add -p 0 -s "*/5 * * * *" "Critical: alert if errors exceed threshold"
anvil add -p 5 -s "0 9 * * 1" "Weekly: audit dependencies"

Retry on Failure

Automatically retry failed tasks with exponential backoff:

---
schedule: "*/30 * * * *"
retry: 3
retry_delay: 2m
---

Retries at 2m, 4m, 8m intervals.

Pre-check

Skip the LLM call when there is nothing to do:

---
schedule: "*/30 * * * *"
pre_check: "gh issue list --state open --label untriaged | grep -q ."
---
Triage untriaged GitHub issues

The task only runs if the pre-check exits successfully.

Lifecycle Hooks

Run shell commands after success or failure:

---
schedule: "*/30 * * * *"
on_success: "echo 'done' >> /tmp/anvil.log"
on_failure: "curl -X POST https://slack.example.com/webhook -d '{\"text\":\"Task failed\"}'"
---

Tool Permissions

Pre-approve specific tools:

allowed_tools:
  - Bash(gh:*)   # only gh subcommands
  - Read
  - Write

Or skip all permission prompts:

skip_permissions: true

Pipelines

Link tasks together with depends_on:

---
schedule: "0 * * * *"
depends_on:
  - fetch-data
---
# Runs after fetch-data completes

Run anvil task pipeline to visualize dependencies.

SLA Tracking

Monitor and control task dispatch delays:

---
schedule: "*/30 * * * *"
sla:
  max_delay: 5m
  strict: true
on_sla_violation: "echo 'SLA missed'"
---

With strict: true, the task is skipped if it would miss the SLA window.

Execution Time Windows

Restrict tasks to specific times:

---
schedule: "*/30 * * * *"
allowed_window:
  start: "09:00"
  end: "18:00"
  days: "1-5"
---

Only runs during business hours on weekdays.

Checkpointing

Persist state between runs:

---
schedule: "*/30 * * * *"
checkpoint: true
---

Emit checkpoint data during execution:

##anvil:checkpoint {"last_processed_id": 42}

On the next run, the daemon injects this as ANVIL_CHECKPOINT_DATA.

Labels

Organize tasks with labels:

---
schedule: "*/30 * * * *"
labels:
  - triage
  - github
---

Filter with anvil task ls --label triage.

Quiet Hours

Pause non-critical tasks during certain hours:

quiet_hours:
  enabled: true
  start: "22:00"
  end: "07:00"
  exclude_priority: 0

Only p0 tasks run during quiet hours by default.

Webhooks

Get notified for task events:

webhooks:
  slack:
    url: "https://hooks.slack.com/services/xxx"
    events: ["success", "failure", "start", "timeout"]

Desktop Notifications

Native notifications for task events:

notifications:
  enabled: true
  on_failure: true
  on_success: false

Works on macOS, Linux, and Windows.

Clone this wiki locally