AxiomResend

Send Resend emails when an Axiom monitor fires

A Axiom + Resend agent flow

Axiom monitors run an APL query on a schedule and record each evaluation, but the result sits in the monitor's history unless someone is watching. A team that built log-based monitors in Axiom wants the owner emailed when a monitor evaluates into a triggered state. The agent reads the recent evaluations with getMonitorsHistory, finds the ones that crossed into triggered since the last look, and sends a message with Resend's send-email. Axiom answers the call rather than pushing, so the agent reads the history on a cadence and the email trails a trigger by your interval, going to one inbox instead of a shared feed.

The flow

AxiomgetMonitorsHistory

Gets the execution history of monitors.

Resendsend-email

Sends a single transactional email immediately or scheduled, with HTML/text, attachments, CC/BCC, and tags.

Step by step

  1. Map monitors to owners

    Decide which monitors matter and who owns each. Verify your sending domain in Resend so the first email lands. You can pull the monitor list with getMonitors to confirm names and IDs.

  2. Read the monitor history

    The agent calls getMonitorsHistory, reading each recent evaluation with its monitor, its outcome, and the time it ran.

  3. Find new triggers

    Compare the latest evaluations to the prior run. Email when a monitor's newest evaluation flips into triggered, and once when it next evaluates back to normal, so a monitor that stays triggered doesn't email on every read.

  4. Email the owner

    For each new trigger the agent calls send-email to that monitor's owner, with a subject naming the monitor, a body holding the outcome and time, a link, and a tag so Resend can filter them.

Tell your agent

Every five minutes, read Axiom monitor execution history. For any monitor whose newest evaluation just turned triggered, send a Resend email from axiom@acme.com to that monitor's owner, subject '<monitor name>: triggered', body with the outcome and time and a link, tagged 'axiom'. Send one recovery email when it next evaluates normal, and don't repeat while it stays triggered.

Setup

This flow needs both servers connected to your agent. Follow each install guide:

Worth knowing

  • getMonitorsHistory returns evaluation records, so the agent tracks each monitor's last seen outcome and emails on the flip into triggered, not on every history read, or a monitor evaluated each minute would email every minute.
  • send-email needs a verified Resend domain with SPF and DKIM. An unverified from address means the email fails to deliver silently.
  • A monitor that evaluates often can flip in and out. If that's noisy, only email after it reads triggered on two consecutive evaluations so a single blip doesn't fire mail.

Questions

Why email when Axiom already has notifiers?
Axiom notifiers are configured per monitor. This lets one agent read every monitor's history, route each trigger to its owner, and write the email itself, so you manage routing in one place rather than per monitor.
Does it email the instant a monitor triggers?
No. Axiom records the evaluation, and the agent reads that history on its schedule, so the email trails the trigger by your interval. A five-minute loop suits most log monitors.