Build a LangGraph-powered RAG support agent that measures its own retrieval confidence before answering. If the top similarity score is below threshold, it asks one clarifying question and re-runs retrieval. If it still cannot answer confidently, it escalates to a human queue and logs the gap. A self-critic agent reviews every generated answer before it is sent. Every escalation is logged to Supabase and batched weekly into a KB improvement brief so the agent gets smarter over time.
3–8 hours per week of Tier-1 support handling eliminated once KB coverage reaches steady state
Customer Support
Claude
Knowledge base documents in markdown, PDF, or plain text format; Pinecone or FAISS vector store; Supabase project for escalation logging; Claude API key; FastAPI or equivalent for the HTTP endpoint; existing support conversation samples for confidence threshold calibration
Test with 20 queries spanning your KB topics and 10 deliberately out-of-scope queries. Confirm out-of-scope queries escalate correctly. Measure your false-positive escalation rate over the first week — if more than 20% of answerable queries escalate, lower the confidence threshold from 0.72 to 0.65. Review the first week's escalation log manually to confirm the KB improvement suggestions are accurate.
KB accuracy is a prerequisite — the agent can only be as good as the documents it retrieves from. Retrieval confidence threshold (default 0.72) must be calibrated on your own data; the right value varies by domain and KB quality. Does not replace human agents for emotionally sensitive, legally complex, or account-specific issues. Pinecone free tier has index size limits — plan for a paid tier if your KB exceeds 100K vectors.
Stack: LangGraph (state machine and conditional routing), Pinecone or FAISS (vector store), Anthropic SDK (Claude Sonnet for all agents), Supabase (escalation logging and KB gap tracking), FastAPI (HTTP endpoint). The Self-Critic agent is the key differentiator — its prompt is: "Query: {user_query} | Generated Answer: {answer} | Does this answer directly and completely address the query? Answer Yes or No and explain why. If No: what specific information is missing?" If No: rewrite the search query using the missing information identified, re-run retrieval once. The confidence threshold is not a magic number; instrument it and adjust based on observed escalation rate in production.