Back to Portfolio

Complete Build Tutorial · Signal to Verified Recovery

RelayOps
Incident Workflow Platform

A production incident workflow platform with grounded AI diagnosis. Process financial integration incidents through eight quality gates (environment, vertical slice, simulator, integrations, diagnosis, safe actions, evaluation, operations) with deterministic recovery. Built completely end-to-end from empty folder to fully working portfolio.

End-to-End SliceScenario EngineIntegrations & RetriesGrounded DiagnosisSafe Actions & MCPEvaluation & GatesOperations & Deploy

Status: Complete Build

A 6-week core build + 2-week hardening and packaging tutorial. Covers all eight no-skip gates, deterministic testing, production deployment, and operational resilience. Uses synthetic financial data; no real customer or credentials in any phase.

The problem

Financial integration incidents are chaotic and slow to resolve. When a broker token expires, data entitlement fails, or a payment webhook duplicates, operators dig through logs manually:

How it works

RelayOps ingests incidents, surfaces ranked root-cause hypotheses, proposals safe recovery actions with explicit approval, and verifies recovery through deterministic checks. Every stage has a gate; you pass only when that capability is proven.

Gate 0

Environment

Git, Docker, Python, Node.js, pnpm report usable versions

Gate 1

Vertical Slice

Create incident through API, store in PostgreSQL, read it back in browser

Gate 2

Simulator

Same seed reproduces same incident, evidence and recovery condition

Gate 3

Integrations

Retries, idempotency and failure injection visible in incident timeline

Gate 4

Diagnosis

Model returns schema-valid hypotheses with citation IDs in evidence set

Gate 5

Safe Action

No consequential tool runs without exact, unused approval-bound payload

Gate 6

Evaluation

Holdout quality gates pass, unsafe actions remain exactly zero

Gate 7

Operations

System survives model outage and remains usable in read-only degraded mode

Architecture

Next.js frontend, FastAPI backend with SQLAlchemy models, PostgreSQL with pgvector for evidence retrieval, deterministic scenario engine, grounded AI diagnosis, MCP tools for safe actions, and evaluation harness with quality gates that block releases on model regression.

Next.js Web App

Operator console: displays incidents, evidence, ranked hypotheses, approvals and recovery.

Typed API client with schemas validated by Pydantic on the backend.

FastAPI Service

State machine, tenant context, authorization, audit log and REST API.

Dependency injection provides database session to every route.

PostgreSQL

Persists incidents, evidence, proposals, approvals and audit events.

pgvector extension supports runbook retrieval with stable citation identifiers.

Scenario Engine

Creates deterministic incident families with known answers and repeatable seeds.

Fixtures built into the evaluator; the model proposes, deterministic core checks.

AI Diagnosis Service

Returns typed hypotheses whose citation IDs exist in evidence set.

Prompts use ground truth from scenarios, never the answer key.

MCP Tools

Typed interface to sandbox operations: rotate tokens, repair idempotency.

Tool contracts include permissions and side-effect control.

Evaluation Harness

Scores 40 versioned scenarios and blocks releases when quality or safety gates fail.

Metrics, holdouts and release discipline prevent model regressions.

Operations Layer

Docker, CI, telemetry, load tests, outage drills and recovery evidence.

Production ownership wired through every phase, not bolted on at the end.

Why deterministic scenarios

A human tester or external SLA could inject incidents, but you lose reproducibility. RelayOps seeds scenarios with known answers, injects them at the evaluator level, and keeps the application seeing only observable, repeatable synthetic data. The model never sees expected root cause, approved tools, or recovery condition.

Every scenario verifies that the model can rank real root causes above plausible decoys, and that proposed actions stay within the approval contract. Quality gates ensure the model never regresses.

Eight no-skip production gates

Each gate verifies a specific piece of production readiness. You cannot skip a gate and you cannot soft-fail one. The tutorial walks through all eight.

Eight incident families

Expired broker token, missing data entitlement, duplicate payment webhook, settlement schema drift, reconciliation mismatch, processor retry storm, audit pipeline interruption, model provider outage, each with known root cause, approved recovery and deterministic check.

Grounded diagnosis

AI turns evidence into ranked hypotheses without inventing claims. Every hypothesis cites evidence IDs. The model never sees root cause, approved tools or recovery condition.

Safe action proposals

Tool proposals include exact arguments bound to an approval record. Execution reads approvals from the database. The executor cannot run a tool outside its approval contract.

Deterministic scenario engine

Same seed reproduces the same incident, evidence timeline, and recovery check. Injection happens at the evaluator level. The application sees only observable, repeatable synthetic data.

Production readiness gates

Every gate verifies a specific capability: environment setup, vertical slice, deterministic repetition, real integrations, grounded diagnosis, safe actions, quality evaluation and operational resilience.

Stack

TypeScriptReactNext.jsPythonFastAPIPostgreSQLpgvectorOpenAILangChainMCPDockerCI/CDObservability

See the complete build

The complete tutorial covers every phase from environment setup through portfolio-ready deployment. Real production practices built in from week one, not retrofitted at the end.