CareerTalkLab turns real industry news into Business English lessons for Turkish professionals, using AI to draft each lesson and a person to approve it. This post explains how I made that process reliable, affordable, and safe.
Single-shot LLM prompts work fine when you only need one draft in one format.
They break down once a curriculum pipeline has to turn an untrusted news article into three lessons at different CEFR levels (B1 intermediate, B2 upper-intermediate, C1 advanced) and enforce strict pedagogical rules before spending judge tokens. At production scale, it also has to repair only the failing JSON sections and pause safely for human review inside a 60-second serverless limit.
When I rebuilt CareerTalkLab’s production AI workflows, the goal was not to wrap every feature in an autonomous agent loop. It was to reserve stateful LangGraph orchestration strictly for places with cyclic repair, multi-turn pedagogical scaffolding, or durable human-in-the-loop interrupts, while keeping attainment tracking, credit ledgers, and foundational drills in deterministic PostgreSQL and TypeScript.
Result: In a 20-article test, the pipeline went from producing usable lessons 25% of the time to 85%, stopped timing out entirely (11 of 20 runs → 0), and got cheaper to run ($1.02 → $0.89 for the full test), with the AI spending 71.9% less effort on internal “thinking.”
Where stateful graphs belong, and where SQL wins
Not every part of the platform needs AI that reasons in loops. Only the parts that genuinely require back-and-forth (drafting and fixing lessons, coaching a student through revisions) use it. Everything that tracks progress or credits runs on ordinary, predictable code, so an AI model can never miscount a student’s credits or unlock the wrong level.
CareerTalkLab (careertalklab.com) serves Turkish software, marketing, and data professionals through Errorless Teaching (Prompt → Echo → Distractor → Transfer). Adding stateful orchestration everywhere would inflate tail latency, weaken auditability, and risk data corruption on mastery records. Instead, I separated the platform into four distinct runtime boundaries:
| Surface | Goal | Runtime Architecture | Why This Boundary |
|---|---|---|---|
| Surface A: Newsjacking Lesson Pipeline | Turn industry articles into B1, B2, and C1 Business English lessons | 11-node LangGraph StateGraph with bounded surgical self-repair and admin approval interrupt | Needs multi-level drafting, zero-cost deterministic gatekeeping before LLM judging, targeted JSON patching, and resumable sign-off |
| Surface B: Attainment, Credits & Rehearsal | Track Level 1–4 mastery, feedback credits, rate limits, and L2→L3 practice | PostgreSQL SECURITY DEFINER RPCs for attainment/credits; isolated rehearsal graph for optional role-play | Mastery unlocks, prerequisites, and credit mutations require ACID row locks (FOR UPDATE) with zero probabilistic routing |
| Surface C: Proactive Errorless Coaching | Guide learners through multi-turn writing refinement with Turkish L1 cues | 7-node LangGraph StateGraph with PII scrubbing, turn interrupts, and instructor escalation | Naturally multi-turn: pauses after each learner reply, tracks retry streaks, and suspends into the instructor inbox on escalation |
| Surface D: Foundational A1/A2 Drills | High-volume GSE-aligned onboarding modules | Deterministic client & RPC progression | Sub-100ms response, zero marginal inference cost, and fixed Errorless sequencing need no graph state |
Strict database isolation rules ensure the AI coaching chat can only save conversation logs and the student’s final writing draft. It can never touch or accidentally alter official course progress or referral credit balances.
Inside the news-to-lesson graph and human gate
The lesson pipeline reads the outside news article once inside strict security boundaries, locking in the target industry and difficulty level (B1, B2, or C1) on the server so external text cannot manipulate the settings. It then pulls recently taught vocabulary (so lessons don’t repeat words) and common Turkish-speaker grammar pitfalls (so lessons target them) before drafting all three lesson levels.
Before paying for an AI quality review, every draft must pass a fast, rule-based code check for vocabulary count (8–12 terms), question structure, and grammar formatting. If a draft needs a fix, it goes through the same check again, and version tracking ensures the pipeline only re-evaluates the specific lesson level that changed, saving time and API costs.
Each server request can run for only 60 seconds, so long jobs are split into chunks that save their progress and pick up where the last one left off, with hard caps on time, AI usage, and cost.
Because Vercel Serverless Functions enforce a 60-second execution ceiling, long runs advance cooperatively across slices through four mechanisms:
- Durable PostgreSQL checkpointing and row leases: A custom PostgREST checkpoint saver backed by PostgreSQL
SECURITY DEFINERRPCs andFOR UPDATE SKIP LOCKEDrow leases prevent concurrent double-execution. - Cooperative time cutoffs: Each slice stops accepting new model calls at 52 seconds and caps every Gemini request at 25 seconds via
AbortSignal. - Automatic slice handoff: Unfinished runs flush pending checkpoints and yield cleanly to client continuation or a 1-minute cron reaper.
- Hard per-run circuit breakers: Every run is bounded by hard ceilings of 12 slices, 250,000 tokens, and $0.75.
Nothing goes live until a person approves it: the graph pauses at a human-review step. Reviewers govern runs from a dedicated admin trace screen showing exact revision counts, token and cost budgets, hash-pinned promotion controls, and the 7-category rubric breakdown without reading server logs.

Opening the step-by-step audit drawer shows the recently taught vocabulary the AI checked to avoid repeats and the Turkish L1 grammar pitfalls it was told to target. It also displays a timeline of every workflow step, logging how long each step took, a unique version ID (SHA-256) for each draft, token usage, and the exact dollar cost from initial article extraction to final publication.

