Skip to content

Repository files navigation

Agentic Workflow Platform

A governed, inspectable multi-agent evaluation platform for fully synthetic loan-servicing tickets. It compares a single prompt, retrieval grounding, and a typed planner/specialist/reviewer workflow while recording quality, latency, cost, escalation, fairness, redaction, and every hand-off.

No Nelnet, borrower, or production data is included. The committed results are deterministic offline test-double measurements, not resume-ready model claims.

Evidence dashboard showing arm accuracy and run metrics

Measured offline evidence

The reproducible 150-case suite currently records:

Arm Fact recall What changed
Baseline 36.1% Ticket-only single prompt
+ retrieval 91.3% Synthetic policy grounding
Full 100.0% Retrieval + parallel specialists + independent review

These values are stored in baselines/offline.json and gated in CI with a maximum 3-point accuracy drop. They validate the harness, not real-model performance. Run the live sweep before using any number externally.

System

flowchart LR
    T["Synthetic ticket"] --> G["PII redaction gate"]
    G --> P["Planner"]
    P --> R["Retriever"]
    P --> A["Analyst"]
    P --> D["Drafter"]
    R --> V["Reviewer"]
    A --> V
    D --> V
    V -->|confidence ≥ τ| X["Accept"]
    V -->|confidence < τ| H["Human review queue"]
    G -. every call .-> S[("PostgreSQL audit trail")]
    X --> S
    H --> S
    S --> API["FastAPI registry"]
    API --> UI["React evidence dashboard"]
    S --> M["Markdown + plot reports"]
Loading
  • Every graph edge is validated with a strict Pydantic v2 contract.
  • Retriever, analyst, and drafter run concurrently through LangGraph.
  • A single governed model client handles redaction, token/cost accounting, stable rehydration, latency, payload hashes, errors, and audit writes.
  • Exactly five registry tables preserve experiments, runs, steps, case results, and reports.
  • The dashboard exposes accuracy, cost/latency, fairness, and case-level traces.

Run it

Docker Compose starts PostgreSQL 16, migrates the schema, serves the API and dashboard, and runs one offline three-arm sweep:

cp .env.example .env
docker compose up --build

The worker exits successfully after seeding the registry; refresh the dashboard when it finishes. Stop the stack with docker compose down.

For local development:

uv sync --frozen --extra dev
npm --prefix web ci
uv run alembic upgrade head
uv run uvicorn agentic_workflow.api:app --reload
npm --prefix web run dev

Evaluate

# Deterministic, free, 150 cases × 3 arms
uv run agentic-workflow eval --provider offline

# Recompute the full arm and enforce the committed 3-point budget
uv run agentic-workflow gate

# Real OpenAI calls; requires OPENAI_API_KEY and the optional PII dependencies
uv run --extra pii python -m spacy download en_core_web_sm
uv run --extra pii agentic-workflow eval --provider openai

Model names come from .env; token prices are versioned in api/agentic_workflow/pricing.json. Each run emits a Markdown report and Matplotlib plots under reports/.

Governance and evaluation

Control Evidence
Privacy Stable-token redaction for name, email, phone, SSN, account, address, DOB, IP, and loan ID
PII measurement 200 labelled synthetic records; deterministic fallback recall is 200/200
Fairness Accuracy by language, balance band, and region, plus max–min gap
Auditability Model, tokens, cost, latency, redaction count, confidence, status, error, and payload hash per step
Reliability Provider failures are isolated per case and counted as hand-off failures
Human oversight Low-confidence work is escalated; review state and notes are editable through the API
Regression safety Reproducible datasets plus pytest -m eval on every pull request

The golden set contains exactly 150 deterministic cases across late-payment, payment-allocation, and identity-verification workflows. data/review-log.csv deliberately marks every item pending: no human correction or judge-agreement claim is made until a reviewer signs that ledger. Scoring is deterministic fact-level recall so CI is stable; live-model and human-review results belong in a new labelled baseline.

Useful API routes

Method Route Purpose
GET /health Service health
GET/POST /api/experiments Experiment registry
GET /api/runs Run history and metrics
GET /api/runs/{id}/fairness Slice metrics and gaps
GET /api/runs/{id}/cases Case results
GET /api/runs/{id}/cases/{case_id} Typed hand-off trace
PATCH /api/case-results/{id}/review Human review state

Verification

make lint
make test
make gate
npm --prefix web run build
docker compose config --quiet

The CI workflow runs those backend, frontend, dataset-reproducibility, and container-configuration checks independently. See docs/superpowers/specs/ for the design rationale and docs/superpowers/plans/ for the implementation record.

Known limits

  • The bundled provider is a deterministic test double; live OpenAI metrics are intentionally absent until credentials are supplied.
  • The synthetic golden set is generated and machine-verified, not yet hand-corrected. Do not claim otherwise.
  • Stable string matching makes the CI scorer reproducible but is stricter than a calibrated LLM judge. Add a blinded 30-case human agreement study before making judge-quality claims.

About

Governed multi-agent workflow evaluation with LangGraph, FastAPI, PostgreSQL, and React

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages