Skip to main content

CASE STUDIES / OWN PRODUCT / MULTI-STEP AGENT OR WORKFLOW

A local-first pipeline that refuses to act without review

186 tests Measured cover 1,376 lines Measured of code that plans and carries out each action, and live mode is refused in code until a written go-live gate is passed.

The problem

The job: plan and carry out repetitive actions on an external web platform for a single operator. A wrong action there is public and cannot be undone, and the platform sets limits on how much a single account may do.

So the system is built to say no. It plans by default, acts only on approved templates, stays under daily caps and stops itself at the first sign of trouble.

Constraints

  • Nothing runs live without an explicit approval.
  • Data stays on the laptop: a local database file, no cloud database and no third-party HTTP client.
  • Any sign of trouble stops everything, and only the operator can clear it.
  • Volume stays under daily caps set below the platform's own limits, inside a working-day window, never in bursts.

Who did what

As the product owner

  • Set the rules: what may run, how much and when to stop.
  • Approves every template before it can be used.

I built

  • The planner: a queue becomes a dated plan, dry run by default
  • The executor, with a halt check before every page load
  • Caps, scheduling and write-ahead counting
  • Preflight checks: folder permissions, a single-instance lock and an identity check
  • The test suite

My own tool, so I was the client. No partner was involved in this build.

Step through a run

Sample run on a made-up queue

Plan

Each queued action becomes a planned row. By default it is a dry run: the row is logged and nothing moves forward.

  • Mode Note:dry run
  • State change Note:none, logged only

Template check

An action with no approved template is blocked, never improvised.

  • Follow-up action OK:approved template found
  • New action type Fails:no template, blocked

Caps and schedule

Each action type has its own daily cap. Over the cap, the action is deferred to the next day. Actions run only inside a working-day window, a few minutes apart, so a run never bursts.

  • Under the daily cap OK:scheduled
  • Over the daily cap Note:deferred

Execute and watch

Each read is counted before the page is requested, so a crash still counts it. Before every page load the executor checks the halt flag.

  • Halt flag OK:clear
  • Page load OK:normal

Halt

Anything the platform puts in the way trips the halt: a verification check, a sign-in form, a warning banner or a page that redirects to itself. The system never tries to get past it. It records the first cause, stops, and only the operator can clear it. Clearing it does not resume the run.

  • Anomaly Fails:warning banner
  • Run Fails:stopped
  • Resume Note:operator only

Timeline

First commit to a working dry-run planner
The same day Measured
First commit to the current code
12 days Measured
Live mode
Refused in code. It stays refused until a valid approval file exists for the run, and that gate is the next build.

Scope receipt

Build record

Milestone tier
Multi-step agent or workflow
Stack
Python standard library, SQLite, a local browser session
Evidence basis
Counted from the source and git history of the repository.

Done-checklist

  • Live mode raises an error in code.
  • Dry run is the default.
  • No approved template, no action.
  • A daily cap for each action type, plus a rolling cap on reads.
  • Reads are counted before the request.
  • A halt flag is checked before every page load.
  • Only the operator can clear the halt.
  • The database, the session folder and the halt file stay out of version control.
  • A result counts only if it came from the exact scorer version that was tested.

What I would do differently

A scorer that ranked queued records by fit failed 3 back-tests Measured and I closed it unpassed. I set its pass bar after building it. Next time the bar comes first, so a scorer that cannot pass is caught before it is built.

A volume target counted raw new records, not qualified ones, so meeting it rewarded collecting the wrong records. I reverted it. A target should count the thing you actually want.

Have a client who needs this?

I build work like this for agencies and consultants, under your brand, at a fixed partner price per milestone.

Book a partner call