AI & human judgment
From Prompt to Graph: Building an HR AI Agent Taught Me the Hard Part Is Trust, Not Zero Errors
3 min readAI Agents, HR Tech, Human-AI Collaboration, Agent Engineering
Key takeaways
- At the company where I worked, I built an attendance audit agent that analyzes attendance, leave, and overtime data and flags the anomalies HR and managers actually need to look at.
- Along the way, I ended up working through all five layers of agent engineering: Prompt, Context, Harness, Loop, and Graph.
- None of these layers exist to make the AI smarter. Each one exists to make it more trustworthy.
- Three real runs with zero errors turned out to be a warning sign: the retry paths had never been triggered, so they had never been tested.
- The AI digs through the data and surfaces patterns. Deciding who needs support, and how to talk with them, stays with people.
What is the hardest part of building an HR AI agent?
The hardest part is building trust, not reaching zero errors. I thought I was simply building an AI tool. Once it was running on real data, I saw that almost every mistake came from not understanding the company, not from weak reasoning.
If you picture the agent as a new HR hire, the five layers make intuitive sense. Were the tasks explained clearly (Prompt)? Does it know the unwritten rules only insiders know (Context)? Are there permissions and boundaries in place (Harness)? Is there a way to catch and correct mistakes (Loop)? How much flexibility does the team's division of labor need (Graph)?
The first three layers each gave me a classic failure. The system once read "clocked hours exceed approved overtime" as an unpaid-overtime risk, but company policy requires overtime to be requested, so unrequested time was never overtime. It recommended adding headcount at a small overseas office that was small by design. And it flagged an executive whose role doesn't require clocking in as "zero attendance for months." Each failure called for a different fix, which the full article walks through. The short version: if a data structure or deterministic code can enforce a rule, don't rely on a prompt to remind the model.
If the system never failed, why couldn't I trust it?
Because a safeguard that has never failed has never been tested. The system had two automatic loops: one sends the agent back to gather more evidence when the evidence is thin, and one sends a report back for rewriting when it fails the compliance audit. Three clean first-pass runs meant neither loop had ever run.
So I went looking for real cases I knew would get stuck and made the system fail in front of me. That surfaced three design blind spots and led me to rebuild the mechanism as two layers: a gate and a loop. Then, not long after launch, the gate itself made a mistake. The lesson stuck with me: the mechanisms meant to prevent errors make errors too, and the more reliable they look, the more likely we are to trust them without question.
When should you stop adding architecture?
When the workflow is fairly stable and the roles are already clear, adding abstraction for its own sake doesn't help. I considered rewriting the system as a general-purpose graph architecture and decided against it. Reliability comes from verification, feedback, and correction, not from the number of agents.
Three things to take away
- Instead of adding another abstract rule to your prompt, write in one real misjudgment along with the correct answer.
- When every test passes, go find the cases that will get stuck, and confirm your retry and fallback paths actually work.
- Decide which judgments belong to the AI and which must stay with people before you decide how complex the system should be.