Project 9 — Deterministic plus agentic workflow
Practice this questionRequirements
Interpret input, prepare a draft, validate required fields, wait for review, execute once, and notify reliably.
Architecture
AI interpretation → deterministic state machine → durable approval wait → idempotent service → outbox notification.
Technologies
Existing AI/graph layer plus Temporal or another justified durable workflow, or BullMQ with explicit application state for simpler jobs.
Database design
Draft versions/hashes, approval records, operation keys/receipts, workflow status, and outbox events.
API design
Draft create/edit/review/submit/status; require expected version and operation key; expose uncertain outcome explicitly.
AI design
Language extraction and draft wording only; code controls calculations, permissions, retries, and transitions.
Security
Authenticated exact-action approval, current-rule checks at commit, least-privilege activities, safe recipient validation.
Evaluation
Duplicate messages, worker crashes, stale approvals, transaction/dispatch gaps, external timeout, and compensation limits.
Observability
Workflow events, wait age, retry counts, receipt links, unknown outcomes, and notification lag.
Deployment
Durable storage and timers, worker recovery, schema/version migration, redrive/reconciliation operations, and backup restore test.
Interview questions
- “Exactly once?” Answer: design effectively-once business effects through deduplication and reconciliation; do not assume the network guarantees it.
- “Can every action be undone?” Answer: disclosure and email often cannot.
Acceptance: The same approved logical request creates one effect across retries and restarts.