// blog
Building AI Agents That Actually Ship: Lessons from Production
There’s a gap between the AI agent demo that impresses your CEO and the AI agent that runs reliably in production at 3 AM on a Saturday. I’ve been on both sides of that gap. Here’s what I’ve learned.
Lesson 1: RAG Over Fine-Tuning, Almost Always
When I built the AI chatbot at Keller Williams, the temptation was to fine-tune a model on our proprietary real estate data. We tried it. It was expensive, slow to iterate, and the model hallucinated confidently about properties that didn’t exist.
What worked: Retrieval-Augmented Generation (RAG) with pgvector. We embedded our property data, agent documentation, and internal knowledge base into vector representations, then retrieved the most relevant context at query time.
The result:
- 90% reduction in hallucinations compared to fine-tuning
- Minutes to update instead of hours to retrain
- Transparent sourcing — we could show users exactly where the answer came from
Lesson 2: Design for Failure, Not Success
Your AI agent will be wrong. The question is: what happens when it is?
Build these safety nets from day one:
- Confidence scoring. If the agent isn’t sure, it should say so. We implemented a simple threshold: below 0.7 confidence, the agent asks a clarifying question instead of guessing.
- Human escalation. Every agent needs an escape hatch. Ours could route to a human agent via WebSocket in under 2 seconds.
- Audit trail. Log every decision the agent makes, the context it used, and the response it generated. When something goes wrong (and it will), you need to debug it.
Lesson 3: Start Narrow, Expand Slowly
The temptation is to build a general-purpose assistant. Don’t. Start with one specific workflow:
- “Help agents find property details” (not “answer any question about real estate”)
- “Classify incoming support tickets” (not “handle all customer service”)
- “Generate weekly reports from sales data” (not “analyze everything”)
Once you nail one workflow with 95%+ accuracy, expand to the next. This approach:
- Keeps the scope manageable
- Makes evaluation concrete (did it get the right property? yes/no)
- Builds trust with stakeholders incrementally
Lesson 4: The Integration Is Harder Than the AI
Building the LLM pipeline took about 20% of the total effort. The other 80%:
- Authentication and authorization — who can the agent act on behalf of?
- Rate limiting — preventing runaway API costs
- Caching — not every query needs a fresh LLM call
- Monitoring — latency, error rates, token usage, cost per query
- Graceful degradation — what happens when the LLM provider has an outage?
The AI part is the easy part. The production engineering around it is where the real work lives.
Lesson 5: Measure Impact, Not Impressiveness
Nobody cares that your agent uses GPT-4 with a multi-stage reasoning chain. They care that:
- Support ticket resolution time dropped by 40%
- Manual data entry went from 20 hours/week to 2
- Error rates in order processing fell by 85%
Build your metrics dashboard before you build your agent. Know what “success” looks like in numbers, and track it from day one.
The AI agent gold rush is real, but most of the value isn’t in building the most sophisticated model — it’s in picking the right process to automate and engineering a reliable system around it. Start boring. Ship fast. Measure everything.