The Challenge
Build an intelligent HR platform that ingests thousands of employee events (feedback, call transcripts, compliance issues, performance reviews) and turns them into actionable insights, recommendations, and policy documents for business owners, managers, and employees. At scale, with a quality bar on every output.
What I Built
Brighten, a multi-stage, event-driven AI pipeline on AWS that turned raw HR events into production-ready business intelligence.
The Pipeline
Every HR event flowed through a 10-stage pipeline:
- Ingestion. Events published to SNS, stored in a data lake.
- Vectorization. Embeddings generated for semantic search and clustering.
- Smart Batching. Dual-level batching (company and individual) with priority routing across HIGH, MEDIUM, and LOW.
- Gap Detection. AI identifies missing information, pauses the pipeline, and triggers interactive wizards to collect it.
- Insight Generation. An LLM analyzes batched events and produces structured insights.
- Recommendation. Actionable recommendations derived from those insights.
- Solution Generation. Full policy documents, CAPs, PIPs, job descriptions.
- Notice Creation. User-facing notices written per audience (owner, manager, employee).
- Editorial Review. AI-driven content refinement and quality pass.
- Broadcasting. Distribution to stakeholders.
Every AI generation stage passed through an LLM-as-judge evaluation gate scoring five criteria on a 0-1 scale: relevance, brand alignment, clarity, whether internal details leaked, and whether the output asked the user to improve the platform itself. The threshold was 0.7. Below that, the stage retried with backoff, so every piece of AI-generated content met a consistent bar before reaching a human.
v1 to v2 Migration
The original architecture used pure SNS/SQS, with every stage a separate Lambda consuming from its own queue. It worked, but during HIGH event spikes all workers competed for Lambda concurrency, and individual batch processing time was both unpredictable and unmeasurable.
v2 moved everything downstream of batch collection to AWS Step Functions, giving each batch its own isolated state machine execution:
- Process isolation. Batch A doesn’t slow batch B.
- Built-in observability. Exact duration per batch and per stage, with visual execution graphs.
- Declarative retries. Retry policies live in the state machine instead of custom handler code.
- Parallel fan-out. Map states for notice generation, which was the sequential bottleneck in v1.
Batch processing went from hours during spikes to minutes.
Multi-Track Architecture
v2 introduced parallel tracks targeting different audiences from the same batch:
- Owner track: company-wide insights, full pipeline with gap detection and all solution types
- Manager track: role-scoped recommendations, team-level notices
- Employee track: personalized insights delivered to specific individuals
Tracks ran as independent Step Function definitions, so a failure in one didn’t block the others.
Emotional Drift Analysis
LOW-priority batches (historical imports, background analytics) ran through a separate pipeline analyzing emotional trends across a 16-emotion framework. Company drift threshold: 20%. Employee drift threshold: 25%. Significant drift automatically generated HIGH-priority events that re-entered the main pipeline.
Technical Highlights
- Event-driven architecture processing thousands of HR events across hundreds of companies
- LLM-as-judge quality gates at every AI generation stage (5 criteria, 0.7 threshold)
- AI debugger with code reflection: captured stack traces, sent source context to a fast model, returned a structured summary, root cause, suggested fix, and a ready-to-paste Claude prompt
- Dual-level batching with priority cascading, so HIGH events count toward MEDIUM and LOW thresholds
- Solution throttle: max 100 solutions per 24-hour window per company
- Snowflake analytics dashboard with 15 charts tracking pipeline performance, engagement, and AI quality
- Test metadata flags for controlled failure injection and pipeline behavior testing