Skip to content

Building a Support Agent That Knows When to Stop — My Agentic AI Capstone

A technical deep-dive into my IIT Madras Agentic AI capstone: a framework-free customer-support resolution agent with deterministic pre-LLM safety, grounded RAG, guarded tool use, memory — and the live date-arithmetic failure that reshaped its architecture.

By Ajay Walia · Jul 16, 2026 · 3 min read

Share: LinkedIn
Hero illustration for the NovaMart support agent — a glowing cyan AI shield-gate routing customer chat streams: green passes through, red is refused, amber is escalated to a human specialist with a ticket

Every capstone in an agentic AI program builds an agent. Mine ended up being about something narrower and, I think, more useful: teaching an agent when to stop — when to refuse, when to escalate, and when to admit it doesn’t know.

The project is a support-resolution agent for NovaMart, a fictional electronics retailer handling ~4,000 support contacts a day. Roughly 70% of those are questions whose answers exist verbatim in policy documents or the order database. The agent’s job is to resolve that 70% with grounded, cited answers — and convert the risky 30% (chargebacks, unauthorized orders, discretion calls) into well-formed, prioritised human tickets.

I built it framework-free (Track B): plain Python plus the OpenAI API, ~900 lines of owned code, five dependencies. Everything LangChain would have provided — RAG, tool orchestration, memory, planning — exists in the codebase directly and inspectably, which mattered the day I had to answer “why did it say that?”

Three design decisions carry the project:

Safety runs before the LLM, deterministically. Six refusal patterns (fraud, verification bypass, cross-customer data…) and six escalation triggers (chargeback, unauthorized order, threats…) are regex checks that fire in 0.1ms — unsafe requests never reach the model at all. The system prompt repeats the rules only as a second layer.

Retrieval is unconditional, and silence beats improvisation. A numpy cosine store over 31 section-aware chunks grounds every answer with policy-id citations; below a 0.25 similarity floor the agent says “I don’t have that information” and offers a human, never a guess.

If a sub-task has a deterministic solution, route around the LLM. The best lesson came from a live failure: asked about returning a laptop delivered 8 days earlier — inside the 14-day window — the agent retrieved the right policy, fetched the right delivery date, did the subtraction itself, and got it wrong. A wrong verdict wrapped in a correct citation. The fix wasn’t a prompt tweak; it was architectural — return-intent queries now always pre-run a pure-Python eligibility tool whose verdict is injected as authoritative. The LLM explains the verdict; it no longer produces it.

The final build passes 10/10 behavioural eval cases (tool use, grounding, refusal, escalation) at 1.3s median latency, with zero fabricated policies observed and PII-redacted logs throughout.

Capstone · Interactive Deep-Dive
Read the full interactive article — animated architecture, live transcripts, before/after failure analysis →
10 sections · interactive safety-router demo · real gpt-4o-mini terminal captures · opens in a new tab

This capstone concludes my Agentic AI program at IIT Madras. The full pipeline — mock mode included, so it runs without an API key — is reproducible from the repository, and every claim above is backed by a regenerable artefact in its evidence/ folder.

Ajay Walia

About the Author

Ajay Walia

AI {IT Architect} focusing on local-first multi-agent AI engineering, zero-data-egress systems. Ideator, Creator and Executor on Curious Bit.

Don't stop now

Keep Reading