Skip to content
Pooya NikbakhtSenior full-stack & AI engineer

Project

AI workflow automation with human review and retries

A lead outreach run in progress: a stepper with the first step completed and the company lookup retrying after a simulated failure, next to a live log.
Multi-step AI workflows that run reliably in the background. Failed steps retry on their own, and a person checks each AI draft before anything is sent.

Problem

Useful AI features are rarely one question to an AI model. They are a chain of steps: look something up, have the AI study it, write a draft, let a person check it, then send it to another system. If all of that runs while someone waits on a web page, it can time out. One failed step can lose the whole job, and trying again can send the same email twice.

How it helps your business

  • No lost work. A failed step tries again on its own. A step that keeps failing ends the run cleanly instead of hanging.
  • Nothing sent twice. A retried step never sends the same email or update a second time.
  • A person stays in control. The AI's draft waits for approval, and every decision is saved in the run's history.

What it does

Two example workflows show how it works:

  • Lead outreach. A new lead comes in and the app looks up the company. The AI picks out the company's pain points and writes a draft email. A person reviews it, then the result is sent to another system.
  • Support ticket triage. The AI sorts the ticket and suggests a reply. A person reviews it, then it is sent.

You start a run and watch each step move from queued (waiting its turn) to running to done, with a live log. When the draft is ready, the run pauses and a review panel opens. You can approve the draft, edit it or reject it. Approved results go to a test receiver that stands in for your CRM or help desk.

Outcome

A working pattern for the multi-step AI features startups and product teams ask for: lead research, ticket triage, document processing or internal approvals, with the reliability parts (queues, retries, idempotency and human review) built in from the start.

  • Each step runs on a worker; a failed step retries with backoff, live.
  • The run pauses for a person to approve, edit or reject the draft.
  • Approved results reach the receiving system once, with a signature it checks.

How it's built

  • Queue and worker, not the web request. The API saves the run, queues the first step and returns right away. A separate worker process, which can run as several copies, picks up jobs from a queue with leases, so a crashed worker's job is picked up again.
  • Retries with backoff. The company lookup fails once on purpose, and you can watch it retry live. A step that keeps failing ends the run cleanly instead of hanging.
  • Safe to retry. Each step's state change, its log and the next job are saved together in one transaction. Jobs have unique keys, finished steps are never run twice, and the webhook carries an idempotency key the receiver checks, so a retried send never shows up twice.
  • Human in the loop. A paused run doesn't hold a worker. The reviewer's decision, and any note, is saved to the run's history.
  • Live updates. The stepper and log stream over Server-Sent Events and pick up where they left off after a dropped connection. Step changes are announced to screen readers.
  • AI with checked outputs. Claude returns structured output validated against a schema before the next step uses it. Without an API key, a built-in offline mode runs the same workflows.

The queue sits behind a small interface backed by SQLite, so it runs anywhere with no extra services; the README explains how to move it to Redis or SQS.

Stack

A Python FastAPI API and worker with 66 tests, a Next.js and TypeScript frontend, SQLite, Server-Sent Events, and Claude through the official SDK.

Want this for your business?

Send a short note on what you're building or the idea you have. I'll reply with questions and a rough plan. It's free, and I'd love to connect and help.

Typical timeline: 3 to 14 days · From $400. See AI assistants for your website