What the 20-article live evaluation revealed, and what I fixed
Put simply: I ran the full pipeline on 20 real articles before and after a round of fixes. The first test showed three problems. The AI was “overthinking” and running out of time, the repair step was accidentally erasing parts of the lesson it was fixing, and the activity log showed steps out of order. Fixing all three took the success rate from 25% to 85%.
Offline mocks hide timeout tails and JSON merge regressions. I built a held-out 20-article evaluation corpus across software engineering, marketing, and hospitality (CareerTalkLab’s third legacy industry track, kept in the corpus to test domain generalization outside software and marketing jargon), booted against the full PostgreSQL migration chain in embedded PGlite with live gemini-2.5-flash calls (60 target CEFR drafts per evaluation pass).
The baseline pass exposed three concrete defects: unbudgeted model reasoning consumed 214,936 thoughtsTokens (58.3% of generated + thinking tokens) and aborted 11 of 20 runs on 25-second per-call timeouts; shallow object spread during surgical JSON repair accidentally wiped sibling fields inside nested objects like grammar_focus; and stage-delta sorting by random UUIDv4 scrambled multi-round telemetry.
Adding stage-scoped thinkingBudget caps (256 tokens for planning/drafting, 512 for judging/revision), a recursive deep-merge patch helper that rejects empty wipes, and chronological delta sorting eliminated every operational timeout on the full 20-article post-remediation pass:
| Metric (20 Articles / 60 Drafts) | Pre-Remediation Pass | Post-Remediation Pass | Delta |
|---|---|---|---|
End-to-end accepted (ready_for_review) |
5 / 20 (25.0%) | 17 / 20 (85.0%) | +60.0 pts (+12 runs) |
| Operational timeout failures | 11 / 20 (55.0%) | 0 / 20 (0.0%) | −11 runs |
| Deterministic compliance after repair* | 27 / 60 drafts (45.0%) | 59 / 60 drafts (98.33%) | +53.33 pts (+32 drafts) |
| Final LLM judge pass rate* | 23 / 30 evaluated (76.67%) | 57 / 60 evaluated (95.0%) | +18.33 pts at 2x coverage |
| Final judge mean score (out of 35) | 33.20 / 35 (30 evaluated) | 33.13 / 35 (60 evaluated) | Quality held at 2x scale |
Reasoning (thoughtsTokens) volume |
214,936 (58.3% of gen+thought) | 60,327 (20.8%) | −71.9% |
| Total pass cost | $1.02 (114 calls) | $0.89 (172 calls) | −12.9% despite 1.51x calls |
| Median / p95 run latency (wall-clock across slices) | 161,531ms / 255,120ms | 68,182ms / 82,240ms | −57.8% p50 / −67.8% p95 |
*Every judged draft passed the deterministic validator in the round it was judged. Judged totals can exceed final compliance because a repair triggered by a low judge score can fail re-validation once the two-revision cap is hit (one C1 draft post-remediation; three baseline drafts hit by shallow-spread field wipes).
Just as important, the 3 non-accepted runs in the post-remediation pass failed cleanly in quarantine at the two-revision auto-repair limit with clear diagnostics: the LLM judge scored two B1 drafts below threshold on grammar or vocabulary complexity, and one C1 draft kept 13 vocabulary terms instead of 8–12. In production, a multi-level run on a live engineering article deployed all three CEFR levels in 6 slices across 11 stage deltas for $0.06, scoring 34/35 (B1), 33/35 (B2), and 35/35 (C1).
Errorless writing coaching and Turkish L1 scaffolding
When a student submits a piece of writing, the coach doesn’t grade it. It gives gentle hints aimed at mistakes Turkish speakers commonly make in English, and it removes personal details before anything is saved or sent to the AI.
On the learner side, Surface C turns student writing drafts into a supportive, ungraded coaching conversation rather than a pass/fail auto-grader. Deterministic Turkish-to-English L1 interference rules detect common transfer patterns such as article omission, preposition errors carried over from Turkish postpositions, and copula (to be) omission. They then inject stealth cues (brief pre-writing prompts that model the target English pattern before the learner revises, without red-pen error labels) plus a starter word bank.
Every student message passes through a pre-checkpoint PII scrubber stripping Turkish National ID numbers, spaced or contiguous TR IBANs, +90 phone numbers, email addresses, and student names before persistence or inference. Database row locks (FOR UPDATE), duplicate-request protections, and strict ownership checks guarantee that simultaneous clicks never double-charge credits or overwrite another student’s work. Every code change is automatically tested against 7 simulated attack scenarios and live database stress tests.
How this complements the Digital Twin
The Digital Twin on this site answers visitors’ questions about my work. This project shows the other half: AI that creates content, under strict automated checks and human approval.
If the Digital Twin demonstrates conversational retrieval, citation allowlisting, and bounded answer verification for visitors, CareerTalkLab’s LangGraph architecture demonstrates the production-generation side: curriculum grounding, deterministic gates ahead of semantic judges, bounded surgical repair, serverless PostgreSQL lease recovery, and mandatory human sign-off.
You can read the full technical write-up in the sanitized engineering case study, or explore the live platform at careertalklab.com. The case study includes both state-machine diagrams, a redacted 15-delta execution trace from a two-repair-round run (showing how cyclic revise, re-validation, and selective re-judge steps extend the 11-delta zero-revision path), and the 7-scenario safety matrix.