Skip to content
NEXVYRA LABS home

Automation

Design automations that fail loudly

The most expensive automation is the one that stopped working three weeks ago and nobody noticed. Principles for workflows that are visible, recoverable and safe to rely on.

NEXVYRA Labs Engineering2 min read

Automations are usually built to handle the happy path: a form arrives, data is copied, a notification is sent. Real operations are full of exceptions — missing fields, duplicate records, a third-party API that is down for an hour. Whether an automation saves time or quietly creates a mess depends on how it behaves when something goes wrong.

Give every run a visible state

Each item moving through a workflow should have a status you can look up: received, processing, waiting for approval, completed, failed. If the only way to know whether something happened is to check three different tools, you do not have an automation — you have a guessing game.

Make steps safe to retry

Networks fail and services time out, so retries are inevitable. A step is idempotent when running it twice has the same effect as running it once — for example, creating a record only if one with the same external ID does not already exist. Without this, a retry can send two invoices or book the same appointment twice.

ts
async function createInvoiceOnce(orderId: string, payload: InvoiceInput) {
  // Use a stable key derived from the business event, not a random ID.
  const key = `invoice:${orderId}`;
  const existing = await invoices.findByIdempotencyKey(key);
  if (existing) return existing; // safe to retry
  return invoices.create({ ...payload, idempotencyKey: key });
}

Design the exception path first

For every workflow, decide upfront what happens to the cases it cannot handle. The best default is an exception queue: a single place where items that need a person land, with enough context to resolve them quickly — what was attempted, what failed and what the original input was.

  • Retry transient errors automatically, with backoff and a limit.
  • Route permanent errors — invalid data, business-rule failures — to a person.
  • Never drop an item silently; every input ends in a known state.

Treat AI steps as probabilistic

Classification, extraction and drafting by AI models are powerful additions to a workflow, but they are not deterministic. Validate their outputs against a schema, check confidence where you can, and send uncertain or high-impact results for review rather than straight into a system of record.

Alert on silence, not just errors

Error alerts catch crashes. They do not catch a webhook that stopped firing or a filter that now matches nothing. Monitor expected volume as well: if a workflow that normally processes forty items a day processes none, that deserves an alert even though nothing technically failed.

Written by the NEXVYRA Labs engineering team. Talk to us about applying this to your systems.

Start a conversation

Your next big idea starts here.

Tell us what you’re trying to achieve. We’ll help you work out what to build, how to build it and what it will take.